Skip to content

Commit 15a60b8

Browse files
committed
Update pyproject.toml and add dynamic versioning
1 parent 2946a75 commit 15a60b8

File tree

2 files changed

+26
-9
lines changed

2 files changed

+26
-9
lines changed

django_datacite/__init__.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1-
VERSION = __version__ = '1.0.2'
1+
from importlib.metadata import PackageNotFoundError
2+
from importlib.metadata import version as _version
3+
4+
try:
5+
VERSION = __version__ = _version(__package__)
6+
except PackageNotFoundError:
7+
VERSION = __version__ = "0.0.0+unknown"
8+
29

310
default_app_config = 'django_datacite.apps.DataciteConfig'

pyproject.toml

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[build-system]
2-
requires = ["setuptools", "wheel"]
32
build-backend = "setuptools.build_meta"
3+
requires = ["setuptools", "setuptools_scm"]
44

55
[project]
66
name = "django-datacite"
@@ -36,6 +36,7 @@ dynamic = ["version"]
3636

3737
[project.optional-dependencies]
3838
dev = [
39+
"build",
3940
"pre-commit",
4041
"ruff",
4142
]
@@ -58,8 +59,8 @@ exclude = ["*tests*"]
5859
[tool.setuptools.package-data]
5960
"*" = ["*"]
6061

61-
[tool.setuptools.dynamic]
62-
version = { attr = "django_datacite.__version__" }
62+
[tool.setuptools_scm]
63+
version_scheme = "release-branch-semver"
6364

6465
[tool.pytest.ini_options]
6566
DJANGO_SETTINGS_MODULE = "config.settings"
@@ -70,6 +71,8 @@ pythonpath = "testing/"
7071
[tool.ruff]
7172
target-version = "py38"
7273
line-length = 120
74+
75+
[tool.ruff.lint]
7376
select = [
7477
"B", # flake8-bugbear
7578
"C4", # flake8-comprehensions
@@ -83,13 +86,10 @@ select = [
8386
"YTT", # flake8-2020
8487
]
8588
ignore = [
86-
"B006", # mutable-argument-default
87-
"B007", # unused-loop-control-variable
88-
"B018", # useless-expression
8989
"RUF012", # mutable-class-default
9090
]
9191

92-
[tool.ruff.isort]
92+
[tool.ruff.lint.isort]
9393
known-first-party = [
9494
"django_datacite"
9595
]
@@ -104,7 +104,17 @@ section-order = [
104104
"local-folder"
105105
]
106106

107-
[tool.ruff.isort.sections]
107+
[tool.ruff.lint.isort.sections]
108108
pytest = ["pytest"]
109109
django = ["django"]
110110
rest_framework = ["rest_framework"]
111+
112+
[tool.coverage.report]
113+
exclude_lines = [
114+
"pragma: no cover",
115+
"except PackageNotFoundError:",
116+
"except requests.exceptions.ConnectionError",
117+
"raise AssertionError",
118+
"raise NotImplementedError",
119+
"raise RuntimeError"
120+
]

0 commit comments

Comments
 (0)