Skip to content

Commit

Permalink
hatch-vcs
Browse files Browse the repository at this point in the history
  • Loading branch information
FlavioAmurrioCS committed Jan 4, 2024
1 parent 7c939f9 commit 26666c6
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 5 deletions.
1 change: 1 addition & 0 deletions .github/workflows/publish-to-test-pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ jobs:
--repo '${{ github.repository }}'
publish-to-testpypi:
if: false # uncomment this line to enable publishing to TestPyPI
name: Publish Python 🐍 distribution 📦 to TestPyPI
needs:
- build
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -127,3 +127,4 @@ dmypy.json

# Pyre type checker
.pyre/
src/log_tool/_version.py
13 changes: 11 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[build-system]
requires = ["hatchling"]
requires = ["hatchling", "hatch-vcs"]
build-backend = "hatchling.build"

[project]
Expand Down Expand Up @@ -40,12 +40,16 @@ Issues = "https://github.com/FlavioAmurrioCS/log-tool/issues"
Source = "https://github.com/FlavioAmurrioCS/log-tool"

[tool.hatch.version]
path = "src/log_tool/__about__.py"
source = "vcs"

[tool.hatch.build.hooks.vcs]
version-file = "src/log_tool/_version.py"

[tool.hatch.envs.default]
dependencies = [
"coverage[toml]>=6.5",
"pytest",
"setuptools-scm",
]
[tool.hatch.envs.default.scripts]
test = "pytest {args:tests}"
Expand Down Expand Up @@ -88,8 +92,13 @@ exclude_lines = [
"if TYPE_CHECKING:",
]


# COMMON SETTINGS BELOW
[tool.pyright]
pythonVersion = "3.8"

[tool.mypy]
python_version = "3.8"
check_untyped_defs = true
disallow_any_generics = true
disallow_incomplete_defs = true
Expand Down
3 changes: 0 additions & 3 deletions src/log_tool/__about__.py

This file was deleted.

13 changes: 13 additions & 0 deletions src/log_tool/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,19 @@
# flake8: noqa: E501
from __future__ import annotations

try:
from setuptools_scm import get_version

__version__ = get_version(root="..", relative_to=__file__)
except (ImportError, LookupError):
try:
from log_tool._version import ( # type: ignore[no-redef,unused-ignore] # noqa: F401
__version__, #
)
except ModuleNotFoundError:
msg = "dev-toolbox is not correctly installed. Please install it with pip."
raise RuntimeError(msg) # noqa: B904, TRY200

import itertools
import logging
import os
Expand Down

0 comments on commit 26666c6

Please sign in to comment.