Skip to content

V2.x.x #88

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

Merged
merged 36 commits into from
Feb 24, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
913f2f6
modernize pyproject.toml, switch from check.sh->justfile, remove supp…
bckohan Feb 20, 2025
57b16e0
use sqlite on linting
bckohan Feb 20, 2025
c3914f4
try fix CI
bckohan Feb 20, 2025
1a13799
try fix postgres CI
bckohan Feb 20, 2025
5028967
try fix postgres CI
bckohan Feb 20, 2025
9384bca
move environment tests into test case
bckohan Feb 20, 2025
6a3e75a
try fix CI and coverage
bckohan Feb 20, 2025
55c178e
update verify env
bckohan Feb 20, 2025
9f51009
fix CI tests
bckohan Feb 20, 2025
fcafb45
try fix CI
bckohan Feb 20, 2025
fb2ffa0
pin-dependency -> lock
bckohan Feb 21, 2025
7461321
try lock test dependencies
bckohan Feb 21, 2025
35a19fc
fix linting
bckohan Feb 21, 2025
a3a746e
fix test-lock
bckohan Feb 21, 2025
2abac67
fix errant python version restriction
bckohan Feb 21, 2025
684bc17
fix broken django version range
bckohan Feb 21, 2025
37f0054
try fix tests
bckohan Feb 21, 2025
c60b748
try fix tests
bckohan Feb 21, 2025
5e86cc0
add windows and macos runs in CI #85 #86
bckohan Feb 21, 2025
e4e1f7d
fix test-lock on windows, update changelog, reduce matrix for windows…
bckohan Feb 21, 2025
e8be728
fix test-lock
bckohan Feb 21, 2025
35afd1a
try fix CI
bckohan Feb 21, 2025
b1f0d7b
try fix CI
bckohan Feb 21, 2025
3ee795f
fix test-all on windows
bckohan Feb 21, 2025
a69faf8
fix windows tests
bckohan Feb 21, 2025
02e555b
stub out a release workflow
bckohan Feb 21, 2025
b7d012f
switch to uv #87
bckohan Feb 22, 2025
dec2bda
try fix CI
bckohan Feb 23, 2025
4c4cf3a
try fix CI
bckohan Feb 23, 2025
720a1c8
try fix CI
bckohan Feb 23, 2025
eb6a992
fix CI
bckohan Feb 23, 2025
97b2607
try fix CI
bckohan Feb 23, 2025
d9823d4
try fix CI
bckohan Feb 23, 2025
ea9cc38
change when verify environment is run
bckohan Feb 23, 2025
a3dc55a
fix linting
bckohan Feb 23, 2025
068fdaa
update actions
bckohan Feb 24, 2025
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
7 changes: 7 additions & 0 deletions .codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# https://github.com/codecov/codecov-python/issues/136
coverage:
fixes:
- "__init__.py::django_enum/__init__.py"
- "utils.py::django_enum/utils.py"
- "forms.py::django_enum/forms.py"
- "urls.py::django_enum/urls.py"
131 changes: 131 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
# Set the default behavior, in case people don't have core.autocrlf set.
* text=auto

# Explicitly declare text files you want to always be normalized and converted
# to native line endings on checkout.



# Source files
# ============
*.pxd text diff=python
*.py text diff=python
*.py3 text diff=python
*.pyw text diff=python
*.pyx text diff=python
*.pyz text diff=python
*.pyi text diff=python
*.rst text
*.md text
justfile text
*.toml text
LICENSE text
*.yaml text
*.yml text
*.po text
*.tmpl text
*.json text
*.xml text

# powershell
# ============
*.ps1 text eol=crlf
*.ps1x text eol=crlf
*.psm1 text eol=crlf
*.psd1 text eol=crlf
*.ps1xml text eol=crlf
*.pssc text eol=crlf
*.psrc text eol=crlf
*.cdxml text eol=crlf

# Jupyter notebook
*.ipynb text eol=lf

# Declare files that will always have CRLF line endings on checkout.
django_typer/management/commands/shells/powershell.tmpl text eol=crlf

