use cog to automatically generate Python and Django versions (#96)

This commit is contained in:
Josh Thomas 2025-04-21 12:09:30 -05:00 committed by GitHub
parent df3f6f31fa
commit e6bde2d7aa
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 92 additions and 4 deletions

View file

@ -7,3 +7,45 @@ You should first check if there is a [GitHub issue](https://github.com/joshuadav
Not all contributions need to start with an issue, such as typo fixes in documentation or version bumps to Python or Django that require no internal code changes, but generally, it is a good idea to open an issue first.
We adhere to Django's Code of Conduct in all interactions and expect all contributors to do the same. Please read the [Code of Conduct](https://www.djangoproject.com/conduct/) before contributing.
### `Justfile`
The repository includes a [`Justfile`](./Justfile) that provides all common development tasks with a consistent interface. Running `just` without arguments shows all available commands and their descriptions.
<!-- [[[cog
import subprocess
import cog
output_raw = subprocess.run(["just", "--list", "--list-submodules"], stdout=subprocess.PIPE)
output_list = output_raw.stdout.decode("utf-8").split("\n")
cog.outl("""\
```bash
$ just
$ # just --list --list-submodules
""")
for i, line in enumerate(output_list):
if not line:
continue
cog.out(line)
if i < len(output_list):
cog.out("\n")
cog.out("```")
]]] -->
```bash
$ just
$ # just --list --list-submodules
Available recipes:
bumpver *ARGS
clean
lint # run pre-commit on all files
test *ARGS
testall *ARGS
docs:
build LOCATION="site" # Build documentation
serve PORT="8000" # Serve documentation locally
```
<!-- [[[end]]] -->

View file

@ -8,6 +8,10 @@ mod docs ".just/docs.just"
default:
@just --list
[private]
cog:
uv run --with cogapp --with nox --no-project cog -r CONTRIBUTING.md README.md pyproject.toml
[private]
nox SESSION *ARGS:
uv run noxfile.py --session "{{ SESSION }}" -- "{{ ARGS }}"

View file

@ -1,11 +1,20 @@
# django-language-server
<!-- [[[cog
import subprocess
import cog
from noxfile import DJ_VERSIONS
from noxfile import PY_VERSIONS
cog.outl("[![PyPI](https://img.shields.io/pypi/v/django-language-server)](https://pypi.org/project/django-language-server/)")
cog.outl("![PyPI - Python Version](https://img.shields.io/pypi/pyversions/django-language-server)")
cog.outl(f"![Django Version](https://img.shields.io/badge/django-{'%20%7C%20'.join(DJ_VERSIONS)}-%2344B78B?labelColor=%23092E20)")
]]] -->
[![PyPI](https://img.shields.io/pypi/v/django-language-server)](https://pypi.org/project/django-language-server/)
![PyPI - Python Version](https://img.shields.io/pypi/pyversions/django-language-server)
![Django Version](https://img.shields.io/badge/django-4.2%20%7C%205.0%20%7C%205.1-%2344B78B?labelColor=%23092E20)
<!-- https://shields.io/badges -->
<!-- django-4.2 | 5.0 | 5.1-#44B78B -->
<!-- labelColor=%23092E20 -->
![Django Version](https://img.shields.io/badge/django-4.2%20%7C%205.0%20%7C%205.1%20%7C%20main-%2344B78B?labelColor=%23092E20)
<!-- [[[end]]] -->
A language server for the Django web framework.
@ -46,8 +55,19 @@ An editor that supports the Language Server Protocol (LSP) is required.
The Django Language Server aims to supports all actively maintained versions of Python and Django. Currently this includes:
<!-- [[[cog
import subprocess
import cog
from noxfile import DJ_VERSIONS
from noxfile import PY_VERSIONS
cog.outl(f"- Python {', '.join([version for version in PY_VERSIONS])}")
cog.outl(f"- Django {', '.join([version for version in DJ_VERSIONS if version != 'main'])}")
]]] -->
- Python 3.9, 3.10, 3.11, 3.12, 3.13
- Django 4.2, 5.0, 5.1
<!-- [[[end]]] -->
See the [Versioning](#versioning) section for details on how this project's version indicates Django compatibility.

View file

@ -24,20 +24,42 @@ requires-python = ">=3.9"
classifiers = [
"Development Status :: 3 - Alpha",
"Framework :: Django",
# [[[cog
# import subprocess
# import cog
#
# from noxfile import DJ_VERSIONS
#
# for version in DJ_VERSIONS:
# if version == "main":
# continue
# cog.outl(f' "Framework :: Django :: {version}",')
# ]]] -->
"Framework :: Django :: 4.2",
"Framework :: Django :: 5.0",
"Framework :: Django :: 5.1",
# [[[end]]]
"Intended Audience :: Developers",
"License :: OSI Approved :: Apache Software License",
"Operating System :: OS Independent",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3 :: Only",
# [[[cog
# import subprocess
# import cog
#
# from noxfile import PY_VERSIONS
#
# for version in PY_VERSIONS:
# cog.outl(f' "Programming Language :: Python :: {version}",')
# ]]] -->
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
# [[[end]]]
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Rust",
"Topic :: Software Development",