From 0912d4f472dd2062c099b5ddcdb91eb0110fde4b Mon Sep 17 00:00:00 2001 From: GPla <36087062+GPla@users.noreply.github.com> Date: Sun, 28 Jul 2024 11:39:08 +0200 Subject: [PATCH 1/3] migrate to pyproject.toml --- .github/workflows/python-package.yml | 4 +- MANIFEST.in | 5 --- REQUIREMENTS-TEST.txt | 4 -- REQUIREMENTS.txt | 1 - pyproject.toml | 43 ++++++++++++++++++++ setup.py | 60 ---------------------------- 6 files changed, 44 insertions(+), 73 deletions(-) delete mode 100644 MANIFEST.in delete mode 100644 REQUIREMENTS-TEST.txt delete mode 100644 REQUIREMENTS.txt create mode 100644 pyproject.toml delete mode 100644 setup.py diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index 74f9eb6..ef9bad0 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -27,9 +27,7 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install -r REQUIREMENTS.txt - pip install shtab - pip install -r REQUIREMENTS-TEST.txt + pip install .[test,shtab] - name: Test with pytest run: | pytest --cov diff --git a/MANIFEST.in b/MANIFEST.in deleted file mode 100644 index 878d966..0000000 --- a/MANIFEST.in +++ /dev/null @@ -1,5 +0,0 @@ -include LICENSE -include CHANGELOG.md -include README.md -include REQUIREMENTS.txt -include REQUIREMENTS-TEST.txt diff --git a/REQUIREMENTS-TEST.txt b/REQUIREMENTS-TEST.txt deleted file mode 100644 index 1ad0ae9..0000000 --- a/REQUIREMENTS-TEST.txt +++ /dev/null @@ -1,4 +0,0 @@ -pytest >= 8.2.2 -pytest-cov >=4.0.0 -mypy >= 1.10.1 -black >= 24.4.2 \ No newline at end of file diff --git a/REQUIREMENTS.txt b/REQUIREMENTS.txt deleted file mode 100644 index 4d2bf1b..0000000 --- a/REQUIREMENTS.txt +++ /dev/null @@ -1 +0,0 @@ -pydantic >= 2.8.2 diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..7a278c9 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,43 @@ +[project] +name = "pydantic_cli" +description = "Turn Pydantic defined Data Models into CLI Tools" +authors = [{ name = "M. Kocher", email = "michael.kocher@me.com" }] +dependencies = ["pydantic>=2.8.2"] +readme = "README.md" +requires-python = ">= 3.10" +dynamic = ['version'] +urls = { 'Source Code' = 'http://github.com/mpkocher/pydantic-cli' } +license = { file = "LICENSE" } +classifiers = [ + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.7", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "License :: OSI Approved :: MIT License", + "Operating System :: OS Independent", + "Topic :: Utilities", + "Topic :: Software Development", + "Typing :: Typed", +] + +[project.optional-dependencies] +test = ["pytest>=8.2.2", "pytest-cov>=4.0.0", "mypy>=1.10.1", "black>=24.4.2"] +dev = ["pre-commit>=3.7.0", "mypy>=1.10.1", "black>=24.4.2"] +shtab = ["shtab>=1.3.1"] + +[build-system] +requires = ["hatchling"] +build-backend = "hatchling.build" + +[tool.hatch.metadata] +allow-direct-references = true + +[tool.hatch.build.targets.wheel] +packages = ['pydantic_cli', 'pydantic_cli.examples'] + +[tool.hatch.version] +path = "pydantic_cli/_version.py" + +[tool.hatch.build] +include = ['CHANGELOG.md'] diff --git a/setup.py b/setup.py deleted file mode 100644 index e9374b5..0000000 --- a/setup.py +++ /dev/null @@ -1,60 +0,0 @@ -import os -from setuptools import setup - - -def _get_local_file(file_name): - return os.path.join(os.path.dirname(__file__), file_name) - - -def _read(file_name): - with open(_get_local_file(file_name)) as f: - return f.read() - - -def _get_requirements(file_name): - with open(file_name, 'r') as f: - reqs = [line for line in f if not line.startswith("#")] - return reqs - - -def get_version(): - p = _get_local_file(os.path.join("pydantic_cli", "_version.py")) - matcher = "__version__" - - with open(p) as f: - for line in f: - if matcher in line: - version = line.split("=")[1].strip().replace('"', '') - return version - - raise ValueError(f"Unable to find version {matcher} in file={p}") - - -setup(name='pydantic_cli', - version=get_version(), - description='Turn Pydantic defined Data Models into CLI Tools', - long_description=_read('README.md'), - long_description_content_type="text/markdown", - url='http://github.com/mpkocher/pydantic-cli', - author='M. Kocher', - author_email='michael.kocher@me.com', - license='MIT', - python_requires=">=3.10", - install_requires=_get_requirements("REQUIREMENTS.txt"), - packages=['pydantic_cli', 'pydantic_cli.examples'], - package_data={"pydantic_cli": ["py.typed"]}, - extras_require={"test": _get_requirements("REQUIREMENTS-TEST.txt"), - "shtab": "shtab>=1.3.1"}, - zip_safe=False, - classifiers=[ - "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.10", - "Programming Language :: Python :: 3.11", - "Programming Language :: Python :: 3.12", - "License :: OSI Approved :: MIT License", - "Operating System :: OS Independent", - "Topic :: Utilities", - "Topic :: Software Development", - "Typing :: Typed", - ] - ) From 0992ae430e52f25062e40e5b5327e4462722f2ff Mon Sep 17 00:00:00 2001 From: GPla <36087062+GPla@users.noreply.github.com> Date: Sun, 28 Jul 2024 11:43:28 +0200 Subject: [PATCH 2/3] remove dev dependency --- pyproject.toml | 1 - 1 file changed, 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 7a278c9..ee77abe 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -23,7 +23,6 @@ classifiers = [ [project.optional-dependencies] test = ["pytest>=8.2.2", "pytest-cov>=4.0.0", "mypy>=1.10.1", "black>=24.4.2"] -dev = ["pre-commit>=3.7.0", "mypy>=1.10.1", "black>=24.4.2"] shtab = ["shtab>=1.3.1"] [build-system] From 1282f4a6d7af9c0ec62594c53d4cc73c19526559 Mon Sep 17 00:00:00 2001 From: GPla <36087062+GPla@users.noreply.github.com> Date: Sun, 28 Jul 2024 11:45:55 +0200 Subject: [PATCH 3/3] removed python classifier --- pyproject.toml | 1 - 1 file changed, 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index ee77abe..509ba03 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -10,7 +10,6 @@ urls = { 'Source Code' = 'http://github.com/mpkocher/pydantic-cli' } license = { file = "LICENSE" } classifiers = [ "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12",