From c0b21d6682d14a63a7d6b240e786a3fe5bab1e6b Mon Sep 17 00:00:00 2001 From: Alex Mykyta Date: Sat, 28 Oct 2023 19:10:19 -0700 Subject: [PATCH] Migrate to pyproject.yaml. Expand antlr runtime compatibility check. --- .github/workflows/build.yml | 59 +++++++++++++++++++++++++++++++++++++ pyproject.toml | 46 +++++++++++++++++++++++++++++ setup.py | 51 -------------------------------- 3 files changed, 105 insertions(+), 51 deletions(-) create mode 100644 .github/workflows/build.yml create mode 100644 pyproject.toml delete mode 100644 setup.py diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..f967017 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,59 @@ +name: build + +on: + push: + branches: + - main + - 'dev/**' + pull_request: + branches: [ main ] + release: + types: + - published + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +jobs: + build: + name: Build distributions + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - uses: actions/setup-python@v4 + name: Install Python + with: + python-version: "3.10" + + - name: Install dependencies + run: | + python -m pip install -U build + + - name: Build + run: python -m build + + - uses: actions/upload-artifact@v3 + with: + path: | + dist/*.tar.gz + dist/*.whl + +#------------------------------------------------------------------------------- + publish: + needs: + - build + + runs-on: ubuntu-latest + environment: release + permissions: + id-token: write + + # Only publish when a GitHub Release is created. + if: github.event_name == 'release' + steps: + - uses: actions/download-artifact@v3 + with: + name: artifact + path: dist + - uses: pypa/gh-action-pypi-publish@release/v1 diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..397e245 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,46 @@ +[build-system] +requires = ["setuptools", "setuptools-scm"] +build-backend = "setuptools.build_meta" + +[project] +name = "speedy-antlr-tool" +dynamic = ["version"] +requires-python = ">=3.6" +dependencies = [ + "antlr4-python3-runtime >= 4.10, < 4.14", + "jinja2", +] + +authors = [ + {name="Alex Mykyta"}, +] +description = "Generate an accelerator extension that makes your Antlr parser in Python super-fast!" +readme = "README.md" +license = {file = "LICENSE"} +classifiers = [ + "Development Status :: 5 - Production/Stable", + "Programming Language :: Python", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.6", + "Programming Language :: Python :: 3.7", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3 :: Only", + "Intended Audience :: Developers", + "License :: OSI Approved :: GNU General Public License v3 (GPLv3)", + "Operating System :: OS Independent", + "Topic :: Software Development :: Compilers", + "Topic :: Software Development :: Code Generators", +] + +[project.urls] +Source = "https://github.com/amykyta3/speedy-antlr-tool" +Tracker = "https://github.com/amykyta3/speedy-antlr-tool/issues" +Changelog = "https://github.com/amykyta3/speedy-antlr-tool/releases" +Documentation = "http://speedy-antlr-tool.readthedocs.io" + +[tool.setuptools.dynamic] +version = {attr = "speedy_antlr_tool.__about__.__version__"} diff --git a/setup.py b/setup.py deleted file mode 100644 index abef00a..0000000 --- a/setup.py +++ /dev/null @@ -1,51 +0,0 @@ -import os -import setuptools - -with open("README.md", "r") as fh: - long_description = fh.read() - - -with open(os.path.join("speedy_antlr_tool", "__about__.py")) as f: - v_dict = {} - exec(f.read(), v_dict) - version = v_dict['__version__'] - - -setuptools.setup( - name="speedy-antlr-tool", - version=version, - author="Alex Mykyta", - author_email="amykyta3@github.com", - description="Generate an accelerator extension that makes your Antlr parser in Python super-fast!", - long_description=long_description, - long_description_content_type="text/markdown", - url="https://github.com/amykyta3/speedy-antlr-tool", - packages=setuptools.find_packages(exclude=["test"]), - include_package_data=True, - python_requires='>=3.6', - install_requires=[ - "antlr4-python3-runtime >= 4.10, < 4.12", - "jinja2", - ], - classifiers=( - "Development Status :: 5 - Production/Stable", - "Programming Language :: Python", - "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.6", - "Programming Language :: Python :: 3.7", - "Programming Language :: Python :: 3.8", - "Programming Language :: Python :: 3.9", - "Programming Language :: Python :: 3.10", - "Programming Language :: Python :: 3 :: Only", - "Intended Audience :: Developers", - "License :: OSI Approved :: GNU General Public License v3 (GPLv3)", - "Operating System :: OS Independent", - "Topic :: Software Development :: Compilers", - "Topic :: Software Development :: Code Generators", - ), - project_urls={ - "Documentation": "http://speedy-antlr-tool.readthedocs.io", - "Source": "https://github.com/amykyta3/speedy-antlr-tool", - "Tracker": "https://github.com/amykyta3/speedy-antlr-tool/issues", - }, -)