Skip to content

Commit 3f4ef88

Browse files
authored
Merge pull request #88 from bckohan/v2.x.x
V2.x.x
2 parents d5cafd3 + 068fdaa commit 3f4ef88

34 files changed

+4014
-450
lines changed

.codecov.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# https://github.com/codecov/codecov-python/issues/136
2+
coverage:
3+
fixes:
4+
- "__init__.py::django_enum/__init__.py"
5+
- "utils.py::django_enum/utils.py"
6+
- "forms.py::django_enum/forms.py"
7+
- "urls.py::django_enum/urls.py"

.gitattributes

Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
# Set the default behavior, in case people don't have core.autocrlf set.
2+
* text=auto
3+
4+
# Explicitly declare text files you want to always be normalized and converted
5+
# to native line endings on checkout.
6+
7+
8+
9+
# Source files
10+
# ============
11+
*.pxd text diff=python
12+
*.py text diff=python
13+
*.py3 text diff=python
14+
*.pyw text diff=python
15+
*.pyx text diff=python
16+
*.pyz text diff=python
17+
*.pyi text diff=python
18+
*.rst text
19+
*.md text
20+
justfile text
21+
*.toml text
22+
LICENSE text
23+
*.yaml text
24+
*.yml text
25+
*.po text
26+
*.tmpl text
27+
*.json text
28+
*.xml text
29+
30+
# powershell
31+
# ============
32+
*.ps1 text eol=crlf
33+
*.ps1x text eol=crlf
34+
*.psm1 text eol=crlf
35+
*.psd1 text eol=crlf
36+
*.ps1xml text eol=crlf
37+
*.pssc text eol=crlf
38+
*.psrc text eol=crlf
39+
*.cdxml text eol=crlf
40+
41+
# Jupyter notebook
42+
*.ipynb text eol=lf
43+
44+
# Declare files that will always have CRLF line endings on checkout.
45+
django_typer/management/commands/shells/powershell.tmpl text eol=crlf
46+
47+
# Binary files
48+
# ============
49+
*.db binary
50+
*.p binary
51+
*.pkl binary
52+
*.pickle binary
53+
*.pyc binary export-ignore
54+
*.pyo binary export-ignore
55+
*.pyd binary
56+
*.png binary
57+
*.jpg binary
58+
*.pdf binary
59+
*.svg binary
60+
*.drawio binary
61+
*.gif binary
62+
*.mo binary
63+
*.jpeg binary
64+
*.tif binary
65+
*.tiff binary
66+
*.ico binary
67+
*.eps binary
68+
69+
# Documents
70+
*.bibtex text diff=bibtex
71+
*.doc diff=astextplain
72+
*.DOC diff=astextplain
73+
*.docx diff=astextplain
74+
*.DOCX diff=astextplain
75+
*.dot diff=astextplain
76+
*.DOT diff=astextplain
77+
*.pdf diff=astextplain
78+
*.PDF diff=astextplain
79+
*.rtf diff=astextplain
80+
*.RTF diff=astextplain
81+
*.md text diff=markdown
82+
*.mdx text diff=markdown
83+
*.tex text diff=tex
84+
*.adoc text
85+
*.textile text
86+
*.mustache text
87+
*.csv text eol=crlf
88+
*.tab text
89+
*.tsv text
90+
*.txt text
91+
*.sql text
92+
*.epub diff=astextplain
93+
94+
# Scripts
95+
*.bash text eol=lf
96+
*.fish text eol=lf
97+
*.ksh text eol=lf
98+
*.sh text eol=lf
99+
*.zsh text eol=lf
100+
# These are explicitly windows files and should use crlf
101+
*.bat text eol=crlf
102+
*.cmd text eol=crlf
103+
*.ps1 text eol=crlf
104+
105+
# Archives
106+
*.7z binary
107+
*.bz binary
108+
*.bz2 binary
109+
*.bzip2 binary
110+
*.gz binary
111+
*.lz binary
112+
*.lzma binary
113+
*.rar binary
114+
*.tar binary
115+
*.taz binary
116+
*.tbz binary
117+
*.tbz2 binary
118+
*.tgz binary
119+
*.tlz binary
120+
*.txz binary
121+
*.xz binary
122+
*.Z binary
123+
*.zip binary
124+
*.zst binary
125+
126+
# Text files where line endings should be preserved
127+
*.patch -text
128+
129+
.gitattributes export-ignore
130+
.gitignore export-ignore
131+
.gitkeep export-ignore