# Binary files
# ============
*.db binary
*.p binary
*.pkl binary
*.pickle binary
*.pyc binary export-ignore
*.pyo binary export-ignore
*.pyd binary
*.png binary
*.jpg binary
*.pdf binary
*.svg binary
*.drawio binary
*.gif binary
*.mo binary
*.jpeg binary
*.tif binary
*.tiff binary
*.ico binary
*.eps binary

# Documents
*.bibtex text diff=bibtex
*.doc diff=astextplain
*.DOC diff=astextplain
*.docx diff=astextplain
*.DOCX diff=astextplain
*.dot diff=astextplain
*.DOT diff=astextplain
*.pdf diff=astextplain
*.PDF diff=astextplain
*.rtf diff=astextplain
*.RTF diff=astextplain
*.md text diff=markdown
*.mdx text diff=markdown
*.tex text diff=tex
*.adoc text
*.textile text
*.mustache text
*.csv text eol=crlf
*.tab text
*.tsv text
*.txt text
*.sql text
*.epub diff=astextplain

# Scripts
*.bash text eol=lf
*.fish text eol=lf
*.ksh text eol=lf
*.sh text eol=lf
*.zsh text eol=lf
# These are explicitly windows files and should use crlf
*.bat text eol=crlf
*.cmd text eol=crlf
*.ps1 text eol=crlf

# Archives
*.7z binary
*.bz binary
*.bz2 binary
*.bzip2 binary
*.gz binary
*.lz binary
*.lzma binary
*.rar binary
*.tar binary
*.taz binary
*.tbz binary
*.tbz2 binary
*.tgz binary
*.tlz binary
*.txz binary
*.xz binary
*.Z binary
*.zip binary
*.zst binary

# Text files where line endings should be preserved
*.patch -text

.gitattributes export-ignore
.gitignore export-ignore
.gitkeep export-ignore
77 changes: 54 additions & 23 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -1,50 +1,81 @@
name: lint

on: [push, pull_request, workflow_dispatch]
permissions: read-all

on:
push:
pull_request:
workflow_call:
workflow_dispatch:
inputs:
debug:
description: 'Open ssh debug session.'
required: true
default: false
type: boolean

jobs:

static-analysis:
lint:
runs-on: ubuntu-latest
strategy:
matrix:
# run static analysis on bleeding and trailing edges
python-version: [ '3.9', '3.13' ]
django-version:
- '3.2' # LTS April 2024
- '4.2' # LTS April 2026
- '5.0' # April 2025
- '5.1' # December 2025
exclude:
- python-version: '3.9'
django-version: '5.1'
- python-version: '3.13'
django-version: '4.2'
- python-version: '3.9'
django-version: '5.0'
- python-version: '3.13'
django-version: '3.2'
- python-version: '3.9'
django-version: '5.1'

env:
RDBMS: sqlite
TEST_PYTHON_VERSION: ${{ matrix.python-version }}
TEST_DJANGO_VERSION: ${{ matrix.django-version }}

steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
id: sp
with:
python-version: ${{ matrix.python-version }}

- name: Install Poetry
run: |
pip install pipx
pipx ensurepath
pipx install poetry
poetry config --local virtualenvs.create true
poetry config --local virtualenvs.in-project true
poetry env use python
- name: Install uv
uses: astral-sh/setup-uv@v5
with:
enable-cache: true
- name: Install Just
uses: extractions/setup-just@v2
- name: Install Dependencies
run: |
poetry config virtualenvs.in-project true
poetry run pip install --upgrade pip
sed -i 's/^python = .*/python = "^${{ matrix.python-version }}"/' pyproject.toml
poetry add django@^${{ matrix.django-version }}
poetry install --no-interaction -E all --with psycopg2

just setup ${{ steps.sp.outputs.python-path }}
just test-lock Django~=${{ matrix.django-version }}.0
just install-docs
- name: Install Emacs
if: ${{ github.event.inputs.debug == 'true' }}
run: |
sudo apt install emacs
- name: Setup tmate session
if: ${{ github.event.inputs.debug == 'true' }}
uses: mxschmitt/[email protected]
with:
detached: true
timeout-minutes: 60
- name: Run Static Analysis
run: |
source .venv/bin/activate
./check.sh --no-fix
python -m readme_renderer ./README.md -o /tmp/README.html
echo "$(poetry env info --path)/bin" >> $GITHUB_PATH
just manage makemigrations
just test ./tests/test_verify_environment.py
just check-lint
just check-format
just check-types
just check-package
just check-readme
153 changes: 153 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,153 @@

