diff --git a/pyproject.toml b/pyproject.toml index 973f6e9..4032bc0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,10 +1,10 @@ [build-system] -requires = ["setuptools>=61", "pbr>=2.0"] -build-backend = "setuptools.build_meta" +requires = ["hatchling", "hatch-vcs", "hatch-requirements-txt"] +build-backend = "hatchling.build" [project] name = "seive_cache" -dynamic = ["version"] +dynamic = ["version", "dependencies"] description = "A simple implementation of SEIVE caching algorithm" readme = "README.md" requires-python = ">=3.10" @@ -19,11 +19,6 @@ classifiers = [ "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3.10", ] -dependencies = [ - "stevedore>=5.1.0", - "dogpile.cache>=1.3.0", - "iso8601>=2.1.0", -] [project.optional-dependencies] redis = ["redis"] @@ -31,11 +26,14 @@ redis = ["redis"] [project.entry-points."dogpile.cache"] "sieve_cache.memory" = "sieve_cache.backends.memory:InMemoryDriver" -[tool.setuptools.dynamic] -version = { attr = "sieve_cache.version.version_string" } +[tool.hatch.build.targets.wheel] +packages = ["sieve_cache"] + +[tool.hatch.version] +source = "vcs" -[tool.setuptools.packages.find] -include = ["sieve_cache*"] +[tool.hatch.metadata.hooks.requirements_txt] +files = ["requirements.txt"] [tool.ruff] line-length = 79 diff --git a/requirements.txt b/requirements.txt index a6b25b6..d224410 100644 --- a/requirements.txt +++ b/requirements.txt @@ -10,7 +10,6 @@ # License for the specific language governing permissions and limitations # under the License. -pbr>=6.0.0 stevedore>=5.1.0 dogpile.cache>=1.3.0 iso8601>=2.1.0 \ No newline at end of file diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index 01a7a07..0000000 --- a/setup.cfg +++ /dev/null @@ -1,21 +0,0 @@ -[metadata] -name = sieve_cache - -[flake8] -# [H104]: Empty file with only comments -# [W504]: Line break after binary operator -# [W503]: Line break before binary operator -# [H306]: Alphabetically order your imports by the full module path -# [H405]: Multi line docstring summary not separated with an empty line -# [I202]: Additional newline in a group of imports. -ignore = H104,W504,H306,H405,W503,I202 -show-source = true -builtins = _ -exclude = .venv,.git,.tox,dist,doc,*lib/python*,*egg,build -import-order-style = pep8 -# [H106]: Don't put vim configuration in source files -# [H203]: Use assertIs(Not)None to check for None -# [H204]: Use assert(Not)Equal to check for equality -# [H205]: Use assert(Greater|Less)(Equal) for comparison -# [H904]: Delay string interpolations at logging calls -enable-extensions = H106,H203,H204,H205,H904 \ No newline at end of file diff --git a/setup.py b/setup.py deleted file mode 100644 index 2ffd7a0..0000000 --- a/setup.py +++ /dev/null @@ -1,3 +0,0 @@ -import setuptools - -setuptools.setup(setup_requires=["pbr>=2.0.0"], pbr=True) diff --git a/sieve_cache/version.py b/sieve_cache/version.py index 55f5b2f..83bcd76 100644 --- a/sieve_cache/version.py +++ b/sieve_cache/version.py @@ -10,7 +10,21 @@ # License for the specific language governing permissions and limitations # under the License. -import pbr.version +from importlib import metadata -version_info = pbr.version.VersionInfo("seive_cache") + +class _VersionInfo: + def __init__(self, package_name): + self.package_name = package_name + + def version_string(self): + for package_name in (self.package_name, "sieve_cache"): + try: + return metadata.version(package_name) + except metadata.PackageNotFoundError: + continue + return "0.0.0" + + +version_info = _VersionInfo("seive_cache") version_string = version_info.version_string diff --git a/tox.ini b/tox.ini index df22079..cbdc617 100644 --- a/tox.ini +++ b/tox.ini @@ -52,3 +52,22 @@ commands = coverage html -d cover coverage xml -o cover/coverage.xml coverage report --fail-under=70 --skip-covered + +[flake8] +# [H104]: Empty file with only comments +# [W504]: Line break after binary operator +# [W503]: Line break before binary operator +# [H306]: Alphabetically order your imports by the full module path +# [H405]: Multi line docstring summary not separated with an empty line +# [I202]: Additional newline in a group of imports. +ignore = H104,W504,H306,H405,W503,I202 +show-source = true +builtins = _ +exclude = .venv,.git,.tox,dist,doc,*lib/python*,*egg,build +import-order-style = pep8 +# [H106]: Don't put vim configuration in source files +# [H203]: Use assertIs(Not)None to check for None +# [H204]: Use assert(Not)Equal to check for equality +# [H205]: Use assert(Greater|Less)(Equal) for comparison +# [H904]: Delay string interpolations at logging calls +enable-extensions = H106,H203,H204,H205,H904