diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..3508974 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,27 @@ +name: release + +on: + release: + types: [published] + workflow_dispatch: + +jobs: + release: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v7 + - uses: extractions/setup-just@v3 + - uses: actions/setup-python@v7 + with: + python-version: '3.14' + - name: Build package + run: just install build + - name: Publish to PyPi + uses: pypa/gh-action-pypi-publish@release/v1 + with: + password: ${{ secrets.PYPI_API_TOKEN }} + - name: Upload assets to release + uses: AButler/upload-release-assets@v3.0.1 + with: + files: 'dist/*' + repo-token: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/.gitignore b/.gitignore index 24396df..647c58c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ *.egg-info .cache/ venv/ +.venv/ .tox test-*.xml .coverage diff --git a/README.md b/README.md index 1bc94ae..0e66687 100644 --- a/README.md +++ b/README.md @@ -135,10 +135,8 @@ Pretty straightforward. Develop in branches, send PRs, land on master. All tests ### Releasing a new version 1. Land all requisite changes - 1. Bump the version in `setup.py` and `pystalk/__init__.py` to the stable version (e.g., `0.2`) + 1. Bump the version in `setup.py` and `pystalk/__init__.py` to the stable version (e.g., `0.9.0`) 1. Update [`CHANGES.rst`](docs/source/CHANGES.rst) with the changes and the new version number - 1. Update [`conf.py`](docs/source/conf.py) with the new version number - 1. Commit - 1. Tag the version (e.g., `git tag -s pystalk-0.2`) - 1. Push up to Github - 1. Upload to PyPI with `python setup.py sdist upload` + 1. Commit and push up to Github + 1. Draft a [new GitHub Release](https://github.com/EasyPost/pystalk/releases/new), targeting a new tag matching the version (e.g., `0.9.0`) + 1. Publishing the release triggers the `release` GitHub Actions workflow, which builds the sdist/wheel and publishes them to PyPI automatically diff --git a/justfile b/justfile new file mode 100644 index 0000000..528553e --- /dev/null +++ b/justfile @@ -0,0 +1,9 @@ +# Install the project and build its dependencies. +install: + python -m pip install --upgrade pip + python -m pip install -e . -r requirements-tests.txt + +# build sdist and wheel into dist/ +build: + python -m pip install build + python -m build diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..b05bebe --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,39 @@ +[build-system] +requires = ["setuptools>=61", "wheel"] +build-backend = "setuptools.build_meta" + +[project] +name = "pystalk" +description = "Beanstalkd" +dynamic = ["version", "dependencies", "optional-dependencies"] +readme = "README.md" +requires-python = ">=3.6, <4" +license = { file = "LICENSE.txt" } +authors = [{ name = "EasyPost", email = "oss@easypost.com" }] +classifiers = [ + "Development Status :: 4 - Beta", + "Environment :: Console", + "Programming Language :: Python", + "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", + "Intended Audience :: System Administrators", + "Operating System :: OS Independent", + "Topic :: Database", + "License :: OSI Approved :: ISC License (ISCL)", +] + +[project.urls] +Source = "https://github.com/easypost/pystalk" + +[tool.setuptools.dynamic] +version = { attr = "pystalk.__version__" } +dependencies = { file = ["requirements.txt"] } + +[tool.setuptools.dynamic.optional-dependencies] +dev = { file = ["requirements-tests.txt"] } + +[tool.setuptools.packages.find] +exclude = ["tests", "tests.*"] \ No newline at end of file diff --git a/setup.py b/setup.py deleted file mode 100644 index a823f59..0000000 --- a/setup.py +++ /dev/null @@ -1,44 +0,0 @@ -import os.path - -from setuptools import find_packages, setup - -project_root = os.path.abspath(os.path.dirname(__file__)) - -install_requires = [] -with open(os.path.join(project_root, "requirements.txt"), "r") as f: - for line in f: - install_requires.append(line.rstrip()) - - -with open(os.path.join(project_root, "README.md"), encoding="utf-8") as f: - long_description = f.read() - - -setup( - name="pystalk", - version="0.7.0", - author="EasyPost", - author_email="oss@easypost.com", - url="https://github.com/easypost/pystalk", - description="Very simple beanstalkd client", - long_description=long_description, - long_description_content_type="text/markdown", - license="ISC", - install_requires=install_requires, - packages=find_packages(exclude=["tests", "tests.*"]), - python_requires=">=3.6, <4", - classifiers=[ - "Development Status :: 4 - Beta", - "Environment :: Console", - "Programming Language :: Python", - "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", - "Intended Audience :: System Administrators", - "Operating System :: OS Independent", - "Topic :: Database", - "License :: OSI Approved :: ISC License (ISCL)", - ], -)