Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move to modern package configuration #27

Merged
merged 3 commits into from
Oct 12, 2024
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
141 changes: 141 additions & 0 deletions .github/workflows/packaging.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
name: Packaging

on:
- push

jobs:
format:
name: Check formatting
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: actions/setup-python@v5
with:
python-version: "3.12"

- name: Install tox
run: python -m pip install tox

- name: Run black
run: tox -e format

lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: actions/setup-python@v5
with:
python-version: "3.12"

- name: Install tox
run: python -m pip install tox

- name: Run flake8
run: tox -e lint

typecheck:
name: Type check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: actions/setup-python@v5
with:
python-version: "3.12"

- name: Install tox
run: python -m pip install tox

- name: Run mypy
run: tox -e typecheck

test:
name: Test
runs-on: ubuntu-latest
strategy:
matrix:
python:
- version: "3.13"
toxenv: "py313"
- version: "3.12"
toxenv: "py312"
- version: "3.11"
toxenv: "py311"
- version: "3.10"
toxenv: "py310"
- version: "3.9"
toxenv: "py39"
steps:
- uses: actions/checkout@v4

- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python.version }}

- name: Install tox
run: python -m pip install tox

- name: Run pytest
run: tox -e ${{ matrix.python.toxenv }}

build_source_dist:
name: Build source distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: actions/setup-python@v5
with:
python-version: "3.12"

- name: Install build
run: python -m pip install build

- name: Run build
run: python -m build --sdist

- uses: actions/upload-artifact@v4
with:
path: dist/*.tar.gz

publish:
needs: [format, lint, typecheck, test]
if: startsWith(github.ref, 'refs/tags')
runs-on: ubuntu-latest
environment: release
permissions:
id-token: write
contents: write
steps:
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.9

- name: Install pypa/build
run: python -m pip install build

- name: Build distribution
run: python -m build --outdir dist/

- name: Publish distribution to Test PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository_url: https://test.pypi.org/legacy/

- name: Publish distribution to PyPI
uses: pypa/gh-action-pypi-publish@release/v1

- name: Publish distribution to GitHub release
uses: softprops/action-gh-release@v2
with:
files: |
dist/django_webmention-*.whl
dist/django_webmention-*.tar.gz
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
234 changes: 233 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,235 @@
[project]
name = "django-webmention"
version = "3.0.0"
description = "A pluggable implementation of webmention for Django projects"
authors = [
{ name = "Dane Hillard", email = "[email protected]" },
]
license = { file = "LICENSE" }
classifiers = [
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"Framework :: Django",
"Framework :: Django :: 3.2",
"Framework :: Django :: 4.0",
"Framework :: Django :: 4.1",
"Topic :: Internet :: WWW/HTTP :: Indexing/Search",
"License :: OSI Approved :: MIT License",
"Programming Language :: Python",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
]
dependencies = [
"Django>=4.2.0",
"requests>=2.32.3",
]

[project.urls]
Repository = "https://github.com/easy-as-python/django-webmention"

[tool.setuptools.packages.find]
where = ["src"]
exclude = ["test*"]

######################
# Tool configuration #
######################

[tool.black]
line-length = 120
target-version = ['py35', 'py36', 'py37', 'py38']
target-version = ["py39", "py310", "py311", "py312", "py313"]

[tool.mypy]
python_version = "3.9"
warn_unused_configs = true
show_error_context = true
pretty = true
namespace_packages = true
check_untyped_defs = true

[[tool.mypy.overrides]]
module = [
"django.core.urlresolvers",
]
ignore_missing_imports = true

[tool.coverage.run]
branch = true
omit = [
"manage.py",
"webmention/checks.py",
"*test*",
"*/migrations/*",
"*/admin.py",
"*/__init__.py",
]

[tool.coverage.report]
precision = 2
show_missing = true
skip_covered = true

[tool.coverage.paths]
source = [
"src/webmention",
"*/site-packages/webmention",
]

[tool.pytest.ini_options]
DJANGO_SETTINGS_MODULE = "tests.settings"
testpaths = ["tests"]
addopts = ["-ra", "-q", "--cov=webmention"]
xfail_strict = true

