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

bump template to v2024.29 #136

Merged
merged 14 commits into from
Oct 10, 2024
3 changes: 1 addition & 2 deletions .copier/package.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Changes here will be overwritten by Copier; NEVER EDIT MANUALLY
_commit: v2024.27
_commit: v2024.29
_src_path: gh:westerveltco/django-twc-package
author_email: [email protected]
author_name: Josh Thomas
Expand All @@ -15,7 +15,6 @@ module_name: django_simple_nav
package_description: A simple, flexible, and extensible navigation menu for Django.
package_name: django-simple-nav
python_versions:
- '3.8'
- '3.9'
- '3.10'
- '3.11'
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ jobs:
uses: ./.github/workflows/test.yml

pypi:
if: ${{ github.event_name == 'release' }}
runs-on: ubuntu-latest
needs: test
environment: release
Expand Down
28 changes: 15 additions & 13 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ concurrency:
env:
PYTHONUNBUFFERED: "1"
FORCE_COLOR: "1"
PY_MAX_VERSION: "3.13"
PY_MIN_VERSION: "3.9"
UV_VERSION: "0.4.x"

jobs:
generate-matrix:
Expand All @@ -26,14 +29,12 @@ jobs:
uses: astral-sh/setup-uv@v3
with:
enable-cache: true
version: "0.4.x"
version: ${{ env.UV_VERSION }}

- name: Install Python
run: |
uv python install 3.10
run: uv python install ${{ env.PY_MIN_VERSION }}

- name: Generate matrix
id: set-matrix
- id: set-matrix
run: |
uv run nox --session "gha_matrix"

Expand All @@ -51,7 +52,7 @@ jobs:
uses: astral-sh/setup-uv@v3
with:
enable-cache: true
version: "0.4.x"
version: ${{ env.UV_VERSION }}

- name: Install Python
run: uv python install ${{ matrix.python-version }}
Expand All @@ -76,18 +77,16 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Install uv
uses: astral-sh/setup-uv@v3
with:
enable-cache: true
version: "0.4.x"
version: ${{ env.UV_VERSION }}

- name: Install Python
run: |
uv python install 3.13
run: uv python install ${{ env.PY_MAX_VERSION }}

- name: Run type checks
- name: Run mypy
run: |
uv run nox --session "types"

Expand All @@ -100,8 +99,11 @@ jobs:
uses: astral-sh/setup-uv@v3
with:
enable-cache: true
version: "0.4.x"
version: ${{ env.UV_VERSION }}

- name: Install Python
run: uv python install ${{ env.PY_MIN_VERSION }}

- name: Generate code coverage
- name: Run mypy
run: |
uv run nox --session "coverage"
3 changes: 0 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,3 @@ mediafiles/

# pyright config for nvim-lspconfig
pyrightconfig.json

# auto-generated apidocs
apidocs/
8 changes: 3 additions & 5 deletions RELEASING.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
# Releasing a New Version

<!-- releasing-start -->
When it comes time to cut a new release, follow these steps:

1. Create a new git branch off of `main` for the release.

Prefer the convention `release-<version>`, where `<version>` is the next incremental version number (e.g. `release-v0.2.0` for version 0.2.0).
Prefer the convention `release-<version>`, where `<version>` is the next incremental version number (e.g. `release-v0.11.0` for version 0.11.0).

```shell
git checkout -b release-v<version>
Expand Down Expand Up @@ -53,15 +52,15 @@ When it comes time to cut a new release, follow these steps:
bumpver update --tag=final
```