name: Publish Release

permissions: read-all

on:
push:
tags:
- 'v*' # only publish on version tags (e.g. v1.0.0)

jobs:

lint:
uses: ./.github/workflows/lint.yml
secrets: inherit

test:
uses: ./.github/workflows/test.yml
secrets: inherit

build:
name: Build Package
runs-on: ubuntu-latest
permissions:
actions: write
outputs:
PACKAGE_NAME: ${{ steps.set-package.outputs.package_name }}
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ">=3.11" # for tomlib
- name: Verify Tag Signature
run: |
TAG_NAME=${GITHUB_REF#refs/tags/}
echo "Verifying tag $TAG_NAME..."
git tag -v "$TAG_NAME"
- name: Install pypa/build
run:
python3 -m pip install build --user
- name: Build a binary wheel and a source tarball
run: python3 -m build
- name: Store the distribution packages
uses: actions/upload-artifact@v4
with:
name: python-package-distributions
path: dist/
- name: Set Package Name
id: set-package
run:
PACKAGE_NAME=$(python -c "import tomllib; print(tomllib.load(open('pyproject.toml', 'rb'))['project']['name'])")
echo "PACKAGE_NAME=${PACKAGE_NAME}" >> $GITHUB_ENV

publish-to-pypi:
name: Publish to PyPI
needs:
- lint
- test
- build
- publish-to-testpypi
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/${{ needs.build.outputs.PACKAGE_NAME }}
permissions:
id-token: write # IMPORTANT: mandatory for trusted publishing
steps:
- name: Download all the dists
uses: actions/download-artifact@v4
with:
name: python-package-distributions
path: dist/
- name: Publish distribution 📦 to PyPI
uses: pypa/gh-action-pypi-publish@release/v1.12

github-release:
name: Publish GitHub Release
runs-on: ubuntu-latest
needs:
- lint
- test
- build
permissions:
contents: write # IMPORTANT: mandatory for making GitHub Releases
id-token: write # IMPORTANT: mandatory for sigstore

steps:
- name: Download all the dists
uses: actions/download-artifact@v4
with:
name: python-package-distributions
path: dist/
- name: Sign the dists with Sigstore
uses: sigstore/[email protected]
with:
inputs: >-
./dist/*.tar.gz
./dist/*.whl
- name: Create GitHub Release
env:
GITHUB_TOKEN: ${{ github.token }}
run: >-
gh release create
'${{ github.ref_name }}'
--repo '${{ github.repository }}'
--generate-notes
- name: Upload artifact signatures to GitHub Release
env:
GITHUB_TOKEN: ${{ github.token }}
# Upload to GitHub Release using the `gh` CLI.
# `dist/` contains the built packages, and the
# sigstore-produced signatures and certificates.
run: >-
gh release upload
'${{ github.ref_name }}' dist/**
--repo '${{ github.repository }}'

publish-to-testpypi:
name: Publish to TestPyPI
needs:
- build
runs-on: ubuntu-latest

environment:
name: testpypi
url: https://test.pypi.org/project/${{ needs.build.outputs.PACKAGE_NAME }}

permissions:
id-token: write # IMPORTANT: mandatory for trusted publishing

steps:
- name: Download all the dists
uses: actions/download-artifact@v4
with:
name: python-package-distributions
path: dist/
- name: Publish distribution 📦 to TestPyPI
uses: pypa/gh-action-pypi-publish@release/v1.12
with:
repository-url: https://test.pypi.org/legacy/
skip-existing: true

# TODO fetch-data requires login
# notify-django-packages:
# name: Notify Django Packages
# runs-on: ubuntu-latest
# needs:
# - publish-to-pypi
# steps:
# - name: Notify Django Packages
# run:
# curl -X GET "https://djangopackages.org/packages/django-typer/fetch-data/"
Loading
Loading