From 092431664c21afd97172172f235d5ccaba33978d Mon Sep 17 00:00:00 2001 From: Matthias Mair Date: Mon, 31 Mar 2025 23:34:24 +0200 Subject: [PATCH 1/7] update packaging settings to pyproject.toml --- pyproject.toml | 37 +++++++++++++++++++++++++++++++++++++ setup.py | 39 --------------------------------------- 2 files changed, 37 insertions(+), 39 deletions(-) create mode 100644 pyproject.toml delete mode 100644 setup.py diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..106cee5 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,37 @@ +[build-system] +requires = ["setuptools >= 77.0.3"] +build-backend = "setuptools.build_meta" + +[project] +name = "inventree" +dynamic = ["version"] +description = "Python interface for InvenTree inventory management system" +readme = "README.md" +license = "MIT" +requires-python = ">=3.9" +authors = [ + { name = "Oliver Walters", email = "oliver.henry.walters@gmail.com" }, +] +keywords = [ + "barcode", + "bill", + "bom", + "inventory", + "management", + "materials", + "of", + "stock", +] +dependencies = [ + "pip-system-certs>=4.0", + "requests>=2.27.0", +] + +[project.urls] +Homepage = "https://github.com/inventree/inventree-python/" + +[tool.setuptools.dynamic] +version = {attr = "inventree.base.INVENTREE_PYTHON_VERSION"} + +[tool.setuptools] +packages = ["inventree"] diff --git a/setup.py b/setup.py deleted file mode 100644 index 0524793..0000000 --- a/setup.py +++ /dev/null @@ -1,39 +0,0 @@ -# -*- coding: utf-8 -*- - -import setuptools - -from inventree.base import INVENTREE_PYTHON_VERSION - -with open('README.md', encoding='utf-8') as f: - long_description = f.read() - - -setuptools.setup( - name="inventree", - version=INVENTREE_PYTHON_VERSION, - author="Oliver Walters", - author_email="oliver.henry.walters@gmail.com", - description="Python interface for InvenTree inventory management system", - long_description=long_description, - long_description_content_type='text/markdown', - keywords="bom, bill of materials, stock, inventory, management, barcode", - url="https://github.com/inventree/inventree-python/", - license="MIT", - packages=setuptools.find_packages( - exclude=[ - 'ci', - 'scripts', - 'test', - ] - ), - install_requires=[ - "requests>=2.27.0", - "pip-system-certs>=4.0", - ], - setup_requires=[ - "wheel", - "twine", - "wrapt" - ], - python_requires=">=3.9" -) From 0d51623c9eb77ca4c70a7d60098d3913fbb87b2a Mon Sep 17 00:00:00 2001 From: Matthias Mair Date: Mon, 31 Mar 2025 23:40:01 +0200 Subject: [PATCH 2/7] make flake8 use pyproject --- pyproject.toml | 12 ++++++++++++ requirements.txt | 1 + 2 files changed, 13 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index 106cee5..ee28958 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -35,3 +35,15 @@ version = {attr = "inventree.base.INVENTREE_PYTHON_VERSION"} [tool.setuptools] packages = ["inventree"] + +[tool.flake8] +ignore =[ + 'C901', + # - W293 - blank lines contain whitespace + 'W293', + # - E501 - line too long (82 characters) + 'E501', + 'N802'] +exclude = ['.git','__pycache__','inventree_server','dist','build','test.py'] +max-complexity = 20 + diff --git a/requirements.txt b/requirements.txt index bfc2b0b..1243ca3 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,6 @@ requests[socks]>=2.21.0 # Python HTTP for humans with proxy support flake8==3.8.4 # PEP checking +flake8-pyproject==1.2.3 # PEP 621 support wheel>=0.34.2 # Building package invoke>=1.4.0 coverage>=6.4.1 # Run tests, measure coverage From a28da3c8d75ff8eef18ccc703a80d3641f5aff8f Mon Sep 17 00:00:00 2001 From: Matthias Mair Date: Mon, 31 Mar 2025 23:43:18 +0200 Subject: [PATCH 3/7] update flake8 --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 1243ca3..a8e15e5 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,5 @@ requests[socks]>=2.21.0 # Python HTTP for humans with proxy support -flake8==3.8.4 # PEP checking +flake8==7.2.0 # PEP checking flake8-pyproject==1.2.3 # PEP 621 support wheel>=0.34.2 # Building package invoke>=1.4.0 From 2c25123cf9ce52ccd0c2476c349cd0a12394f625 Mon Sep 17 00:00:00 2001 From: Matthias Mair Date: Mon, 31 Mar 2025 23:45:27 +0200 Subject: [PATCH 4/7] lower 1 release --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index a8e15e5..4f1a39d 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,5 @@ requests[socks]>=2.21.0 # Python HTTP for humans with proxy support -flake8==7.2.0 # PEP checking +flake8==7.1.2 # PEP checking flake8-pyproject==1.2.3 # PEP 621 support wheel>=0.34.2 # Building package invoke>=1.4.0 From 63f2f629af0bebbac10a7e840dc258f0537cecda Mon Sep 17 00:00:00 2001 From: Matthias Mair Date: Mon, 31 Mar 2025 23:50:08 +0200 Subject: [PATCH 5/7] update build command --- .github/workflows/build.yaml | 4 ++-- .github/workflows/pypi.yaml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 0c806f9..20312d7 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -23,5 +23,5 @@ jobs: pip install -U -r requirements.txt - name: Build Python Package run: | - pip install --upgrade pip wheel setuptools - python setup.py bdist_wheel --universal + pip install --upgrade pip wheel setuptools build + python3 -m build diff --git a/.github/workflows/pypi.yaml b/.github/workflows/pypi.yaml index e7473f4..fb78a66 100644 --- a/.github/workflows/pypi.yaml +++ b/.github/workflows/pypi.yaml @@ -25,10 +25,10 @@ jobs: - name: Install Python Dependencies run: | pip install -U -r requirements.txt - pip install --upgrade wheel setuptools twine + pip install --upgrade wheel setuptools twine build - name: Build Binary run: | - python3 setup.py sdist bdist_wheel --universal + python3 -m build - name: Publish run: | python3 -m twine upload dist/* From bd1274e9a9a554fad7a8df5be104e18b66a05bc9 Mon Sep 17 00:00:00 2001 From: Matthias Mair Date: Mon, 31 Mar 2025 23:52:59 +0200 Subject: [PATCH 6/7] update setuptools --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 7d90c67..7dc2563 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,5 +1,5 @@ [build-system] -requires = ["setuptools >= 77.0.3"] +requires = ["setuptools >= 75.3.2"] build-backend = "setuptools.build_meta" [project] From e66fab2ca744e61501e02412efb1667e99aa5efd Mon Sep 17 00:00:00 2001 From: Matthias Mair Date: Mon, 31 Mar 2025 23:56:29 +0200 Subject: [PATCH 7/7] update syntax for license --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 7dc2563..fc346c4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -7,7 +7,7 @@ name = "inventree" dynamic = ["version"] description = "Python interface for InvenTree inventory management system" readme = "README.md" -license = "MIT" +license = { file = "LICENSE" } requires-python = ">=3.9" authors = [ { name = "Oliver Walters", email = "oliver.henry.walters@gmail.com" },