Skip to content

Commit b7b8e41

Browse files
authored
Merge pull request #121 from smkent/manage-cookie
Update project template cruft, dependencies
2 parents 9a783dd + 90d599a commit b7b8e41

14 files changed

Lines changed: 1025 additions & 1107 deletions

File tree

.cruft.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"template": ".",
3-
"commit": "7025e55adab820dd8e63d8be0e0ec0cabad0d830",
3+
"commit": "9a783dd51cc0195a994c510e5f0eeb2d730a7e49",
44
"context": {
55
"cookiecutter": {
66
"project_name": "cookie-python",
@@ -14,7 +14,7 @@
1414
"author_email": "smkent@smkent.net",
1515
"github_user": "smkent",
1616
"_template": ".",
17-
"_commit": "7025e55adab820dd8e63d8be0e0ec0cabad0d830"
17+
"_commit": "9a783dd51cc0195a994c510e5f0eeb2d730a7e49"
1818
}
1919
},
2020
"directory": null,

.github/workflows/cd.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ name: Release
44
env:
55
ENABLE_PYPI_PUBLISH: true
66
ENABLE_TEST_PYPI_PUBLISH: false
7-
RELEASE_PYTHON_VERSION: "3.12"
8-
RELEASE_POETRY_VERSION: "2.0"
7+
RELEASE_PYTHON_VERSION: "3.14"
8+
RELEASE_POETRY_VERSION: "2.2"
99

1010
on:
1111
push:

.github/workflows/ci.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,9 @@ jobs:
2525
- "3.11"
2626
- "3.12"
2727
- "3.13"
28+
- "3.14"
2829
poetry-version:
29-
- "2.0"
30+
- "2.2"
3031

3132
runs-on: ${{ matrix.os }}-latest
3233
steps:

.pre-commit-config.yaml

Lines changed: 28 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,30 @@
11
exclude: '^{{cookiecutter.project_name}}/'
22
repos:
3-
- repo: https://github.com/pre-commit/pre-commit-hooks
4-
rev: v5.0.0
5-
hooks:
6-
- id: check-yaml
7-
- id: check-merge-conflict
8-
- id: debug-statements
9-
- id: end-of-file-fixer
10-
- id: trailing-whitespace
11-
- repo: https://github.com/psf/black
12-
rev: 25.1.0
13-
hooks:
14-
- id: black
15-
args: ["--config", "pyproject.toml"]
16-
- repo: https://github.com/pycqa/isort
17-
rev: 6.0.1
18-
hooks:
19-
- id: isort
20-
args: ["--show-config"]
21-
- repo: https://github.com/pycqa/bandit
22-
rev: 1.8.3
23-
hooks:
24-
- id: bandit
25-
additional_dependencies: ['.[toml]']
26-
args: ["--configfile", "pyproject.toml"]
27-
exclude: '^tests/'
28-
- repo: https://github.com/pycqa/flake8
29-
rev: 7.2.0
30-
hooks:
31-
- id: flake8
32-
additional_dependencies:
33-
- flake8-bugbear
34-
- flake8-pyproject
35-
- flake8-simplify
36-
- pep8-naming
37-
- repo: https://github.com/pycqa/autoflake
38-
rev: v2.3.1
39-
hooks:
40-
- id: autoflake
41-
- repo: https://github.com/asottile/pyupgrade
42-
rev: v3.20.0
43-
hooks:
44-
- id: pyupgrade
45-
args: ["--py39-plus", "--keep-runtime-typing"]
46-
- repo: local
47-
hooks:
48-
- id: mypy
49-
name: mypy
50-
language: python
51-
types_or: [python, pyi]
52-
entry: env -u VIRTUAL_ENV poetry run mypy
3+
- repo: https://github.com/pre-commit/pre-commit-hooks
4+
rev: v6.0.0
5+
hooks:
6+
- id: check-yaml
7+
- id: check-merge-conflict
8+
- id: debug-statements
9+
- id: end-of-file-fixer
10+
- id: trailing-whitespace
11+
- repo: https://github.com/astral-sh/ruff-pre-commit
12+
rev: v0.14.11
13+
hooks:
14+
- id: ruff
15+
args: ["--fix"]
16+
- id: ruff-format
17+
- repo: https://github.com/pycqa/bandit
18+
rev: 1.9.2
19+
hooks:
20+
- id: bandit
21+
additional_dependencies: ['.[toml]']
22+
args: ["--configfile", "pyproject.toml"]
23+
exclude: '^tests/'
24+
- repo: local
25+
hooks:
26+
- id: mypy
27+
name: mypy
28+
language: python
29+
types_or: [python, pyi]
30+
entry: env -u VIRTUAL_ENV poetry run mypy

cookie_python/manage/github.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import contextlib
22
import os
33
from functools import cached_property, lru_cache
4-
from typing import Optional
54

65
import github
76
from github.PullRequest import PullRequest
@@ -27,11 +26,12 @@ def find_repo(self, search: str) -> Repository:
2726

2827
def find_pr(
2928
self, repo: Repository, head: str, base: str = "main"
30-
) -> Optional[PullRequest]:
29+
) -> PullRequest | None:
3130
pulls = [
3231
pr
3332
for pr in repo.get_pulls(
34-
head=f"{self.username}:{head}", base=base # noqa: E231
33+
head=f"{self.username}:{head}",
34+
base=base, # noqa: E231
3535
)
3636
]
3737
if not pulls:

cookie_python/manage/main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
import argparse
44
import sys
5+
from collections.abc import Callable
56
from enum import Enum
67
from pathlib import Path
7-
from typing import Callable
88

99
from loguru import logger
1010

cookie_python/manage/update.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import os
22
from pathlib import Path
3-
from typing import Optional
43

54
from .repo import RepoSandbox
65

@@ -13,7 +12,7 @@ def reset_cruft_json(repo: RepoSandbox) -> None:
1312
)
1413

1514

16-
def update_cruft(repo: RepoSandbox) -> Optional[str]:
15+
def update_cruft(repo: RepoSandbox) -> str | None:
1716
before_ref = repo.cruft_attr("commit")
1817
repo.run(["poetry", "env", "remove", "--all"], check=False)
1918
repo.run(["poetry", "env", "use", "/usr/bin/python3"])
@@ -87,7 +86,7 @@ def update_cruft(repo: RepoSandbox) -> Optional[str]:
8786
)
8887

8988

90-
def update_dependencies(repo: RepoSandbox) -> Optional[str]:
89+
def update_dependencies(repo: RepoSandbox) -> str | None:
9190
repo.run(["poetry", "run", "pre-commit", "autoupdate"])
9291
updates = repo.run(
9392
["poetry", "update", "--no-cache"], capture_output=True

cookie_python/new.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,10 @@ def locate_new_project(parent_dir: str) -> str:
5454
.strip()
5555
== "?? .cruft.json"
5656
), f"Detected project directory {sub_dir} has unexpected contents"
57-
assert (
58-
time.time() - os.stat(sub_dir).st_ctime < 60
59-
), f"Detected project directory {sub_dir} was not created just now"
57+
assert time.time() - os.stat(sub_dir).st_ctime < 60, (
58+
f"Detected project directory {sub_dir}"
59+
" was not created just now"
60+
)
6061
return sub_dir
6162
raise Exception("Unable to locate newly-created project directory")
6263

0 commit comments

Comments
 (0)