.github/workflows/lint.yml

Lines changed: 54 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,81 @@
11
name: lint
22

3-
on: [push, pull_request, workflow_dispatch]
3+
permissions: read-all
4+
5+
on:
6+
push:
7+
pull_request:
8+
workflow_call:
9+
workflow_dispatch:
10+
inputs:
11+
debug:
12+
description: 'Open ssh debug session.'
13+
required: true
14+
default: false
15+
type: boolean
416

517
jobs:
618

7-
static-analysis:
19+
lint:
820
runs-on: ubuntu-latest
921
strategy:
1022
matrix:
1123
# run static analysis on bleeding and trailing edges
1224
python-version: [ '3.9', '3.13' ]
1325
django-version:
26+
- '3.2' # LTS April 2024
1427
- '4.2' # LTS April 2026
28+
- '5.0' # April 2025
1529
- '5.1' # December 2025
1630
exclude:
1731
- python-version: '3.9'
18-
django-version: '5.1'
19-
- python-version: '3.13'
2032
django-version: '4.2'
33+
- python-version: '3.9'
34+
django-version: '5.0'
35+
- python-version: '3.13'
36+
django-version: '3.2'
37+
- python-version: '3.9'
38+
django-version: '5.1'
39+
40+
env:
41+
RDBMS: sqlite
42+
TEST_PYTHON_VERSION: ${{ matrix.python-version }}
43+
TEST_DJANGO_VERSION: ${{ matrix.django-version }}
2144

2245
steps:
2346
- uses: actions/checkout@v4
2447
- name: Set up Python ${{ matrix.python-version }}
2548
uses: actions/setup-python@v5
49+
id: sp
2650
with:
2751
python-version: ${{ matrix.python-version }}
28-
29-
- name: Install Poetry
30-
run: |
31-
pip install pipx
32-
pipx ensurepath
33-
pipx install poetry
34-
poetry config --local virtualenvs.create true
35-
poetry config --local virtualenvs.in-project true
36-
poetry env use python
52+
- name: Install uv
53+
uses: astral-sh/setup-uv@v5
54+
with:
55+
enable-cache: true
56+
- name: Install Just
57+
uses: extractions/setup-just@v2
3758
- name: Install Dependencies
3859
run: |
39-
poetry config virtualenvs.in-project true
40-
poetry run pip install --upgrade pip
41-
sed -i 's/^python = .*/python = "^${{ matrix.python-version }}"/' pyproject.toml
42-
poetry add django@^${{ matrix.django-version }}
43-
poetry install --no-interaction -E all --with psycopg2
44-
60+
just setup ${{ steps.sp.outputs.python-path }}
61+
just test-lock Django~=${{ matrix.django-version }}.0
62+
just install-docs
63+
- name: Install Emacs
64+
if: ${{ github.event.inputs.debug == 'true' }}
65+
run: |
66+
sudo apt install emacs
67+
- name: Setup tmate session
68+
if: ${{ github.event.inputs.debug == 'true' }}
69+
uses: mxschmitt/[email protected]
70+
with:
71+
detached: true
72+
timeout-minutes: 60
4573
- name: Run Static Analysis
4674
run: |
47-
source .venv/bin/activate
48-
./check.sh --no-fix
49-
python -m readme_renderer ./README.md -o /tmp/README.html
50-
echo "$(poetry env info --path)/bin" >> $GITHUB_PATH
75+
just manage makemigrations
76+
just test ./tests/test_verify_environment.py
77+
just check-lint
78+
just check-format
79+
just check-types
80+
just check-package
81+
just check-readme

.github/workflows/release.yml

