diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml deleted file mode 100644 index a4903f5..0000000 --- a/.github/workflows/publish.yaml +++ /dev/null @@ -1,51 +0,0 @@ -name: Publish - -on: - # Only on merges into main - push: - tags: v[0-9]+.[0-9]+.[0-9]+ - - -jobs: - build: - name: Build distribution - runs-on: ubuntu-latest - - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - name: Setup Python - uses: actions/setup-python@v4 - with: - python-version: '3.9' - - name: Install pypa/build - run: python3 -m pip install build --user - - name: Build a binary wheel and a source tarball - run: python3 -m build - - name: Store the distribution packages - uses: actions/upload-artifact@v3 - with: - name: python-package-distributions - path: dist/ - - # TODO: Add logic to do github release too here - - publish: - name: Publish to PyPI - runs-on: ubuntu-latest - needs: - - build - environment: - name: pypi - url: https://pypi.org/project/pyscript - permissions: - id-token: write - - steps: - - name: Download all the dists - uses: actions/download-artifact@v3 - with: - name: python-package-distributions - path: dist/ - - name: Publish release to PyPI - uses: pypa/gh-action-pypi-publish@release/v1 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..63344e8 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,36 @@ +name: Release to PyPI + +on: + push: + tags: + - '*' + +jobs: + release: + runs-on: ubuntu-latest + environment: + name: pypi + url: https://pypi.org/project/pyscript + permissions: + id-token: write + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: 3.11 + + - name: Install build tools + run: | + pip install --upgrade build + + - name: Build and package + env: + CHECK_VERSION: 'true' + run: | + python -m build + + - name: Upload to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 diff --git a/MANIFEST.in b/MANIFEST.in new file mode 100644 index 0000000..156b382 --- /dev/null +++ b/MANIFEST.in @@ -0,0 +1 @@ +include src/pyscript/version diff --git a/pyproject.toml b/pyproject.toml deleted file mode 100644 index dc4db25..0000000 --- a/pyproject.toml +++ /dev/null @@ -1,65 +0,0 @@ -[build-system] -build-backend = "setuptools.build_meta" -requires = ["setuptools", "setuptools-scm"] - -[project] -authors = [ - {name = "Matt Kramer", email = "mkramer@anaconda.com"}, - {name = "Fabio Pliger", email = "fpliger@anaconda.com"}, - {name = "Nicholas Tollervey", email = "ntollervey@anaconda.com"}, - {name = "Fabio Rosado", email = "frosado@anaconda.com"} -] -classifiers = [ - "Development Status :: 4 - Beta", - "Environment :: Console", - "Intended Audience :: Developers", - "License :: OSI Approved :: Apache Software License", - "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", - "Programming Language :: Python :: 3.10", - "Topic :: Software Development :: Code Generators", - "Topic :: Software Development :: Libraries :: Python Modules", - "Topic :: Software Development :: Pre-processors" -] -dependencies = [ - 'importlib-metadata; python_version<"3.8"', - "Jinja2<3.2", - "pluggy<1.3", - "rich<=13.7.1", - "toml<0.11", - "typer<=0.9.0", - "platformdirs<4.3", - "requests<=2.31.0" -] -description = "Command Line Interface for PyScript" -keywords = ["pyscript", "cli", "pyodide", "micropython", "pyscript-cli"] -license = {text = "Apache-2.0"} -name = "pyscript" -readme = "README.md" -requires-python = ">=3.9" -version = "0.3.0" - -[project.optional-dependencies] -dev = [ - "coverage<7.3", - "mypy<=1.4.1", - "pytest<7.5", - "types-toml<0.11", - "types-requests" -] -docs = [ - "Sphinx<5.2", - "sphinx-autobuild<2021.4.0", - "sphinx-autodoc-typehints<1.20", - "myst-parser<0.19.3", - "pydata-sphinx-theme<0.13.4" -] - -[project.scripts] -pyscript = "pyscript.cli:app" - -[project.urls] -Documentation = "https://docs.pyscript.net" -Examples = "https://pyscript.com/@examples" -Homepage = "https://pyscript.net" -Repository = "https://github.com/pyscript/pyscript-cli" diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..756c2b4 --- /dev/null +++ b/setup.py @@ -0,0 +1,98 @@ +import os + +from setuptools import find_packages, setup + + +def read_version(): + with open("src/pyscript/version") as f: + return f.read().strip("\n") + + +def check_tag_version(): + if os.getenv("CHECK_VERSION", "false").lower() == "true": + tag = os.getenv("GITHUB_REF") + expected_version = read_version() + if tag != f"refs/tags/{expected_version}": + raise Exception( + f"Tag '{tag}' does not match the expected " + f"version '{expected_version}'" + ) + + +with open("README.md") as fh: + long_description = fh.read() + +check_tag_version() + +setup( + name="pyscript", + version=read_version(), + description="Command Line Interface for PyScript", + package_dir={"": "src"}, + packages=find_packages(where="src"), + package_data={"pyscript": ["templates/*.html"]}, + long_description=long_description, + long_description_content_type="text/markdown", + url="https://github.com/pyscript/pyscript-cli", + author="Matt Kramer, Fabio Pliger, Nicholas Tollervey, Fabio Rosado, Madhur Tandon", + author_email=( + "mkramer@anaconda.com, " + "fpliger@anaconda.com, " + "ntollervey@anaconda.com, " + "frosado@anaconda.com, " + "mtandon@anaconda.com" + ), + license="Apache-2.0", + install_requires=[ + 'importlib-metadata; python_version<"3.8"', + "Jinja2<3.2", + "pluggy<1.3", + "rich<=13.7.1", + "toml<0.11", + "typer<=0.9.0", + "platformdirs<4.3", + "requests<=2.31.0", + ], + python_requires=">=3.9", + keywords=["pyscript", "cli", "pyodide", "micropython", "pyscript-cli"], + classifiers=[ + "Development Status :: 4 - Beta", + "Environment :: Console", + "Intended Audience :: Developers", + "License :: OSI Approved :: Apache Software License", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Topic :: Software Development :: Code Generators", + "Topic :: Software Development :: Libraries :: Python Modules", + "Topic :: Software Development :: Pre-processors", + ], + extras_require={ + "dev": [ + "coverage<7.3", + "mypy<=1.4.1", + "pytest<7.5", + "types-toml<0.11", + "types-requests", + ], + "docs": [ + "Sphinx<5.2", + "sphinx-autobuild<2021.4.0", + "sphinx-autodoc-typehints<1.20", + "myst-parser<0.19.3", + "pydata-sphinx-theme<0.13.4", + ], + }, + entry_points={ + "console_scripts": [ + "pyscript = pyscript.cli:app", + ], + }, + project_urls={ + "Documentation": "https://docs.pyscript.net", + "Examples": "https://pyscript.com/@examples", + "Homepage": "https://pyscript.net", + "Repository": "https://github.com/pyscript/pyscript-cli", + }, + zip_safe=False, +) diff --git a/src/pyscript/version b/src/pyscript/version new file mode 100644 index 0000000..0d91a54 --- /dev/null +++ b/src/pyscript/version @@ -0,0 +1 @@ +0.3.0 diff --git a/tests/test_generator.py b/tests/test_generator.py index c9c8c4a..eca8e1d 100644 --- a/tests/test_generator.py +++ b/tests/test_generator.py @@ -238,7 +238,7 @@ def check_plugin_project_files( f"""
{ plugin_description }
-