From dcebda7a6d046410db14ed9dd31c072b887b3af1 Mon Sep 17 00:00:00 2001 From: LegrandNico Date: Mon, 14 Oct 2024 13:48:00 +0200 Subject: [PATCH] versioning --- .github/workflows/docs.yml | 2 +- .github/workflows/pypi.yml | 2 +- pyproject.toml | 2 +- setup.py | 61 -------------------------------------- 4 files changed, 3 insertions(+), 64 deletions(-) delete mode 100644 setup.py diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index a7a9a310b..76a2e078a 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -24,7 +24,7 @@ jobs: - name: Build run: | sudo apt-get install graphviz - pip install poetry + pip install poetry poetry-dynamic-versioning poetry install --with dev sphinx-build -j 4 -T -b html docs/source docs/build/html diff --git a/.github/workflows/pypi.yml b/.github/workflows/pypi.yml index 4d9a45d8b..f66a5908f 100644 --- a/.github/workflows/pypi.yml +++ b/.github/workflows/pypi.yml @@ -16,7 +16,7 @@ jobs: - name: Install poetry run: >- - python -m pip install poetry --user + python -m pip install poetry poetry-dynamic-versioning --user - name: Build a binary wheel and a source tarball run: >- python -m poetry build diff --git a/pyproject.toml b/pyproject.toml index 68ae315b2..994a2a477 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -18,7 +18,7 @@ include = [ # Enable dynamic versioning enable = true # Set the source of the version to __init__.py -source = "src/pyhgf/__init__.py" +source = ".src/pyhgf/__init__.py" [tool.poetry.dependencies] python = ">=3.10,<3.13" diff --git a/setup.py b/setup.py deleted file mode 100644 index 80077cb2c..000000000 --- a/setup.py +++ /dev/null @@ -1,61 +0,0 @@ -import codecs -import os - -from setuptools import setup, find_packages - -PROJECT_ROOT = os.path.dirname(os.path.realpath(__file__)) -REQUIREMENTS_FILE = os.path.join(PROJECT_ROOT, "requirements.txt") - -def get_requirements(): - with codecs.open(REQUIREMENTS_FILE) as buff: - return buff.read().splitlines() - -# Get the package's version number of the __init__.py file -def read(rel_path): - """Read the file located at the provided relative path.""" - here = os.path.abspath(os.path.dirname(__file__)) - with codecs.open(os.path.join(here, rel_path), "r") as fp: - return fp.read() - - -def get_version(rel_path): - """Get the package's version number. - We fetch the version number from the `__version__` variable located in the - package root's `__init__.py` file. This way there is only a single source - of truth for the package's version number. - - """ - for line in read(rel_path).splitlines(): - if line.startswith("__version__"): - delim = '"' if '"' in line else "'" - return line.split(delim)[1] - else: - raise RuntimeError("Unable to find version string.") - - -DESCRIPTION = "The generalized, nodalized HGF for predictive coding." -DISTNAME = "pyhgf" -AUTHOR = "ILAB" -MAINTAINER = "Nicolas Legrand" -MAINTAINER_EMAIL = "nicolas.legrand@cas.au.dk" - - -if __name__ == "__main__": - - setup( - name=DISTNAME, - author=AUTHOR, - author_email=MAINTAINER_EMAIL, - maintainer=MAINTAINER, - maintainer_email=MAINTAINER_EMAIL, - description=DESCRIPTION, - long_description=open("README.md", encoding='utf-8').read(), - long_description_content_type="text/markdown", - license="GPL-3.0", - version=get_version("src/pyhgf/__init__.py"), - install_requires=get_requirements(), - include_package_data=True, - package_dir = {"": "src"}, - package_data={"": ["pyhgf/src/pyhgf/data/*.txt"]}, - packages=find_packages(where='src'), - )