From 88854ac77d858d7500c9892218ee0ea8644c093f Mon Sep 17 00:00:00 2001 From: ThibaultFy <50656860+ThibaultFy@users.noreply.github.com> Date: Mon, 25 Mar 2024 17:17:00 +0100 Subject: [PATCH] chore: from setup to pyproject (#407) Signed-off-by: ThibaultFy --- .github/workflows/publish.yml | 2 +- changes/407.changed | 1 + pyproject.toml | 59 ++++++++++++++++++++++++++++++ setup.cfg | 5 --- setup.py | 67 ----------------------------------- 5 files changed, 61 insertions(+), 73 deletions(-) create mode 100644 changes/407.changed delete mode 100644 setup.cfg delete mode 100644 setup.py diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 72852edf..06455da7 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -16,7 +16,7 @@ jobs: run: pip install wheel - name: Build run: - python setup.py sdist bdist_wheel + python -m build - name: Publish uses: pypa/gh-action-pypi-publish@v1.5.1 with: diff --git a/changes/407.changed b/changes/407.changed new file mode 100644 index 00000000..60eaab4c --- /dev/null +++ b/changes/407.changed @@ -0,0 +1 @@ +- Depreciate `setup.py` in favour of `pyproject.toml` ([#407](https://github.com/Substra/substra/pull/407)) \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index 233c7be5..acc39e08 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,3 +1,62 @@ +[build-system] +requires = ["hatchling"] +build-backend = "hatchling.build" + +[tool.hatch.build.targets.sdist] +exclude = ["tests*"] + +[tool.hatch.version] +path = "substra/__version__.py" + +[project] +name = "substra" +description = "Low-level Python library for interacting with a Substra network" +dynamic = ["version"] +requires-python = ">= 3.9" +dependencies = [ + "requests", + "urllib3<2", + "docker", + "pyyaml", + "pydantic>=2.3.0,<3.0.0", + "tqdm", + "python-slugify", +] +keywords = ["substra"] +classifiers = [ + "Intended Audience :: Developers", + "Topic :: Utilities", + "Natural Language :: English", + "Operating System :: OS Independent", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", +] +license = { file = "LICENSE" } +authors = [{ name = "Owkin, Inc." }] + + +[project.optional-dependencies] +dev = [ + "pandas", + "pytest", + "pytest-cov", + "pytest-mock", + "substratools>=0.21.2", + "black", + "flake8", + "isort", + "docstring_parser", + "towncrier", +] + +[project.urls] +Documentation = "https://docs.substra.org/en/stable/" +Repository = "https://github.com/Substra/substra" +Changelog = "https://github.com/Substra/substra/blob/main/CHANGELOG.md" + +[tool.pytest.ini_options] +addopts = "-v --cov=substra --ignore=tests/unit --ignore=tests/e2e" [tool.black] line-length = 120 diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index d442ff91..00000000 --- a/setup.cfg +++ /dev/null @@ -1,5 +0,0 @@ -[aliases] -test=pytest - -[tool:pytest] -addopts = -v --cov=substra --ignore=tests/unit --ignore=tests/e2e diff --git a/setup.py b/setup.py deleted file mode 100644 index 42a7e1be..00000000 --- a/setup.py +++ /dev/null @@ -1,67 +0,0 @@ -"""Packaging settings.""" - -import os -from codecs import open - -from setuptools import find_packages -from setuptools import setup - -here = os.path.abspath(os.path.dirname(__file__)) - - -with open(os.path.join(here, "README.md"), "r", "utf-8") as fp: - readme = fp.read() - - -about = {} -with open(os.path.join(here, "substra", "__version__.py"), "r", "utf-8") as fp: - exec(fp.read(), about) - - -setup( - name="substra", - version=about["__version__"], - description="Low-level Python library for interacting with a Substra network", - long_description=readme, - long_description_content_type="text/markdown", - url="https://docs.substra.org", - author="Owkin, Inc.", - license="Apache 2.0", - classifiers=[ - "Intended Audience :: Developers", - "Topic :: Utilities", - "Natural Language :: English", - "Operating System :: OS Independent", - "Programming Language :: Python :: 3.9", - "Programming Language :: Python :: 3.10", - "Programming Language :: Python :: 3.11", - ], - keywords=["cli", "substra"], - packages=find_packages(exclude=["tests*"]), - include_package_data=True, - install_requires=[ - "requests", - "urllib3<2", - "docker", - "pyyaml", - "pydantic>=2.3.0,<3.0.0", - "tqdm", - "python-slugify", - ], - python_requires=">=3.9", - extras_require={ - "dev": [ - "pandas", - "pytest", - "pytest-cov", - "pytest-mock", - "substratools>=0.21.2", - "black", - "flake8", - "isort", - "docstring_parser", - "towncrier", - ], - }, - zip_safe=False, -)