[tool.tox]
envlist = [
"py39-django4.2",
"py39-django5.0",
"py39-django5.1",
"py310-django4.2",
"py310-django5.0",
"py310-django5.1",
"py311-django4.2",
"py311-django5.0",
"py311-django5.1",
"py312-django4.2",
"py312-django5.0",
"py312-django5.1",
"py313-django4.2",
"py313-django5.0",
"py313-django5.1",
]

[tool.tox.env_run_base]
deps = [
"pytest",
"pytest-cov",
"pytest-django",
]
commands = [
["pytest", { replace = "posargs", default = [], extend = true }],
]

[tool.tox.env."py39-django4.2"]
deps = [
{ replace = "ref", of = ["tool", "tox", "env_run_base", "deps"], extend = true },
"Django>=4.2,<4.3",
]

[tool.tox.env."py39-django5.0"]
deps = [
{ replace = "ref", of = ["tool", "tox", "env_run_base", "deps"], extend = true },
"Django>=5.0,<5.1",
]

[tool.tox.env."py39-django5.1"]
deps = [
{ replace = "ref", of = ["tool", "tox", "env_run_base", "deps"], extend = true },
"Django>=5.1,<5.2",
]

[tool.tox.env."py310-django4.2"]
deps = [
{ replace = "ref", of = ["tool", "tox", "env_run_base", "deps"], extend = true },
"Django>=4.2,<4.3",
]

[tool.tox.env."py310-django5.0"]
deps = [
{ replace = "ref", of = ["tool", "tox", "env_run_base", "deps"], extend = true },
"Django>=5.0,<5.1",
]

[tool.tox.env."py310-django5.1"]
deps = [
{ replace = "ref", of = ["tool", "tox", "env_run_base", "deps"], extend = true },
"Django>=5.1,<5.2",
]

[tool.tox.env."py311-django4.2"]
deps = [
{ replace = "ref", of = ["tool", "tox", "env_run_base", "deps"], extend = true },
"Django>=4.2,<4.3",
]

[tool.tox.env."py311-django5.0"]
deps = [
{ replace = "ref", of = ["tool", "tox", "env_run_base", "deps"], extend = true },
"Django>=5.0,<5.1",
]

[tool.tox.env."py311-django5.1"]
deps = [
{ replace = "ref", of = ["tool", "tox", "env_run_base", "deps"], extend = true },
"Django>=5.1,<5.2",
]

[tool.tox.env."py312-django4.2"]
deps = [
{ replace = "ref", of = ["tool", "tox", "env_run_base", "deps"], extend = true },
"Django>=4.2,<4.3",
]

[tool.tox.env."py312-django5.0"]
deps = [
{ replace = "ref", of = ["tool", "tox", "env_run_base", "deps"], extend = true },
"Django>=5.0,<5.1",
]

[tool.tox.env."py312-django5.1"]
deps = [
{ replace = "ref", of = ["tool", "tox", "env_run_base", "deps"], extend = true },
"Django>=5.1,<5.2",
]

[tool.tox.env."py313-django4.2"]
deps = [
{ replace = "ref", of = ["tool", "tox", "env_run_base", "deps"], extend = true },
"Django>=4.2,<4.3",
]

[tool.tox.env."py313-django5.0"]
deps = [
{ replace = "ref", of = ["tool", "tox", "env_run_base", "deps"], extend = true },
"Django>=5.0,<5.1",
]

[tool.tox.env."py313-django5.1"]
deps = [
{ replace = "ref", of = ["tool", "tox", "env_run_base", "deps"], extend = true },
"Django>=5.1,<5.2",
]

[tool.tox.env.lint]
skip_install = true
deps = [
"ruff",
]
commands = [
["ruff", "check", { replace = "posargs", default = ["--diff", "src/webmention", "tests"], extend = true }],
]

[tool.tox.env.format]
skip_install = true
deps = [
"black",
]
commands = [
["black", { replace = "posargs", default = ["--check", "--diff", "src/webmention", "tests"], extend = true }],
]

[tool.tox.env.typecheck]
deps = [
{ replace = "ref", of = ["tool", "tox", "env_run_base", "deps"], extend = true },
"mypy",
"django-types",
"types-requests",
]
commands = [
["mypy", { replace = "posargs", default = ["src/webmention", "tests"], extend = true }],
]
Loading