Lines changed: 153 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,153 @@
1+
2+
name: Publish Release
3+
4+
permissions: read-all
5+
6+
on:
7+
push:
8+
tags:
9+
- 'v*' # only publish on version tags (e.g. v1.0.0)
10+
11+
jobs:
12+
13+
lint:
14+
uses: ./.github/workflows/lint.yml
15+
secrets: inherit
16+
17+
test:
18+
uses: ./.github/workflows/test.yml
19+
secrets: inherit
20+
21+
build:
22+
name: Build Package
23+
runs-on: ubuntu-latest
24+
permissions:
25+
actions: write
26+
outputs:
27+
PACKAGE_NAME: ${{ steps.set-package.outputs.package_name }}
28+
steps:
29+
- uses: actions/checkout@v4
30+
- name: Set up Python
31+
uses: actions/setup-python@v5
32+
with:
33+
python-version: ">=3.11" # for tomlib
34+
- name: Verify Tag Signature
35+
run: |
36+
TAG_NAME=${GITHUB_REF#refs/tags/}
37+
echo "Verifying tag $TAG_NAME..."
38+
git tag -v "$TAG_NAME"
39+
- name: Install pypa/build
40+
run:
41+
python3 -m pip install build --user
42+
- name: Build a binary wheel and a source tarball
43+
run: python3 -m build
44+
- name: Store the distribution packages
45+
uses: actions/upload-artifact@v4
46+
with:
47+
name: python-package-distributions
48+
path: dist/
49+
- name: Set Package Name
50+
id: set-package
51+
run:
52+
PACKAGE_NAME=$(python -c "import tomllib; print(tomllib.load(open('pyproject.toml', 'rb'))['project']['name'])")
53+
echo "PACKAGE_NAME=${PACKAGE_NAME}" >> $GITHUB_ENV
54+
55+
publish-to-pypi:
56+
name: Publish to PyPI
57+
needs:
58+
- lint
59+
- test
60+
- build
61+
- publish-to-testpypi
62+
runs-on: ubuntu-latest
63+
environment:
64+
name: pypi
65+
url: https://pypi.org/p/${{ needs.build.outputs.PACKAGE_NAME }}
66+
permissions:
67+
id-token: write # IMPORTANT: mandatory for trusted publishing
68+
steps:
69+
- name: Download all the dists
70+
uses: actions/download-artifact@v4
71+
with:
72+
name: python-package-distributions
73+
path: dist/
74+
- name: Publish distribution 📦 to PyPI
75+
uses: pypa/gh-action-pypi-publish@release/v1.12
76+
77+
github-release:
78+
name: Publish GitHub Release
79+
runs-on: ubuntu-latest
80+
needs:
81+
- lint
82+
- test
83+
- build
84+
permissions:
85+
contents: write # IMPORTANT: mandatory for making GitHub Releases
86+
id-token: write # IMPORTANT: mandatory for sigstore
87+
88+
steps:
89+
- name: Download all the dists
90+
uses: actions/download-artifact@v4
91+
with:
92+
name: python-package-distributions
93+
path: dist/
94+
- name: Sign the dists with Sigstore
95+
uses: sigstore/[email protected]
96+
with:
97+
inputs: >-
98+
./dist/*.tar.gz
99+
./dist/*.whl
100+
- name: Create GitHub Release
101+
env:
102+
GITHUB_TOKEN: ${{ github.token }}
103+
run: >-
104+
gh release create
105+
'${{ github.ref_name }}'
106+
--repo '${{ github.repository }}'
107+
--generate-notes
108+
- name: Upload artifact signatures to GitHub Release
109+
env:
110+
GITHUB_TOKEN: ${{ github.token }}
111+
# Upload to GitHub Release using the `gh` CLI.
112+
# `dist/` contains the built packages, and the
113+
# sigstore-produced signatures and certificates.
114+
run: >-
115+
gh release upload
116+
'${{ github.ref_name }}' dist/**
117+
--repo '${{ github.repository }}'
118+
119+
publish-to-testpypi:
120+
name: Publish to TestPyPI
121+
needs:
122+
- build
123+
runs-on: ubuntu-latest
124+
125+
environment:
126+
name: testpypi
127+
url: https://test.pypi.org/project/${{ needs.build.outputs.PACKAGE_NAME }}
128+
129+
permissions:
130+
id-token: write # IMPORTANT: mandatory for trusted publishing
131+
132+
steps:
133+
- name: Download all the dists
134+
uses: actions/download-artifact@v4
135+
with:
136+
name: python-package-distributions
137+
path: dist/
138+
- name: Publish distribution 📦 to TestPyPI
139+
uses: pypa/gh-action-pypi-publish@release/v1.12
140+
with:
141+
repository-url: https://test.pypi.org/legacy/
142+
skip-existing: true
143+
144+
# TODO fetch-data requires login
145+
# notify-django-packages:
146+
# name: Notify Django Packages
147+
# runs-on: ubuntu-latest
148+
# needs:
149+
# - publish-to-pypi
150+
# steps:
151+
# - name: Notify Django Packages
152+
# run:
153+
# curl -X GET "https://djangopackages.org/packages/django-typer/fetch-data/"

0 commit comments

Comments
 (0)