Skip to content
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
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
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"
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](https://github.com/westerveltco/django-simple-nav/blob/main/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 -->
10 changes: 5 additions & 5 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,8 +134,7 @@ 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)
Expand All @@ -161,7 +161,7 @@ def demo(session):

@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
37 changes: 24 additions & 13 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ 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",
"Framework :: Django",
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,7 +33,7 @@ keywords = []
license = {file = "LICENSE"}
name = "django-simple-nav"
readme = "README.md"
requires-python = ">=3.8"
requires-python = ">=3.9"

[project.optional-dependencies]
docs = [
Expand Down Expand Up @@ -71,7 +72,6 @@ exclude = [
"**/__pycache__"
]
include = ["src"]
stubPath = "src/stubs"

[tool.bumpver]
commit = true
Expand All @@ -82,9 +82,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 +126,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 +140,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 Down Expand Up @@ -190,8 +201,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
12 changes: 2 additions & 10 deletions tests/test_conf.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,11 @@
from __future__ import annotations

import pytest
from django.conf import settings

from django_simple_nav.conf import DJANGO_SIMPLE_NAV_SETTINGS_NAME
from django_simple_nav.conf import app_settings


def test_default_settings():
user_settings = getattr(settings, DJANGO_SIMPLE_NAV_SETTINGS_NAME, {})

assert user_settings == {}


def test_app_settings():
# temporary until app actually has settings
# stub test until `django-simple-nav` requires custom app settings
with pytest.raises(AttributeError):
app_settings.FOO # noqa: B018
assert app_settings.foo
Loading
Loading