Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,26 +1,28 @@
name: Publish to PyPI
on:
on:
release:
types: [published]
workflow_dispatch:


jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v2
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

v3 is out. Can this use actions/checkout@v3? https://github.com/actions/checkout/releases/tag/v3.3.0

- name: Set up Python
uses: actions/setup-python@v1
uses: actions/setup-python@v4
with:
python-version: 3.7
python-version: 3.11
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install --upgrade pip build
pip install twine wheel
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
pip install twine wheel
pip install twine

Is wheel needed here? From using python -m build (very cool, by the way, TIL this is a thing), it looks like the build package handles that install itself in an isolated environment.

- name: Build the package
run: |
python setup.py sdist bdist_wheel --universal
python -m build
- name: Upload to PyPI
run: twine upload dist/*
env:
env:
TWINE_USERNAME: ${{ secrets.TWINE_USERNAME }}
TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD }}
28 changes: 14 additions & 14 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.10"
python-version: "3.8"

- name: Install dependencies
run: |
Expand All @@ -33,22 +33,22 @@ jobs:
matrix:
toxenv:
# Legacy versions
- py39-dj32-wag215
- py38-dj32-wag215

# Current and latest versions
- py310-dj32-wag30
- py310-dj40-wag30
- py310-dj40-waglatest
- py311-dj32-wag30
- py311-dj40-wag30
- py311-dj40-waglatest

include:
- toxenv: py39-dj32-wag215
python-version: "3.9"
- toxenv: py310-dj32-wag30
python-version: "3.10"
- toxenv: py310-dj40-wag30
python-version: "3.10"
- toxenv: py310-dj40-waglatest
python-version: "3.10"
- toxenv: py38-dj32-wag215
python-version: "3.8"
- toxenv: py311-dj32-wag30
python-version: "3.11"
- toxenv: py311-dj40-wag30
python-version: "3.11"
- toxenv: py311-dj40-waglatest
python-version: "3.11"

steps:
- uses: actions/checkout@v3
Expand Down Expand Up @@ -89,7 +89,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.10"
python-version: "3.8"

- name: Install dependencies
run: |
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -73,3 +73,4 @@ dist/

# IDEs
.idea/
*.db
7 changes: 3 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,10 @@ repos:
- id: black
args: ["wagtailflags", "setup.py", "--line-length=79"]
exclude: migrations
- repo: https://gitlab.com/pycqa/flake8
rev: 4.0.1
- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: v0.0.188
hooks:
- id: flake8
additional_dependencies: [flake8-bugbear==22.1.11]
- id: ruff
- repo: https://github.com/pycqa/isort
rev: 5.10.1
hooks:
Expand Down
91 changes: 83 additions & 8 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,55 @@
[project]
name = "wagtail-flags"
version = "5.3.0"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might want to mention this version bump in the PR description -- although, are you still planning on releasing an interim 5.3.0, or just going to 6.x in #72?

description = "Feature flags for Wagtail sites"
readme = "README.md"
requires-python = ">=3.8"
license = {text = "CC0"}
authors = [
{name = "CFPB", email = "[email protected]" }
]
dependencies = [
"wagtail>2.15,<4",
"django-flags>4.2"
]
classifiers = [
"Framework :: Django",
"Framework :: Django :: 3.2",
"Framework :: Django :: 4",
"Framework :: Wagtail",
"Framework :: Wagtail :: 2",
"Framework :: Wagtail :: 3",
"License :: CC0 1.0 Universal (CC0 1.0) Public Domain Dedication",
"License :: Public Domain",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
]

[project.optional-dependencies]
testing = [
"coverage[toml]",
]

[project.urls]
"Homepage" = "https://github.com/cfpb/wagtail-flags"
"Bug Reports" = "https://github.com/cfpb/wagtail-flags/issues"
"Source" = "https://github.com/cfpb/wagtail-flags"

[build-system]
requires = ["setuptools>=43.0.0", "wheel"]
build-backend = "setuptools.build_meta"
Comment on lines +38 to +40
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How do these lines relate to the use of python -m build in the release GHA? Is this duplication? Or are these the lines that tell the build package to install wheel?


[tool.setuptools.package-data]
wagtailflags = [
"templates/wagtailflags/*",
"templates/wagtailflags/flags/*",
"templates/wagtailflags/includes/*",
"static/wagtailflags/css/*",
]

[tool.black]
line-length = 79
target-version = ['py36', 'py38']
target-version = ["py38"]
include = '\.pyi?$'
exclude = '''
(
Expand All @@ -14,15 +63,41 @@ exclude = '''
| dist
| migrations
| site
| \*.json
| \*.csv
)/
)
'''

[build-system]
requires = [
"setuptools>=42",
"wheel"
[tool.isort]
profile = "black"
line_length = 79
lines_after_imports = 2
skip = [".tox", ".venv", "venv"]
known_django = ["django"]
known_wagtail = ["wagtail"]
default_section = "THIRDPARTY"
sections = [
"STDLIB",
"DJANGO",
"WAGTAIL",
"THIRDPARTY",
"FIRSTPARTY",
"LOCALFOLDER"
]

[tool.ruff]
exclude = [
".git",
".tox",
"__pycache__",
]
ignore = []
select = [
"E",
"F",
"W",
]

[tool.coverage.run]
omit = [
"wagtailflags/tests/*",
]
build-backend = "setuptools.build_meta"
76 changes: 0 additions & 76 deletions setup.cfg

This file was deleted.

36 changes: 27 additions & 9 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
skipsdist=True
envlist=
lint,
py{39,310}-dj{32}-wag{215},
py{39,310}-dj{32,40}-wag{30,latest},
py{38,311}-dj{32}-wag{215},
py{38,311}-dj{32,40}-wag{30,latest},
coverage

[testenv]
Expand All @@ -14,33 +14,51 @@ setenv=
DJANGO_SETTINGS_MODULE=wagtailflags.tests.settings

basepython=
py39: python3.9
py310: python3.10
py38: python3.8
py311: python3.11

deps=
dj32: Django>=3.2,<3.3
dj40: Django>=4.0,<4.1
wag215: wagtail>=2.15,<2.16
wag215: wagtail>=2.15,<4
wag30: wagtail>=3.0,<3.1
waglatest: wagtail<4

[testenv:lint]
basepython=python3.10
basepython=python3.8
deps=
black
flake8
ruff
isort
commands=
black --check wagtailflags
flake8 wagtailflags
ruff wagtailflags
isort --check-only --diff wagtailflags

[testenv:coverage]
basepython=python3.10
basepython=python3.8
deps=
coverage
diff_cover
commands=
coverage combine
coverage xml
diff-cover coverage.xml --compare-branch=origin/main --fail-under=100

[testenv:interactive]
basepython=python3.8

deps=
Django>=3.2,<3.3

commands_pre=
{envbindir}/django-admin makemigrations
{envbindir}/django-admin migrate
{envbindir}/django-admin shell -c "from django.contrib.auth.models import User;(not User.objects.filter(username='admin').exists()) and User.objects.create_superuser('admin', '[email protected]', 'changeme')"

commands=
{posargs:{envbindir}/django-admin runserver 0.0.0.0:8000}

setenv=
DJANGO_SETTINGS_MODULE=wagtailflags.tests.settings
INTERACTIVE=1
Loading