Skip to content
Snippets Groups Projects
Commit e73901b0 authored by André Anjos's avatar André Anjos :speech_balloon:
Browse files

[pyproject] Use hatch and versioningit for modern project management

parent 6e65350c
Branches
Tags
1 merge request!19Use hatch and versioningit for modern project management
Pipeline #85439 failed
...@@ -13,7 +13,6 @@ ...@@ -13,7 +13,6 @@
coverage.xml coverage.xml
test_results.xml test_results.xml
junit-coverage.xml junit-coverage.xml
environment.yaml
html/ html/
build/ build/
doc/api/ doc/api/
......
# SPDX-FileCopyrightText: Copyright © 2022 Idiap Research Institute <contact@idiap.ch>
#
# SPDX-License-Identifier: BSD-3-Clause
include LICENSES/*.txt
recursive-include doc *.rst *.txt *.py
recursive-include tests *.py *.cfg
...@@ -2,11 +2,9 @@ ...@@ -2,11 +2,9 @@
# #
# SPDX-License-Identifier: BSD-3-Clause # SPDX-License-Identifier: BSD-3-Clause
{% set data = load_file_data(RECIPE_DIR + '/../pyproject.toml') %}
package: package:
name: {{ data['project']['name'] }} name: {{ data['project']['name'] }}
version: {{ data['project']['version'] }} version: {{ environ.get('PACKAGE_VERSION', environ.get('GIT_DESCRIBE_TAG')) }}
source: source:
path: .. path: ..
......
...@@ -3,34 +3,53 @@ ...@@ -3,34 +3,53 @@
# SPDX-License-Identifier: BSD-3-Clause # SPDX-License-Identifier: BSD-3-Clause
[build-system] [build-system]
requires = ["setuptools>=61.0.0", "wheel"] requires = ["hatchling", "versioningit"]
build-backend = "setuptools.build_meta" build-backend = "hatchling.build"
[project] [project]
name = "clapper" name = "clapper"
version = "1.0.2b0" dynamic = ["version"]
requires-python = ">=3.10" requires-python = ">=3.10"
description = "Configuration Support for Python Packages and CLIs" description = "Configuration Support for Python Packages and CLIs"
readme = "README.md" readme = "README.md"
license = {text = "BSD 3-Clause License"} license = { text = "BSD 3-Clause License" }
authors = [ authors = [{ name = "Andre Anjos", email = "andre.anjos@idiap.ch" }]
{name = "Andre Anjos", email = "andre.anjos@idiap.ch"},
]
classifiers = [ classifiers = [
"Development Status :: 4 - Beta", "Development Status :: 4 - Beta",
"Intended Audience :: Developers", "Intended Audience :: Developers",
"License :: OSI Approved :: BSD License", "License :: OSI Approved :: BSD License",
"Natural Language :: English", "Natural Language :: English",
"Programming Language :: Python :: 3", "Programming Language :: Python :: 3",
"Topic :: Software Development :: Libraries :: Python Modules", "Topic :: Software Development :: Libraries :: Python Modules",
] ]
dependencies = [ dependencies = ["click>=8", "tomli", "tomli-w", "xdg"]
"click>=8",
"tomli", [tool.hatch.version]
"tomli-w", source = "versioningit"
"xdg",
[tool.versioningit.next-version]
method = "smallest"
[tool.versioningit.format]
# Example formatted version: 1.2.4.dev42+ge174a1f
distance = "{next_version}.dev{distance}+{vcs}{rev}"
# Example formatted version: 1.2.4.dev42+ge174a1f.d20230922
distance-dirty = "{next_version}.dev{distance}+{vcs}{rev}.d{build_date:%Y%m%d}"
[tool.hatch.build.targets.sdist]
include = [
"src/**/*.py",
"tests/**/*.py",
"tests/**/*.cfg",
"doc/**/*.rst",
"doc/**/*.txt",
"doc/**/*.py",
"LICENSES/*.txt",
] ]
[tool.hatch.build.targets.wheel]
packages = ["src/clapper"]
[project.urls] [project.urls]
documentation = "https://clapper.readthedocs.io/en/latest/" documentation = "https://clapper.readthedocs.io/en/latest/"
homepage = "https://pypi.org/project/clapper" homepage = "https://pypi.org/project/clapper"
...@@ -40,19 +59,15 @@ changelog = "https://gitlab.idiap.ch/software/clapper/-/releases" ...@@ -40,19 +59,15 @@ changelog = "https://gitlab.idiap.ch/software/clapper/-/releases"
[project.optional-dependencies] [project.optional-dependencies]
qa = ["pre-commit"] qa = ["pre-commit"]
doc = [ doc = [
"sphinx", "sphinx",
"furo", "furo",
"sphinx-autodoc-typehints", "sphinx-autodoc-typehints",
"sphinxcontrib-programoutput", "sphinxcontrib-programoutput",
"auto-intersphinx", "auto-intersphinx",
"sphinx-copybutton", "sphinx-copybutton",
"sphinx-inline-tabs", "sphinx-inline-tabs",
] ]
test = [ test = ["pytest", "pytest-cov", "coverage"]
"pytest",
"pytest-cov",
"coverage",
]
[project.entry-points."clapper.test.config"] [project.entry-points."clapper.test.config"]
first = "tests.data.basic_config" first = "tests.data.basic_config"
...@@ -66,13 +81,6 @@ complex-var = "tests.data.complex:cplx" ...@@ -66,13 +81,6 @@ complex-var = "tests.data.complex:cplx"
verbose-config = "tests.data.verbose_config" verbose-config = "tests.data.verbose_config"
error-config = "tests.data.doesnt_exist" error-config = "tests.data.doesnt_exist"
[tool.setuptools]
zip-safe = true
package-dir = {"" = "src"}
[tool.distutils.bdist_wheel]
universal = true
[tool.isort] [tool.isort]
profile = "black" profile = "black"
line_length = 80 line_length = 80
...@@ -83,10 +91,6 @@ lines_between_types = 1 ...@@ -83,10 +91,6 @@ lines_between_types = 1
line-length = 80 line-length = 80
[tool.pytest.ini_options] [tool.pytest.ini_options]
addopts = [ addopts = ["--cov=clapper", "--cov-report=term-missing", "--import-mode=append"]
"--cov=clapper",
"--cov-report=term-missing",
"--import-mode=append",
]
junit_logging = "all" junit_logging = "all"
junit_log_passing_tests = false junit_log_passing_tests = false
# SPDX-FileCopyrightText: Copyright © 2022 Idiap Research Institute <contact@idiap.ch>
#
# SPDX-License-Identifier: BSD-3-Clause
from setuptools import setup
setup()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment