-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Modernize Python packaging * Run 'make format' * Add releasing instructions * Fix validate_setup script * Use pip-compile to upgrade requirements * Use python -m venv * Install pinned requirements.txt * @grahamalama review * Move to src-layout * Fix 'make clean' * Fix path .ini when running kinto * Narrow finding files when deleting cache * Fix 'make lint' * Fix 'tox -e lint' * tox, your days are counted * Remove superfluous -o requirements.txt for pip-compile * Split venv creation from install
- Loading branch information
Showing
24 changed files
with
1,062 additions
and
824 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
changelog: | ||
exclude: | ||
authors: | ||
- dependabot | ||
categories: | ||
- title: Breaking Changes | ||
labels: | ||
- "breaking-change" | ||
- title: Bug Fixes | ||
labels: | ||
- "bug" | ||
- title: New Features | ||
labels: | ||
- "enhancement" | ||
- title: Documentation | ||
labels: | ||
- "documentation" | ||
- title: Dependency Updates | ||
labels: | ||
- "dependencies" | ||
- title: Other Changes | ||
labels: | ||
- "*" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
name: Publish Python 🐍 distribution 📦 to PyPI | ||
|
||
on: | ||
push: | ||
tags: | ||
- '*' | ||
|
||
jobs: | ||
build: | ||
name: Build distribution 📦 | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: "3.x" | ||
|
||
- name: Print environment | ||
run: | | ||
python --version | ||
- name: Install pypa/build | ||
run: python3 -m pip install build | ||
|
||
- name: Build a binary wheel and a source tarball | ||
run: python3 -m build | ||
|
||
- name: Store the distribution packages | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: python-package-distributions | ||
path: dist/ | ||
|
||
publish-to-pypi: | ||
name: Publish Python 🐍 distribution 📦 to PyPI | ||
if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes | ||
needs: | ||
- build | ||
runs-on: ubuntu-latest | ||
environment: | ||
name: release | ||
url: https://pypi.org/p/kinto-emailer | ||
permissions: | ||
id-token: write | ||
steps: | ||
- name: Download all the dists | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: python-package-distributions | ||
path: dist/ | ||
- name: Publish distribution 📦 to PyPI | ||
uses: pypa/gh-action-pypi-publish@release/v1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,13 @@ | ||
.cache | ||
.tox | ||
.coverage | ||
records.json | ||
.pytest_cache | ||
.ruff_cache | ||
*.pyc | ||
__pycache__/ | ||
*.egg-info/ | ||
*.egg | ||
mail/ | ||
.venv/ | ||
build/ | ||
dist/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,55 +1,49 @@ | ||
VIRTUALENV = virtualenv | ||
VENV := $(shell echo $${VIRTUAL_ENV-$$PWD/.venv}) | ||
PYTHON = $(VENV)/bin/python | ||
DEV_STAMP = $(VENV)/.dev_env_installed.stamp | ||
INSTALL_STAMP = $(VENV)/.install.stamp | ||
TEMPDIR := $(shell mktemp -d) | ||
|
||
.IGNORE: clean | ||
.PHONY: all install virtualenv tests install-dev tests-once | ||
.PHONY: all install virtualenv tests tests-once | ||
|
||
OBJECTS = .venv .coverage | ||
|
||
all: install | ||
install: $(INSTALL_STAMP) | ||
$(INSTALL_STAMP): $(PYTHON) requirements.txt setup.py | ||
|
||
$(VENV)/bin/python: | ||
python -m venv $(VENV) | ||
|
||
install: $(INSTALL_STAMP) pyproject.toml requirements.txt | ||
$(INSTALL_STAMP): $(VENV)/bin/python pyproject.toml requirements.txt | ||
$(VENV)/bin/pip install -r requirements.txt | ||
$(PYTHON) setup.py develop | ||
$(VENV)/bin/pip install ".[dev]" | ||
touch $(INSTALL_STAMP) | ||
|
||
install-dev: $(INSTALL_STAMP) $(DEV_STAMP) | ||
$(DEV_STAMP): $(PYTHON) dev-requirements.txt | ||
$(VENV)/bin/pip install -r dev-requirements.txt | ||
touch $(DEV_STAMP) | ||
lint: install | ||
$(VENV)/bin/ruff check src tests *.py | ||
$(VENV)/bin/ruff format --check src tests *.py | ||
|
||
virtualenv: $(PYTHON) | ||
$(PYTHON): | ||
virtualenv $(VENV) | ||
format: install | ||
$(VENV)/bin/ruff check --fix src tests *.py | ||
$(VENV)/bin/ruff format src tests *.py | ||
|
||
build-requirements: | ||
$(VIRTUALENV) $(TEMPDIR) | ||
$(TEMPDIR)/bin/pip install -U pip | ||
$(TEMPDIR)/bin/pip install -Ue . | ||
$(TEMPDIR)/bin/pip freeze | grep -v -- '^-e' > requirements.txt | ||
requirements.txt: requirements.in | ||
pip-compile requirements.in | ||
|
||
tests-once: install-dev | ||
tests-once: install | ||
$(VENV)/bin/py.test --cov-report term-missing --cov-fail-under 100 --cov kinto_emailer | ||
tests: install-dev | ||
|
||
tests: install | ||
$(VENV)/bin/tox | ||
|
||
clean: | ||
find . -name '*.pyc' -delete | ||
find . -name '__pycache__' -type d -exec rm -fr {} \; | ||
|
||
install-kinto: $(VENV)/bin/kinto | ||
$(VENV)/bin/kinto: install | ||
$(VENV)/bin/pip install kinto | ||
find src/ -name '*.pyc' -delete | ||
find src/ -name '__pycache__' -type d -exec rm -fr {} \; | ||
rm -rf .tox $(VENV) mail/ *.egg-info .pytest_cache .ruff_cache .coverage build dist | ||
|
||
run-kinto: install-kinto | ||
$(VENV)/bin/kinto start --ini kinto_emailer/tests/config/kinto.ini | ||
run-kinto: install | ||
$(VENV)/bin/kinto start --ini tests/config/kinto.ini | ||
|
||
need-kinto-running: | ||
@curl http://localhost:8888/v0/ 2>/dev/null 1>&2 || (echo "Run 'make run-kinto' before starting tests." && exit 1) | ||
|
||
functional: install-dev need-kinto-running | ||
$(VENV)/bin/py.test kinto_emailer/tests/functional.py | ||
functional: install need-kinto-running | ||
$(VENV)/bin/py.test tests/functional.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.