Skip to content

Commit e6bde2d

Browse files
use cog to automatically generate Python and Django versions (#96)
1 parent df3f6f3 commit e6bde2d

File tree

4 files changed

+92
-4
lines changed

4 files changed

+92
-4
lines changed

CONTRIBUTING.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,45 @@ You should first check if there is a [GitHub issue](https://github.com/joshuadav
77
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.
88

99
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.
10+
11+
### `Justfile`
12+
13+
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.
14+
15+
<!-- [[[cog
16+
import subprocess
17+
import cog
18+
19+
output_raw = subprocess.run(["just", "--list", "--list-submodules"], stdout=subprocess.PIPE)
20+
output_list = output_raw.stdout.decode("utf-8").split("\n")
21+
22+
cog.outl("""\
23+
```bash
24+
$ just
25+
$ # just --list --list-submodules
26+
""")
27+
28+
for i, line in enumerate(output_list):
29+
if not line:
30+
continue
31+
cog.out(line)
32+
if i < len(output_list):
33+
cog.out("\n")
34+
35+
cog.out("```")
36+
]]] -->
37+
```bash
38+
$ just
39+
$ # just --list --list-submodules
40+
41+
Available recipes:
42+
bumpver *ARGS
43+
clean
44+
lint # run pre-commit on all files
45+
test *ARGS
46+
testall *ARGS
47+
docs:
48+
build LOCATION="site" # Build documentation
49+
serve PORT="8000" # Serve documentation locally
50+
```
51+
<!-- [[[end]]] -->

Justfile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ mod docs ".just/docs.just"
88
default:
99
@just --list
1010

11+
[private]
12+
cog:
13+
uv run --with cogapp --with nox --no-project cog -r CONTRIBUTING.md README.md pyproject.toml
14+
1115
[private]
1216
nox SESSION *ARGS:
1317
uv run noxfile.py --session "{{ SESSION }}" -- "{{ ARGS }}"

README.md

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,20 @@
11
# django-language-server
22

3+
<!-- [[[cog
4+
import subprocess
5+
import cog
6+
7+
from noxfile import DJ_VERSIONS
8+
from noxfile import PY_VERSIONS
9+
10+
cog.outl("[![PyPI](https://img.shields.io/pypi/v/django-language-server)](https://pypi.org/project/django-language-server/)")
11+
cog.outl("![PyPI - Python Version](https://img.shields.io/pypi/pyversions/django-language-server)")
12+
cog.outl(f"![Django Version](https://img.shields.io/badge/django-{'%20%7C%20'.join(DJ_VERSIONS)}-%2344B78B?labelColor=%23092E20)")
13+
]]] -->
314
[![PyPI](https://img.shields.io/pypi/v/django-language-server)](https://pypi.org/project/django-language-server/)
415
![PyPI - Python Version](https://img.shields.io/pypi/pyversions/django-language-server)
5-
![Django Version](https://img.shields.io/badge/django-4.2%20%7C%205.0%20%7C%205.1-%2344B78B?labelColor=%23092E20)
6-
<!-- https://shields.io/badges -->
7-
<!-- django-4.2 | 5.0 | 5.1-#44B78B -->
8-
<!-- labelColor=%23092E20 -->
16+
![Django Version](https://img.shields.io/badge/django-4.2%20%7C%205.0%20%7C%205.1%20%7C%20main-%2344B78B?labelColor=%23092E20)
17+
<!-- [[[end]]] -->
918

1019
A language server for the Django web framework.
1120

@@ -46,8 +55,19 @@ An editor that supports the Language Server Protocol (LSP) is required.
4655

4756
The Django Language Server aims to supports all actively maintained versions of Python and Django. Currently this includes:
4857

58+
<!-- [[[cog
59+
import subprocess
60+
import cog
61+
62+
from noxfile import DJ_VERSIONS
63+
from noxfile import PY_VERSIONS
64+
65+
cog.outl(f"- Python {', '.join([version for version in PY_VERSIONS])}")
66+
cog.outl(f"- Django {', '.join([version for version in DJ_VERSIONS if version != 'main'])}")
67+
]]] -->
4968
- Python 3.9, 3.10, 3.11, 3.12, 3.13
5069
- Django 4.2, 5.0, 5.1
70+
<!-- [[[end]]] -->
5171

5272
See the [Versioning](#versioning) section for details on how this project's version indicates Django compatibility.
5373

pyproject.toml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,20 +24,42 @@ requires-python = ">=3.9"
2424
classifiers = [
2525
"Development Status :: 3 - Alpha",
2626
"Framework :: Django",
27+
# [[[cog
28+
# import subprocess
29+
# import cog
30+
#
31+
# from noxfile import DJ_VERSIONS
32+
#
33+
# for version in DJ_VERSIONS:
34+
# if version == "main":
35+
# continue
36+
# cog.outl(f' "Framework :: Django :: {version}",')
37+
# ]]] -->
2738
"Framework :: Django :: 4.2",
2839
"Framework :: Django :: 5.0",
2940
"Framework :: Django :: 5.1",
41+
# [[[end]]]
3042
"Intended Audience :: Developers",
3143
"License :: OSI Approved :: Apache Software License",
3244
"Operating System :: OS Independent",
3345
"Programming Language :: Python",
3446
"Programming Language :: Python :: 3",
3547
"Programming Language :: Python :: 3 :: Only",
48+
# [[[cog
49+
# import subprocess
50+
# import cog
51+
#
52+
# from noxfile import PY_VERSIONS
53+
#
54+
# for version in PY_VERSIONS:
55+
# cog.outl(f' "Programming Language :: Python :: {version}",')
56+
# ]]] -->
3657
"Programming Language :: Python :: 3.9",
3758
"Programming Language :: Python :: 3.10",
3859
"Programming Language :: Python :: 3.11",
3960
"Programming Language :: Python :: 3.12",
4061
"Programming Language :: Python :: 3.13",
62+
# [[[end]]]
4163
"Programming Language :: Python :: Implementation :: CPython",
4264
"Programming Language :: Rust",
4365
"Topic :: Software Development",

0 commit comments

Comments
 (0)