Skip to content

Commit

Permalink
Modernize all the things! (#15)
Browse files Browse the repository at this point in the history
* Switch to pyproject.toml
* Make .gitignore ignore all dot-files by default
* Support only current djangos and pythons
* Upgrade github-actions
* Ensure syntax errors halts a github actions run
  • Loading branch information
kaleissin authored Feb 28, 2024
1 parent 33f7d0b commit 0f0dc6e
Show file tree
Hide file tree
Showing 10 changed files with 122 additions and 93 deletions.
3 changes: 1 addition & 2 deletions .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
[bumpversion]
current_version = 1.2.0
files = setup.cfg README.rst
files = src/verification/__init__.py README.rst
commit = False
tag = False

39 changes: 25 additions & 14 deletions .github/workflows/tox.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,36 @@ name: CI
on: [push, pull_request]

jobs:
lint:
name: Lint with flake8
runs-on: ubuntu-latest

steps:
- uses: "actions/checkout@v4"

- uses: "actions/setup-python@v4"
with:
python-version: "3.10"

- run: |
pip install flake8
# stop the build if there are Python syntax errors or undefined names
flake8 --count --select=E9,F63,F7,F82 --show-source --statistics src/
tests:
name: "Python ${{ matrix.python-version }}"
needs: lint
runs-on: ubuntu-latest

strategy:
matrix:
python-version: [3.8,3.9]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]

steps:
- uses: actions/checkout@v2
- uses: "actions/checkout@v4"

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
uses: "actions/setup-python@v4"
with:
python-version: ${{ matrix.python-version }}

Expand All @@ -24,15 +41,9 @@ jobs:
set -xe
python -VV
python -m site
python -m pip install --upgrade pip "setuptools<46" wheel
python -m pip install --upgrade pip wheel
python -m pip install --upgrade virtualenv tox tox-gh-actions
- name: Lint with flake8
run: |
pip install flake8
# stop the build if there are Python syntax errors or undefined names
flake8 --count --select=E9,F63,F7,F82 --show-source --statistics src/
- name: Test with tox
run: |
python -m tox
Expand All @@ -42,16 +53,16 @@ jobs:
runs-on: "ubuntu-latest"

steps:
- uses: "actions/checkout@v2"
- uses: "actions/setup-python@v2"
- uses: "actions/checkout@v4"
- uses: "actions/setup-python@v4"
with:
python-version: "3.8"
python-version: "3.10"

- name: "Install build, check-wheel-content, and twine"
run: |
python -m pip install build twine check-wheel-contents
- name: "Build package"
run: "python -m build --sdist --wheel ."
run: "python -m build"
- name: "List result"
run: "ls -l dist"
- name: "Check wheel contents"
Expand Down
7 changes: 5 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
.*
!.bumpversion.cfg
!.github
!.gitignore
!.pre-commit-config.yaml
*.pyc
*.pyo
*.swp
*.sqlite
*.egg-info
*~
.coverage
.tox
htmlcov
dist
build
15 changes: 14 additions & 1 deletion CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,17 +1,30 @@
Changelog
=========

Release 1.3.0
-------------

Adds support for Django 4.2 and 5.0.

Add support for Python 3.10, 3.11 and 3.12.

Drops support for Python older than 3.8.

Switched from setup.cfg to pyproject.toml.

Release 1.2.0
-------------

Adds support for Django 3.2
Adds support for Django 3.2.

Drops support for Django 2.2 or older, as well as Python 3.5 or older.

Shims to support Python 2.x and Django < 3.2 have been removed.

Sundry modernizing of package building and testing.

Last version to support Python 3.6 and 3.7.

Release 1.1.0
-------------

Expand Down
62 changes: 62 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"

[project]
name = "django-verification"
description = "Generalized app for two-step verification"
authors = [{name = "kaleissin", email = "[email protected]"}]
classifiers = [
"Development Status :: 4 - Beta",
"Environment :: Web Environment",
"Framework :: Django",
"Intended Audience :: Developers",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
"Programming Language :: Python",
"Topic :: Software Development :: Libraries :: Application Frameworks",
"Topic :: Software Development :: Libraries :: Python Modules",
"Framework :: Django :: 3.2",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
]
requires-python = ">=3.8"
dependencies = ["Django>=3.2,<5.1"]
dynamic = ["version"]
readme = "README.rst"

[project.urls]
Homepage = "https://github.com/kaleissin/django-verification"

[tool.hatch.build.targets.wheel]
only-packages = true
sources = ["src"]
only-include = ["src/verification"]

[tool.hatch.version]
path = "src/verification/__init__.py"

[tool.coverage.run]
branch = true

[tool.coverage.report]
skip_empty = true
exclude_lines = [
"pragma: no cover",
"def __repr__",
"if settings.DEBUG",
"assert False",
"raise AssertionError",
"raise NotImplemented",
"if 0:",
"if False:",
"if None:",
"if __name__ == .__main__.:",
]

[tool.flake8]
exclude = ".*,__pycache__,docs,migrations,*.py?,static,templates,*.csv,*.json,build,dist"
62 changes: 0 additions & 62 deletions setup.cfg

This file was deleted.

6 changes: 0 additions & 6 deletions setup.py

This file was deleted.

2 changes: 1 addition & 1 deletion src/verification/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
default_app_config = 'verification.apps.VerificationConfig'
__version__ = "1.2.0"
3 changes: 2 additions & 1 deletion src/verification/signals.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@

__all__ = ['key_claimed']

key_claimed = django.dispatch.Signal(providing_args=["claimant", "group"])
# provides args "claimant", "group"
key_claimed = django.dispatch.Signal()
16 changes: 12 additions & 4 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,16 +1,24 @@
[tox]
isolated_build = true
envlist =
py{36,37,38,39}-django{32}
py{38,39,310}-django{32}
py{38,39,310,311,312}-django{42}
py{310,311,312}-django{50}

[gh-actions]
python =
3.8: py38
3.9: py39
3.10: py310
3.11: py311
3.12: py312

[testenv]
setenv =
PYTHONPATH = {toxinidir}/src
# setenv =
# PYTHONPATH = {toxinidir}/src
commands =
python runtests.py
deps =
django32: django>=3.2,<4.0
django32: django>=3.2,<4
django42: django>=4.2,<5
django50: django>=5.0,<5.1

0 comments on commit 0f0dc6e

Please sign in to comment.