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/* diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..fc346c4 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,50 @@ +[build-system] +requires = ["setuptools >= 75.3.2"] +build-backend = "setuptools.build_meta" + +[project] +name = "inventree" +dynamic = ["version"] +description = "Python interface for InvenTree inventory management system" +readme = "README.md" +license = { file = "LICENSE" } +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", + "urllib3>=2.3.0", +] + +[project.urls] +Homepage = "https://github.com/inventree/inventree-python/" + +[tool.setuptools.dynamic] +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..4f1a39d 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==7.1.2 # 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 diff --git a/setup.py b/setup.py deleted file mode 100644 index 0bc16d5..0000000 --- a/setup.py +++ /dev/null @@ -1,40 +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", - "urllib3>=2.3.0" - ], - setup_requires=[ - "wheel", - "twine", - "wrapt" - ], - python_requires=">=3.9" -)