Skip to content

Commit 8a98216

Browse files
authored
Merge pull request #9 from python-discord/update-2025
2 parents d5fd7be + bc30ebf commit 8a98216

File tree

6 files changed

+41
-26
lines changed

6 files changed

+41
-26
lines changed

.pre-commit-config.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
repos:
55
- repo: https://github.com/pre-commit/pre-commit-hooks
6-
rev: v4.6.0
6+
rev: v5.0.0
77
hooks:
88
- id: check-toml
99
- id: check-yaml
@@ -12,7 +12,7 @@ repos:
1212
args: [--markdown-linebreak-ext=md]
1313

1414
- repo: https://github.com/astral-sh/ruff-pre-commit
15-
rev: v0.5.0
15+
rev: v0.12.2
1616
hooks:
17-
- id: ruff
17+
- id: ruff-check
1818
- id: ruff-format

README.md

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ Here is a quick rundown of what each file in this repository contains:
1919

2020
- [`LICENSE.txt`](LICENSE.txt): [The MIT License](https://opensource.org/licenses/MIT), an OSS approved license which grants rights to everyone to use and modify your project, and limits your liability. We highly recommend you to read the license.
2121
- [`.gitignore`](.gitignore): A list of files and directories that will be ignored by Git. Most of them are auto-generated or contain data that you wouldn't want to share publicly.
22-
- [`requirements-dev.txt`](requirements-dev.txt): Every PyPI package used for the project's development, to ensure a common development environment. More on that [below](#using-the-default-pip-setup).
2322
- [`pyproject.toml`](pyproject.toml): Configuration and metadata for the project, as well as the linting tool Ruff. If you're interested, you can read more about `pyproject.toml` in the [Python Packaging documentation](https://packaging.python.org/en/latest/guides/writing-pyproject-toml/).
2423
- [`.pre-commit-config.yaml`](.pre-commit-config.yaml): The configuration of the [pre-commit](https://pre-commit.com/) tool.
2524
- [`.github/workflows/lint.yaml`](.github/workflows/lint.yaml): A [GitHub Actions](https://github.com/features/actions) workflow, a set of actions run by GitHub on their server after each push, to ensure the style requirements are met.
@@ -82,7 +81,7 @@ It is *installed* by running `pre-commit install` and can be run manually by cal
8281
- `check-yaml`: Lints and corrects your YAML files.
8382
- `end-of-file-fixer`: Makes sure you always have an empty line at the end of your file.
8483
- `trailing-whitespace`: Removes whitespaces at the end of each line.
85-
- `ruff`: Runs the Ruff linter.
84+
- `ruff-check`: Runs the Ruff linter.
8685
- `ruff-format`: Runs the Ruff formatter.
8786

8887
## How do I use this template?
@@ -106,12 +105,16 @@ One person in the team, preferably the leader, will have to create the repositor
106105
You are now ready to go! Sit down, relax, and wait for the kickstart!
107106

108107
> [!IMPORTANT]
109-
> Don't forget to swap "Python Discord" in the [`LICENSE.txt`](LICENSE.txt) file for the name of each of your team members or the name of your team *after* the start of the code jam.
108+
> Don't forget to change the project name, description, and authors at the top of the [`pyproject.toml`](pyproject.toml) file, and swap "Python Discord" in the [`LICENSE.txt`](LICENSE.txt) file for the name of each of your team members or the name of your team *after* the start of the code jam.
110109
111110
### Using the default pip setup
112111

113-
Our default setup includes a bare requirements file to be used with a [virtual environment](https://docs.python.org/3/library/venv.html).
114-
We recommend this if you have never used any other dependency manager, although if you have, feel free to switch to it. More on that [below](#how-do-i-adapt-this-template-to-my-project).
112+
Our default setup includes a dependency group to be used with a [virtual environment](https://docs.python.org/3/library/venv.html).
113+
It works with pip and uv, and we recommend this if you have never used any other dependency manager, although if you have, feel free to switch to it.
114+
More on that [below](#how-do-i-adapt-this-template-to-my-project).
115+
116+
Dependency groups are a relatively new feature, specified in [PEP 735](https://peps.python.org/pep-0735/).
117+
You can read more about them in the [Python Packaging User Guide](https://packaging.python.org/en/latest/specifications/dependency-groups/).
115118

116119
#### Creating the environment
117120

@@ -145,7 +148,7 @@ $ .venv/bin/Activate.ps1
145148
Once the environment is created and activated, use this command to install the development dependencies.
146149

147150
```shell
148-
pip install -r requirements-dev.txt
151+
pip install --group dev
149152
```
150153

151154
#### Exiting the environment
@@ -163,11 +166,10 @@ Once the environment is activated, all the commands listed previously should wor
163166
164167
## How do I adapt this template to my project?
165168

166-
If you wish to use Pipenv or Poetry, you will have to move the dependencies in [`requirements-dev.txt`](requirements-dev.txt) to the development dependencies of your tool.
169+
If you wish to use Pipenv or Poetry, you will have to move the dependencies in [`pyproject.toml`](pyproject.toml) to the development dependencies of your tool.
167170

168-
We've included a porting of [`requirements-dev.txt`](requirements-dev.txt) to both [Poetry](samples/pyproject.toml) and [Pipenv](samples/Pipfile) in the [`samples` folder](samples).
169-
If you use the Poetry setup, make sure to change the project name, description, and authors at the top of the file.
170-
Also note that the Poetry [`pyproject.toml`](samples/pyproject.toml) file does not include the Ruff configuration, so if you simply replace the file then the Ruff configuration will be lost.
171+
We've included a porting to both [Poetry](samples/pyproject.toml) and [Pipenv](samples/Pipfile) in the [`samples` folder](samples).
172+
Note that the Poetry [`pyproject.toml`](samples/pyproject.toml) file does not include the Ruff configuration, so if you simply replace the file then the Ruff configuration will be lost.
171173

172174
When installing new dependencies, don't forget to [pin](https://pip.pypa.io/en/stable/topics/repeatable-installs/#pinning-the-package-versions) them by adding a version tag at the end.
173175
For example, if I wish to install [Click](https://click.palletsprojects.com/en/8.1.x/), a quick look at [PyPI](https://pypi.org/project/click/) tells me that `8.1.7` is the latest version.

pyproject.toml

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,25 @@
1+
[project]
2+
# This section contains metadata about your project.
3+
# Don't forget to change the name, description, and authors to match your project!
4+
name = "code-jam-template"
5+
description = "Add your description here"
6+
authors = [
7+
{ name = "Your Name" }
8+
]
9+
version = "0.1.0"
10+
readme = "README.md"
11+
requires-python = ">=3.12"
12+
dependencies = []
13+
14+
[dependency-groups]
15+
# This `dev` group contains all the development requirements for our linting toolchain.
16+
# Don't forget to pin your dependencies!
17+
# This list will have to be migrated if you wish to use another dependency manager.
18+
dev = [
19+
"pre-commit~=4.2.0",
20+
"ruff~=0.12.2",
21+
]
22+
123
[tool.ruff]
224
# Increase the line length. This breaks PEP8 but it is way easier to work with.
325
# The original reason for this limit was a standard vim terminal is only 79 characters,
@@ -38,7 +60,4 @@ ignore = [
3860
"TD002",
3961
"TD003",
4062
"FIX",
41-
# Annotations.
42-
"ANN101",
43-
"ANN102",
4463
]

requirements-dev.txt

Lines changed: 0 additions & 6 deletions
This file was deleted.

samples/Pipfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ name = "pypi"
88
[packages]
99

1010
[dev-packages]
11-
ruff = "~=0.5.0"
12-
pre-commit = "~=3.7.1"
11+
ruff = "~=0.12.2"
12+
pre-commit = "~=4.2.0"
1313

1414
[requires]
1515
python_version = "3.12"

samples/pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ license = "MIT"
1111
python = "3.12.*"
1212

1313
[tool.poetry.dev-dependencies]
14-
ruff = "~0.5.0"
15-
pre-commit = "~3.7.1"
14+
ruff = "~0.12.2"
15+
pre-commit = "~4.2.0"
1616

1717
[build-system]
1818
requires = ["poetry-core>=1.0.0"]

0 commit comments

Comments
 (0)