Switch project to dynamic version based on Git commits

This commit is contained in:
Zoé Cassiopée Gauthier 2024-04-16 11:44:41 -04:00
parent 754fd46ee7
commit e1cf1cb194
3 changed files with 14 additions and 2 deletions

1
.gitignore vendored
View File

@ -1,3 +1,4 @@
__pycache__/
dist/
src/pogo_scaled_estimators/_version.py
*.sqlite

View File

@ -1,10 +1,10 @@
[build-system]
requires = ["hatchling"]
requires = ["hatchling", "hatch-vcs"]
build-backend = "hatchling.build"
[project]
name = "pogo-scaled-estimators"
version = "1.0a1"
dynamic = ["version"]
dependencies = [
"requests",
"requests-cache",
@ -32,6 +32,12 @@ classifiers = [
[project.scripts]
ase-cli = "pogo_scaled_estimators:main_cli"
[tool.hatch.version]
source = "vcs"
[tool.hatch.build.hooks.vcs]
version-file = "src/pogo_scaled_estimators/_version.py"
[tool.hatch.envs.lint]
detached = true
dependencies = [
@ -48,6 +54,9 @@ typing = ["pyright"]
[tool.ruff]
target-version = "py312"
line-length = 120
exclude = [
"src/pogo_scaled_estimators/_version.py",
]
[tool.ruff.lint]
select = [

View File

@ -9,6 +9,7 @@ import operator
import sys
from functools import reduce
from pogo_scaled_estimators._version import version
from pogo_scaled_estimators.calculator import Calculator, Filter
@ -23,6 +24,7 @@ def main_cli():
_ = parser.add_argument(
"--no-legendary", dest="filters", action="append_const", const=Filter.DISALLOW_LEGENDARY_POKEMON
)
_ = parser.add_argument("--version", action="version", version=version)
args = parser.parse_args()
filters = reduce(operator.or_, args.filters or [], Filter.NO_FILTER)