diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e338aa6..55b358e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -36,13 +36,14 @@ jobs: uses: actions/setup-python@v2 with: python-version: ${{ matrix.pythonversion }} + - uses: extractions/setup-just@v3 - name: install dependencies - run: "python -m pip install -r requirements-tests.txt -e ." + run: just install - name: lint with flake8 - run: flake8 pystalk/ tests/ + run: venv/bin/flake8 pystalk/ tests/ - name: test with pytest - run: pytest --cov=pystalk/ --cov-report=term-missing --cov-fail-under=60 tests/ + run: venv/bin/pytest --cov=pystalk/ --cov-report=term-missing --cov-fail-under=60 tests/ env: BEANSTALKD_PATH: ~/beanstalks/beanstalkd - name: check mypy - run: mypy pystalk/ tests/ + run: venv/bin/mypy pystalk/ tests/ 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..06e3152 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 `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..a24010b --- /dev/null +++ b/justfile @@ -0,0 +1,9 @@ +# Install the project and build its dependencies. +install: + python -m venv venv + venv/bin/pip install -e '.[dev]' + +# build sdist and wheel into dist/ +build: + venv/bin/pip install build + venv/bin/python -m build diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..827c6db --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,56 @@ +[build-system] +requires = ["setuptools>=61", "wheel"] +build-backend = "setuptools.build_meta" + +[project] +name = "pystalk" +description = "An extremely simple Python client for beanstalkd" +dynamic = ["version"] +readme = "README.md" +requires-python = ">=3.6, <4" +license = { file = "LICENSE.txt" } +authors = [{ name = "EasyPost", email = "oss@easypost.com" }] +dependencies = [ + "PyYAML>=3.0", + "attrs>=19.2", + "six", +] +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.optional-dependencies] +dev = [ + "flake8", + "mock", + "mypy==0.971", + "pytest==7.*", + "pytest-cov==3.*", + "pytest-mock==3.*", + "types-PyYAML", + "types-six", +] +docs = [ + "PyYAML>=3.0", + "sphinx", + "sphinx-autobuild", +] + +[project.urls] +Source = "https://github.com/easypost/pystalk" + +[tool.setuptools.dynamic] +version = { attr = "pystalk.__version__" } + +[tool.setuptools.packages.find] +exclude = ["tests", "tests.*"] diff --git a/requirements-docs.txt b/requirements-docs.txt deleted file mode 100644 index 35533e9..0000000 --- a/requirements-docs.txt +++ /dev/null @@ -1,3 +0,0 @@ -PyYAML>=3.0 -sphinx -sphinx-autobuild diff --git a/requirements-tests.txt b/requirements-tests.txt deleted file mode 100644 index c86346e..0000000 --- a/requirements-tests.txt +++ /dev/null @@ -1,8 +0,0 @@ -pytest==7.* -pytest-cov==3.* -pytest-mock==3.* -mock -flake8 -mypy==0.971 -types-PyYAML -types-six diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index 3b24772..0000000 --- a/requirements.txt +++ /dev/null @@ -1,3 +0,0 @@ -PyYAML>=3.0 -attrs>=19.2 -six 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)", - ], -)