Skip to content

Commit cf6e93a

Browse files
authored
chore: Package overhaul (#140)
* ci: Update pre-commit * ci: Run ruff formatter * build: Move package in to src dir * test: Update requirements building * chore: Keeping git happy after moving to src * ci: Add dependabot config * ci: Update tests to run tox * build: Project config * test: Update tox setup * build: Update setup to build_meta * ci: Update pypi workflows * ci: Update linter to ruff * chore: Fix RUF012 * ci: Update linter trigger * chore: Drop python 3.8 * chore: Drop python 3.8 * chore: Adjust coverage config
1 parent 17c72b9 commit cf6e93a

File tree

197 files changed

+1664
-454
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

197 files changed

+1664
-454
lines changed

.coveragerc

Lines changed: 0 additions & 18 deletions
This file was deleted.

.editorconfig

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,8 @@ quote_type = single
2727
[*.rst]
2828
max_line_length = 80
2929

30-
[*.yml]
30+
[*.toml]
31+
indent_size = 2
32+
33+
[*.{yml,yaml}]
3134
indent_size = 2

.github/dependabot.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# To get started with Dependabot version updates, you'll need to specify which
2+
# package ecosystems to update and where the package manifests are located.
3+
# Please see the documentation for all configuration options:
4+
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
5+
6+
version: 2
7+
updates:
8+
- package-ecosystem: "github-actions"
9+
directory: "/" # Location of package manifests
10+
schedule:
11+
interval: "monthly"

.github/workflows/lint.yml

Lines changed: 21 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,30 @@
11
name: Lint
22

3-
on: [push, pull_request]
3+
concurrency:
4+
group: ${{ github.workflow }}-${{ github.ref }}
5+
cancel-in-progress: true
46

5-
jobs:
6-
flake8:
7-
name: flake8
8-
runs-on: ubuntu-latest
9-
steps:
10-
- name: Checkout
11-
uses: actions/checkout@v2
12-
- name: Set up Python
13-
uses: actions/setup-python@v2
14-
with:
15-
python-version: 3.9
16-
- name: Install flake8
17-
run: pip install --upgrade flake8
18-
- name: Run flake8
19-
uses: liskin/gh-problem-matcher-wrap@v1
20-
with:
21-
linters: flake8
22-
run: flake8
7+
on:
8+
push:
9+
branches:
10+
- master
11+
pull_request:
2312

24-
isort:
13+
jobs:
14+
ruff:
15+
name: ruff
2516
runs-on: ubuntu-latest
2617
steps:
2718
- name: Checkout
28-
uses: actions/checkout@v2
19+
uses: actions/checkout@v4
2920
- name: Set up Python
30-
uses: actions/setup-python@v2
31-
with:
32-
python-version: 3.9
33-
- run: python -m pip install isort
34-
- name: isort
35-
uses: liskin/gh-problem-matcher-wrap@v1
21+
uses: actions/setup-python@v4
3622
with:
37-
linters: isort
38-
run: isort -c -rc -df djangocms_snippet
23+
python-version: "3.11"
24+
cache: 'pip'
25+
- run: |
26+
python -m pip install --upgrade pip
27+
pip install ruff
28+
- name: Run Ruff
29+
working-directory: ./src
30+
run: ruff djangocms_snippet

.github/workflows/publish-to-live-pypi.yml

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,17 @@ jobs:
99
build-n-publish:
1010
name: Build and publish Python 🐍 distributions 📦 to pypi
1111
runs-on: ubuntu-latest
12+
environment:
13+
name: pypi
14+
url: https://pypi.org/p/djangocms-snippet
15+
permissions:
16+
id-token: write
1217
steps:
13-
- uses: actions/checkout@master
14-
- name: Set up Python 3.9
15-
uses: actions/setup-python@v1
18+
- uses: actions/checkout@v4
19+
- name: Set up Python 3.10
20+
uses: actions/setup-python@v4
1621
with:
17-
python-version: 3.9
22+
python-version: '3.11'
1823

1924
- name: Install pypa/build
2025
run: >-
@@ -31,9 +36,6 @@ jobs:
3136
--outdir dist/
3237
.
3338
34-
- name: PyPI - Publish distribution 📦
39+
- name: Publish distribution 📦 to PyPI
3540
if: startsWith(github.ref, 'refs/tags')
3641
uses: pypa/gh-action-pypi-publish@release/v1
37-
with:
38-
user: __token__
39-
password: ${{ secrets.PYPI_API_TOKEN }}

.github/workflows/publish-to-test-pypi.yml

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,23 @@ name: Publish Python 🐍 distributions 📦 to TestPyPI
33
on:
44
push:
55
branches:
6-
- master
6+
- main
77

88
jobs:
99
build-n-publish:
10-
name: TestPyPI - Build and publish Python 🐍 distributions 📦
10+
name: Build and publish Python 🐍 distributions 📦 to TestPyPI
1111
runs-on: ubuntu-latest
12+
environment:
13+
name: pypi
14+
url: https://test.pypi.org/p/djangocms-snippet
15+
permissions:
16+
id-token: write
1217
steps:
13-
- uses: actions/checkout@master
14-
- name: Set up Python 3.9
15-
uses: actions/setup-python@v1
18+
- uses: actions/checkout@v4
19+
- name: Set up Python 3.10
20+
uses: actions/setup-python@v4
1621
with:
17-
python-version: 3.9
22+
python-version: '3.11'
1823

1924
- name: Install pypa/build
2025
run: >-
@@ -34,7 +39,5 @@ jobs:
3439
- name: Publish distribution 📦 to Test PyPI
3540
uses: pypa/gh-action-pypi-publish@release/v1
3641
with:
37-
user: __token__
38-
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
39-
repository_url: https://test.pypi.org/legacy/
42+
repository-url: https://test.pypi.org/legacy/
4043
skip_existing: true

.github/workflows/test.yml

Lines changed: 63 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,79 @@
11
name: CodeCov
22

3-
on: [push, pull_request]
3+
on:
4+
push:
5+
branches:
6+
- master
7+
pull_request:
8+
9+
concurrency:
10+
group: ${{ github.head_ref || github.run_id }}
11+
cancel-in-progress: true
412

513
jobs:
614
unit-tests:
7-
runs-on: ${{ matrix.os }}
15+
name: Python ${{ matrix.python-version }}
16+
runs-on: ubuntu-22.04
17+
818
strategy:
9-
fail-fast: false
1019
matrix:
11-
python-version: [ 3.7, 3.8, 3.9, ] # latest release minus two
12-
requirements-file: [
13-
dj22_cms37.txt,
14-
dj22_cms38.txt,
15-
dj30_cms37.txt,
16-
dj30_cms38.txt,
17-
dj31_cms38.txt,
18-
]
19-
os: [
20-
ubuntu-20.04,
21-
]
20+
python-version:
21+
- 3.9
22+
- '3.10'
23+
- '3.11'
2224

2325
steps:
24-
- uses: actions/checkout@v1
25-
- name: Set up Python ${{ matrix.python-version }}
26+
- uses: actions/checkout@v4
2627

27-
uses: actions/setup-python@v2
28+
- uses: actions/setup-python@v4
2829
with:
2930
python-version: ${{ matrix.python-version }}
31+
allow-prereleases: true
32+
cache: pip
33+
cache-dependency-path: 'tests/requirements/*.txt'
34+
3035
- name: Install dependencies
3136
run: |
32-
python -m pip install --upgrade pip
33-
pip install -r tests/requirements/${{ matrix.requirements-file }}
34-
python setup.py install
37+
python -m pip install --upgrade pip setuptools wheel
38+
python -m pip install --upgrade 'tox>=4.0.0rc3'
39+
40+
- name: Run tox targets for ${{ matrix.python-version }}
41+
run: tox run -f py$(echo ${{ matrix.python-version }} | tr -d .)
42+
43+
- name: Upload coverage data
44+
uses: actions/upload-artifact@v3
45+
with:
46+
name: coverage-data
47+
path: '.coverage.*'
48+
49+
coverage:
50+
name: Coverage
51+
runs-on: ubuntu-22.04
52+
needs: unit-tests
53+
steps:
54+
- uses: actions/checkout@v4
55+
56+
- uses: actions/setup-python@v4
57+
with:
58+
python-version: '3.11'
59+
60+
- name: Install dependencies
61+
run: python -m pip install --upgrade coverage[toml]
62+
63+
- name: Download data
64+
uses: actions/download-artifact@v3
65+
with:
66+
name: coverage-data
3567

36-
- name: Run coverage
37-
run: coverage run setup.py test
68+
- name: Combine coverage
69+
run: |
70+
python -m coverage combine
71+
python -m coverage html --skip-covered --skip-empty
72+
python -m coverage report
3873
39-
- name: Upload Coverage to Codecov
40-
uses: codecov/codecov-action@v1
74+
- name: Upload HTML report
75+
if: ${{ failure() }}
76+
uses: actions/upload-artifact@v3
77+
with:
78+
name: html-report
79+
path: htmlcov

.pre-commit-config.yaml

Lines changed: 36 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,50 @@
1+
ci:
2+
autofix_commit_msg: |
3+
ci: auto fixes from pre-commit hooks
4+
5+
for more information, see https://pre-commit.ci
6+
autofix_prs: true
7+
autoupdate_commit_msg: 'ci: pre-commit autoupdate'
8+
autoupdate_schedule: monthly
9+
110
repos:
2-
# Need to drop python 3.5 and 3.6 before we include python upgrade
3-
# - repo: https://github.com/asottile/pyupgrade
4-
# rev: v2.31.0
5-
# hooks:
6-
# - id: pyupgrade
7-
# args: ["--py37-plus"]
11+
- repo: https://github.com/asottile/pyupgrade
12+
rev: v3.4.0
13+
hooks:
14+
- id: pyupgrade
15+
args: ["--py38-plus"]
816

917
- repo: https://github.com/adamchainz/django-upgrade
10-
rev: '1.6.1'
18+
rev: '1.13.0'
1119
hooks:
1220
- id: django-upgrade
13-
args: [--target-version, "2.2"]
21+
args: [--target-version, "3.2"]
1422

15-
- repo: https://github.com/PyCQA/flake8
16-
rev: 4.0.1
23+
- repo: https://github.com/charliermarsh/ruff-pre-commit
24+
rev: "v0.0.270"
1725
hooks:
18-
- id: flake8
26+
- id: ruff
27+
args: [--fix, --exit-non-zero-on-fix]
1928

20-
- repo: https://github.com/asottile/yesqa
21-
rev: v1.3.0
29+
- repo: https://github.com/astral-sh/ruff-pre-commit
30+
# Ruff version.
31+
rev: v0.1.2
2232
hooks:
23-
- id: yesqa
33+
- id: ruff-format
2434

2535
- repo: https://github.com/pre-commit/pre-commit-hooks
26-
rev: v4.2.0
36+
rev: v4.4.0
2737
hooks:
38+
- id: check-added-large-files
39+
- id: check-case-conflict
40+
- id: check-json
2841
- id: check-merge-conflict
29-
- id: mixed-line-ending
42+
- id: check-symlinks
43+
- id: check-toml
44+
- id: end-of-file-fixer
45+
- id: trailing-whitespace
3046

31-
- repo: https://github.com/pycqa/isort
32-
rev: 5.10.1
33-
hooks:
34-
- id: isort
47+
# - repo: https://github.com/pre-commit/mirrors-mypy
48+
# rev: v1.3.0
49+
# hooks:
50+
# - id: mypy

CHANGELOG.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22
Changelog
33
=========
44

5+
Unreleased
6+
==========
7+
8+
* Drop support for Django < 3.2
9+
* Drop support for Python < 3.9
10+
511
3.1.1
612
=====
713

MANIFEST.in

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1+
prune tests
2+
include CHANGELOG.rst
13
include LICENSE
4+
include pyproject.toml
25
include README.rst
3-
recursive-include djangocms_snippet/locale *
4-
recursive-include djangocms_snippet/templates *
5-
recursive-exclude * *.py[co]
6+
include src/*/py.typed

djangocms_snippet/__init__.py

Lines changed: 0 additions & 3 deletions
This file was deleted.

0 commit comments

Comments
 (0)