Skip to content

Commit 9f83ae6

Browse files
authored
ci: Switch to UV and update package setup (#46)
1 parent f03197b commit 9f83ae6

Some content is hidden

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

46 files changed

+2532
-348
lines changed

.editorconfig

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,8 @@ indent_size = 4
1313
[*.py]
1414
max_line_length = 119
1515

16+
[*.rst]
17+
indent_size = 2
18+
1619
[*.yml]
1720
indent_size = 2

.github/workflows/main.yml

Lines changed: 44 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -13,67 +13,81 @@ concurrency:
1313
jobs:
1414
tests:
1515
name: Python ${{ matrix.python-version }}
16-
runs-on: ubuntu-20.04
16+
runs-on: ubuntu-24.04
1717

1818
strategy:
1919
matrix:
2020
python-version:
21-
- 3.8
22-
- 3.9
23-
- '3.10'
24-
- '3.11'
21+
- 3.8
22+
- 3.9
23+
- '3.10'
24+
- '3.11'
25+
- '3.12'
26+
- '3.13'
2527

2628
steps:
27-
- uses: actions/checkout@v4
29+
- uses: actions/checkout@v4
2830

29-
- uses: actions/setup-python@v5
30-
with:
31-
python-version: ${{ matrix.python-version }}
32-
cache: pip
33-
cache-dependency-path: 'requirements/*.txt'
31+
- uses: actions/setup-python@v5
32+
with:
33+
python-version: ${{ matrix.python-version }}
34+
allow-prereleases: true
3435

35-
- name: Install dependencies
36-
run: |
37-
python -m pip install --upgrade pip setuptools wheel
38-
python -m pip install --upgrade tox tox-py
36+
- name: Install uv
37+
uses: astral-sh/setup-uv@v3
38+
with:
39+
enable-cache: true
40+
cache-dependency-glob: tests/requirements/*.txt
3941

40-
- name: Run tox targets for ${{ matrix.python-version }}
41-
run: tox --py current
42+
- name: Install dependencies
43+
run: uv pip install --system tox tox-uv
4244

43-
- name: Upload coverage data
44-
uses: actions/upload-artifact@v3
45-
with:
46-
name: coverage-data
47-
path: '.coverage.*'
45+
- name: Run tox targets for ${{ matrix.python-version }}
46+
run: tox run -f py$(echo ${{ matrix.python-version }} | tr -d .)
47+
48+
- name: Upload coverage data
49+
uses: actions/upload-artifact@v4
50+
with:
51+
name: coverage-data-${{ matrix.python-version }}
52+
path: '${{ github.workspace }}/.coverage.*'
53+
include-hidden-files: true
54+
if-no-files-found: error
4855

4956
coverage:
5057
name: Coverage
51-
runs-on: ubuntu-20.04
58+
runs-on: ubuntu-24.04
5259
needs: tests
5360
steps:
5461
- uses: actions/checkout@v4
5562

5663
- uses: actions/setup-python@v5
5764
with:
58-
python-version: '3.10'
65+
python-version: '3.12'
66+
67+
- name: Install uv
68+
uses: astral-sh/setup-uv@v3
5969

6070
- name: Install dependencies
61-
run: python -m pip install --upgrade coverage[toml]
71+
run: uv pip install --system coverage[toml]
6272

6373
- name: Download data
64-
uses: actions/download-artifact@v2
74+
uses: actions/download-artifact@v4
6575
with:
66-
name: coverage-data
76+
path: ${{ github.workspace }}
77+
pattern: coverage-data-*
78+
merge-multiple: true
6779

68-
- name: Combine coverage
80+
- name: Combine coverage and fail if it's <96%
6981
run: |
7082
python -m coverage combine
7183
python -m coverage html --skip-covered --skip-empty
72-
python -m coverage report
84+
python -m coverage report --fail-under=96
85+
echo "## Coverage summary" >> $GITHUB_STEP_SUMMARY
86+
python -m coverage report --format=markdown >> $GITHUB_STEP_SUMMARY
7387
7488
- name: Upload HTML report
7589
if: ${{ failure() }}
76-
uses: actions/upload-artifact@v3
90+
uses: actions/upload-artifact@v4
7791
with:
7892
name: html-report
7993
path: htmlcov

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
- name: Set up Python 3.10
2020
uses: actions/setup-python@v5
2121
with:
22-
python-version: '3.10'
22+
python-version: '3.12'
2323

2424
- name: Install pypa/build
2525
run: >-

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
- name: Set up Python 3.10
2020
uses: actions/setup-python@v5
2121
with:
22-
python-version: '3.10'
22+
python-version: '3.12'
2323

2424
- name: Install pypa/build
2525
run: >-

.pre-commit-config.yaml

Lines changed: 59 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,63 @@ ci:
77
autoupdate_commit_msg: 'ci: pre-commit autoupdate'
88
autoupdate_schedule: monthly
99

10-
repos:
11-
- repo: https://github.com/asottile/pyupgrade
12-
rev: v3.16.0
13-
hooks:
14-
- id: pyupgrade
15-
args: ["--py38-plus"]
16-
17-
- repo: https://github.com/adamchainz/django-upgrade
18-
rev: '1.19.0'
19-
hooks:
20-
- id: django-upgrade
21-
args: [--target-version, "3.2"]
10+
default_language_version:
11+
python: python3.12
2212

23-
- repo: https://github.com/astral-sh/ruff-pre-commit
24-
rev: "v0.5.0"
25-
hooks:
26-
- id: ruff
27-
args: [--fix, --exit-non-zero-on-fix]
13+
repos:
14+
- repo: https://github.com/pre-commit/pre-commit-hooks
15+
rev: v4.6.0
16+
hooks:
17+
- id: check-added-large-files
18+
- id: check-case-conflict
19+
- id: check-json
20+
- id: check-merge-conflict
21+
- id: check-symlinks
22+
- id: check-toml
23+
- id: end-of-file-fixer
24+
- id: trailing-whitespace
25+
- repo: https://github.com/tox-dev/pyproject-fmt
26+
rev: 2.2.1
27+
hooks:
28+
- id: pyproject-fmt
29+
- repo: https://github.com/tox-dev/tox-ini-fmt
30+
rev: 1.3.1
31+
hooks:
32+
- id: tox-ini-fmt
33+
- repo: https://github.com/rstcheck/rstcheck
34+
rev: v6.2.4
35+
hooks:
36+
- id: rstcheck
37+
additional_dependencies:
38+
- tomli==2.0.1
39+
- repo: https://github.com/asottile/pyupgrade
40+
rev: v3.17.0
41+
hooks:
42+
- id: pyupgrade
43+
args: [--py38-plus]
44+
- repo: https://github.com/adamchainz/django-upgrade
45+
rev: 1.20.0
46+
hooks:
47+
- id: django-upgrade
48+
args: [--target-version, '3.2']
49+
- repo: https://github.com/psf/black-pre-commit-mirror
50+
rev: 24.8.0
51+
hooks:
52+
- id: black
53+
- repo: https://github.com/adamchainz/blacken-docs
54+
rev: 1.18.0
55+
hooks:
56+
- id: blacken-docs
57+
additional_dependencies:
58+
- black==23.1.0
59+
- repo: https://github.com/pycqa/isort
60+
rev: 5.13.2
61+
hooks:
62+
- id: isort
63+
name: isort (python)
64+
- repo: https://github.com/pre-commit/mirrors-mypy
65+
rev: v1.11.2
66+
hooks:
67+
- id: mypy
68+
additional_dependencies:
69+
- django-stubs==5.0.4

HISTORY.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,3 @@ History
1717
------------------
1818

1919
* Initial release.
20-

README.md

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

README.rst

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
django-sys-indicator
2+
====================
3+
4+
.. image:: https://results.pre-commit.ci/badge/github/marksweb/django-sys-indicator/main.svg
5+
:target: https://results.pre-commit.ci/latest/github/marksweb/django-sys-indicator/main
6+
:alt: pre-commit.ci status
7+
8+
.. image:: https://img.shields.io/github/license/marksweb/django-sys-indicator
9+
:target: https://github.com/marksweb/django-sys-indicator/blob/main/LICENSE
10+
11+
.. image:: https://img.shields.io/github/issues/marksweb/django-sys-indicator
12+
:target: https://github.com/marksweb/django-sys-indicator/issues
13+
14+
15+
A visual indicator of what environment/system you're using in django.
16+
17+
.. image:: https://django-sys-indicator.s3.eu-west-2.amazonaws.com/screenshots/django-sys-indicator.jpg
18+
:alt: system indicator examples
19+
20+
21+
To install:
22+
23+
* Add ``"django_sys_indicator.apps.DjangoSysIndicatorConfig"`` to your ``INSTALLED_APPS``
24+
25+
* Add ``"django_sys_indicator.middleware.SystemIndicatorMiddleware"`` to your ``MIDDLEWARE``
26+
27+
28+
Configuration settings and their defaults
29+
30+
.. code-block::
31+
32+
SYSTEM_INDICATOR_ENABLED = False
33+
SYSTEM_INDICATOR_LABEL = "localhost"
34+
SYSTEM_INDICATOR_COLORS = {
35+
# Format here is colour, border colour
36+
"red": ("#c50000", "#daa"),
37+
"blue": ("#006fc4", "#aad"),
38+
"green": ("#009e00", "#ada"),
39+
"purple": ("#800080", "#dad"),
40+
"orange": ("#ff7700", "#ffb57d"),
41+
}
42+
43+
SYSTEM_INDICATOR_COLOR = "red"
44+
45+
SYSTEM_INDICATOR_EXCLUSIONS = []
46+
47+
48+
To exclude paths, include regex in ``SYSTEM_INDICATOR_EXCLUSIONS``
49+
50+
.. code-block::
51+
52+
import re
53+
54+
SYSTEM_INDICATOR_EXCLUSIONS = [
55+
re.compile("^/[^/]+/admin/.\*$"),
56+
]
57+
58+
Example of a localhost indicator in admin;
59+
60+
.. image:: https://django-sys-indicator.s3.eu-west-2.amazonaws.com/screenshots/indicator-admin-header.png
61+
:alt: system indicator admin example

0 commit comments

Comments
 (0)