From fa6439f8439681bf50da12fc2954667a49cad8dc Mon Sep 17 00:00:00 2001 From: ZipFile Date: Sun, 11 Aug 2024 13:56:13 +0000 Subject: [PATCH] Modernise build proccess --- .github/workflows/publish.yml | 8 ++--- pyproject.toml | 55 +++++++++++++++++++++++++++++++++++ pytest.ini | 2 -- setup.py | 43 --------------------------- 4 files changed, 59 insertions(+), 49 deletions(-) create mode 100644 pyproject.toml delete mode 100644 pytest.ini delete mode 100644 setup.py diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 8579372..8c32f56 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -9,19 +9,19 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Set up Python - uses: actions/setup-python@v2 + uses: actions/setup-python@v5 with: python-version: '3.x' - name: Install dependencies run: | python -m pip install --upgrade pip - pip install setuptools wheel twine + pip install build twine - name: Build and publish env: TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} run: | - python setup.py sdist bdist_wheel bdist_egg + python -m build twine upload dist/* diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..43840d0 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,55 @@ +[build-system] +requires = ["setuptools"] +build-backend = "setuptools.build_meta" + +[project] +name = "sonyflake-py" +authors = [ + {name = "hjpotter92", email = "hjpotter92@pypi.hjpotter92.email"}, +] +description = "A distributed unique ID generator inspired by Twitter's Snowflake." +readme = {file = "README.md", content-type = "text/markdown"} +license = {file = "LICENSE"} +requires-python = ">=3.6" +keywords = ["id-generator", "snowflake", "sonyflake", "unique-id"] +classifiers = [ + "Development Status :: 5 - Production/Stable", + "Intended Audience :: Developers", + "License :: OSI Approved :: MIT License", + "Operating System :: OS Independent", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3 :: Only", + "Programming Language :: Python :: Implementation", + "Topic :: Software Development :: Libraries :: Python Modules", + "Topic :: System :: Distributed Computing", +] +dynamic = ["version"] + +[project.urls] +Homepage = "https://github.com/hjpotter92/sonyflake-py" +Documentation = "https://sonyflake-py.rtfd.io/" +Changelog = "https://sonyflake-py.rtfd.io/changelog" +"Code coverage" = "https://app.codecov.io/gh/hjpotter92/sonyflake-py" +"Builds history" = "https://travis-ci.com/hjpotter92/sonyflake-py" + +[tool.setuptools.dynamic] +version = {attr = "sonyflake.about.VERSION"} + +[tool.pytest.ini_options] +minversion = "6.2" +addopts = ["-vv"] +testpaths = ["tests"] + +[tool.coverage.run] +branch = true +relative_files = true +source_pkgs = ["sonyflake"] + +[tool.coverage.report] +show_missing = true + +[tool.isort] +profile = "black" + +[tool.pylint.format] +max-line-length = "88" diff --git a/pytest.ini b/pytest.ini deleted file mode 100644 index 7dab082..0000000 --- a/pytest.ini +++ /dev/null @@ -1,2 +0,0 @@ -[pytest] -python_files = tests/*.py diff --git a/setup.py b/setup.py deleted file mode 100644 index 32e87f8..0000000 --- a/setup.py +++ /dev/null @@ -1,43 +0,0 @@ -from pathlib import Path - -from setuptools import find_packages, setup - -import sonyflake.about as about - -if __name__ == "__main__": - setup( - name=about.NAME, - version=about.VERSION, - author=about.AUTHOR.get("name"), - author_email=about.AUTHOR.get("email"), - description="A distributed unique ID generator inspired by Twitter's Snowflake.", - long_description=Path("README.md").read_text(), - long_description_content_type="text/markdown", - url="https://github.com/hjpotter92/sonyflake-py", - packages=find_packages(), - package_data={"sonyflake": ["py.typed"]}, - include_package_data=True, - classifiers=[ - "Development Status :: 5 - Production/Stable", - "Intended Audience :: Developers", - "License :: OSI Approved :: MIT License", - "Operating System :: OS Independent", - "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3 :: Only", - "Programming Language :: Python :: Implementation", - "Topic :: Software Development :: Libraries :: Python Modules", - "Topic :: System :: Distributed Computing", - ], - python_requires=">=3.6", - project_urls={ - "Documentation": "https://sonyflake-py.rtfd.io/", - "Code coverage": "https://app.codecov.io/gh/hjpotter92/sonyflake-py", - "Builds history": "https://travis-ci.com/hjpotter92/sonyflake-py", - "Changelog": "https://sonyflake-py.rtfd.io/changelog", - }, - tests_require=( - "codecov>=2.1.11", - "coverage>=5.4", - "pytest>=6.2.2", - ), - )