3. Ensure the [CHANGELOG](https://github.com/westerveltco/django-simple-nav/CHANGELOG.md) is up to date. If updates are needed, add them now in the release branch.
3. Ensure the [CHANGELOG](CHANGELOG.md) is up to date. If updates are needed, add them now in the release branch.

4. Create a pull request from the release branch to `main`.

5. Once CI has passed and all the checks are green ✅, merge the pull request.

6. Draft a [new release](https://github.com/westerveltco/django-simple-nav/releases/new) on GitHub.

Use the version number with a leading `v` as the tag name (e.g. `v0.2.0`).
Use the version number with a leading `v` as the tag name (e.g. `v0.11.0`).

Allow GitHub to generate the release title and release notes, using the 'Generate release notes' button above the text box. If this is a final release coming from a tagged release (or multiple tagged releases), make sure to copy the release notes from the previous tagged release(s) to the new release notes (after the release notes already generated for this final release).

Expand All @@ -74,4 +73,3 @@ When it comes time to cut a new release, follow these steps:
We try our best to adhere to [Semantic Versioning](https://semver.org/), but we do not promise to follow it perfectly (and let's be honest, this is the case with a lot of projects using SemVer).

In general, use your best judgement when choosing the next version number. If you are unsure, you can always ask for a second opinion from another contributor.
<!-- releasing-end -->
29 changes: 5 additions & 24 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,12 @@
nox.options.default_venv_backend = "uv|virtualenv"
nox.options.reuse_existing_virtualenvs = True

PY38 = "3.8"
PY39 = "3.9"
PY310 = "3.10"
PY311 = "3.11"
PY312 = "3.12"
PY313 = "3.13"
PY_VERSIONS = [PY38, PY39, PY310, PY311, PY312, PY313]
PY_VERSIONS = [PY39, PY310, PY311, PY312, PY313]
PY_DEFAULT = PY_VERSIONS[0]
PY_LATEST = PY_VERSIONS[-1]

Expand Down Expand Up @@ -104,6 +103,7 @@ def coverage(session):
"tests",
env={"UV_PROJECT_ENVIRONMENT": session.virtualenv.location},
)

try:
session.run("python", "-m", "pytest", "--cov", "--cov-report=")
finally:
Expand All @@ -112,6 +112,7 @@ def coverage(session):

if summary := os.getenv("GITHUB_STEP_SUMMARY"):
report_cmd.extend(["--skip-covered", "--skip-empty", "--format=markdown"])

with Path(summary).open("a") as output_buffer:
output_buffer.write("")
output_buffer.write("### Coverage\n\n")
Expand All @@ -133,35 +134,15 @@ def types(session):
"types",
env={"UV_PROJECT_ENVIRONMENT": session.virtualenv.location},
)

command = ["mypy", "."]
command = ["python", "-m", "mypy", "."]
if session.posargs and all(arg for arg in session.posargs):
command.append(*session.posargs)
session.run(*command)


@nox.session
def demo(session):
session.run_install(
"uv",
"sync",
"--frozen",
"--extra",
"types",
env={"UV_PROJECT_ENVIRONMENT": session.virtualenv.location},
)

command = ["python", "example/demo.py", "runserver"]
if session.posargs and all(arg for arg in session.posargs):
command.append(*session.posargs)
else:
command.append("localhost:8000")
session.run(*command)


@nox.session
def gha_matrix(session):
sessions = session.run("nox", "-l", "--json", silent=True)
sessions = session.run("python", "-m", "nox", "-l", "--json", silent=True)
matrix = {
"include": [
{
Expand Down
96 changes: 50 additions & 46 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@ build-backend = "hatchling.build"
requires = ["hatchling"]

[project]
authors = [{name = "Josh Thomas", email = "[email protected]"}]
authors = [
{name = "Josh Thomas", email = "[email protected]"}
]
classifiers = [
"Development Status :: 4 - Beta",
"Development Status :: 3 - Alpha",
"Framework :: Django",
"Framework :: Django :: 4.2",
"Framework :: Django :: 5.0",
Expand All @@ -15,7 +17,6 @@ classifiers = [
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
Expand All @@ -32,47 +33,39 @@ keywords = []
license = {file = "LICENSE"}
name = "django-simple-nav"
readme = "README.md"
requires-python = ">=3.8"
requires-python = ">=3.9"

[project.optional-dependencies]
docs = [
"cogapp>=3.4.1",
"furo>=2024.8.6",
"myst-parser>=3.0.1",
"sphinx>=7.1.2",
"sphinx-autobuild>=2021.3.14",
"sphinx-autodoc2>=0.5.0",
"sphinx-copybutton>=0.5.2",
"sphinx-inline-tabs>=2023.4.21"
"cogapp",
"furo",
"myst-parser",
"sphinx",
"sphinx-autobuild",
"sphinx-autodoc2",
"sphinx-copybutton",
"sphinx-inline-tabs"
]
tests = [
"faker>=30.3.0",
"model-bakery>=1.20.0",
"pytest>=8.3.3",
"pytest-cov>=5.0.0",
"pytest-django>=4.9.0",
"pytest-randomly>=3.15.0",
"pytest-xdist>=3.6.1"
"faker",
"model-bakery",
"pytest",
"pytest-cov",
"pytest-django",
"pytest-randomly",
"pytest-xdist"
]
types = [
"django-stubs>=5.1.0",
"django-stubs-ext>=5.1.0",
"mypy>=1.11.2"
"django-stubs",
"django-stubs-ext",
"mypy"
]

[project.urls]
Documentation = "https://django-simple-nav.westervelt.dev/"
Issues = "https://github.com/westerveltco/django-simple-nav/issues"
Source = "https://github.com/westerveltco/django-simple-nav"

[tool.basedpyright]
exclude = [
"**/node_modules",
"**/__pycache__"
]
include = ["src"]
stubPath = "src/stubs"

[tool.bumpver]
commit = true
commit_message = ":bookmark: bump version {old_version} -> {new_version}"
Expand All @@ -82,9 +75,15 @@ tag = false
version_pattern = "MAJOR.MINOR.PATCH[PYTAGNUM]"

[tool.bumpver.file_patterns]
".copier/package.yml" = ['current_version: {version}']
"src/django_simple_nav/__init__.py" = ['__version__ = "{version}"']
"tests/test_version.py" = ['assert __version__ == "{version}"']
".copier/package.yml" = [
'current_version: {version}'
]
"src/django_simple_nav/__init__.py" = [
'__version__ = "{version}"'
]
"tests/test_version.py" = [
'assert __version__ == "{version}"'
]

[tool.coverage.paths]
source = ["src"]
Expand Down Expand Up @@ -120,7 +119,10 @@ indent = 2
profile = "django"

[tool.hatch.build]
exclude = [".*", "Justfile"]
exclude = [
".*",
"Justfile"
]

[tool.hatch.build.targets.wheel]
packages = ["src/django_simple_nav"]
Expand All @@ -131,15 +133,17 @@ path = "src/django_simple_nav/__init__.py"
[tool.mypy]
check_untyped_defs = true
exclude = [
".venv",
"docs",
"migrations",
"tests",
"venv"
"venv",
".venv"
]
mypy_path = "src/"
no_implicit_optional = true
plugins = ["mypy_django_plugin.main"]
plugins = [
"mypy_django_plugin.main"
]
warn_redundant_casts = true
warn_unused_configs = true
warn_unused_ignores = true
Expand All @@ -159,7 +163,7 @@ ignore_missing_model_attributes = true
[tool.pytest.ini_options]
addopts = "--create-db -n auto --dist loadfile --doctest-modules"
django_find_project = false
norecursedirs = ".* bin build dist *.egg example htmlcov logs node_modules templates venv"
norecursedirs = ".* bin build dist *.egg htmlcov logs node_modules templates venv"
python_files = "tests.py test_*.py *_tests.py"
pythonpath = "src"
testpaths = ["tests"]
Expand Down Expand Up @@ -190,8 +194,8 @@ extend-include = ["*.pyi?"]
indent-width = 4
# Same as Black.
line-length = 88
# Assume Python >3.8
target-version = "py38"
# Assume Python >3.9
target-version = "py39"

[tool.ruff.format]
# Like Black, indent with spaces, rather than tabs.
Expand Down Expand Up @@ -231,10 +235,10 @@ keep-runtime-typing = true

[tool.uv]
dev-dependencies = [
"copier>=9.3.1",
"copier-templates-extensions>=0.3.0",
"django-stubs>=5.1.0",
"django-stubs-ext>=5.1.0",
"nox[uv]>=2024.10.9",
"ruff>=0.6.9"
"copier",
"copier-templates-extensions",
"django-stubs",
"django-stubs-ext",
"nox[uv]",
"ruff"
]
Loading
Loading