Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
4 changes: 2 additions & 2 deletions .cruft.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"template": ".",
"commit": "7025e55adab820dd8e63d8be0e0ec0cabad0d830",
"commit": "9a783dd51cc0195a994c510e5f0eeb2d730a7e49",
"context": {
"cookiecutter": {
"project_name": "cookie-python",
Expand All @@ -14,7 +14,7 @@
"author_email": "smkent@smkent.net",
"github_user": "smkent",
"_template": ".",
"_commit": "7025e55adab820dd8e63d8be0e0ec0cabad0d830"
"_commit": "9a783dd51cc0195a994c510e5f0eeb2d730a7e49"
}
},
"directory": null,
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ name: Release
env:
ENABLE_PYPI_PUBLISH: true
ENABLE_TEST_PYPI_PUBLISH: false
RELEASE_PYTHON_VERSION: "3.12"
RELEASE_POETRY_VERSION: "2.0"
RELEASE_PYTHON_VERSION: "3.14"
RELEASE_POETRY_VERSION: "2.2"

on:
push:
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,9 @@ jobs:
- "3.11"
- "3.12"
- "3.13"
- "3.14"
poetry-version:
- "2.0"
- "2.2"

runs-on: ${{ matrix.os }}-latest
steps:
Expand Down
78 changes: 28 additions & 50 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,52 +1,30 @@
exclude: '^{{cookiecutter.project_name}}/'
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: check-yaml
- id: check-merge-conflict
- id: debug-statements
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/psf/black
rev: 25.1.0
hooks:
- id: black
args: ["--config", "pyproject.toml"]
- repo: https://github.com/pycqa/isort
rev: 6.0.1
hooks:
- id: isort
args: ["--show-config"]
- repo: https://github.com/pycqa/bandit
rev: 1.8.3
hooks:
- id: bandit
additional_dependencies: ['.[toml]']
args: ["--configfile", "pyproject.toml"]
exclude: '^tests/'
- repo: https://github.com/pycqa/flake8
rev: 7.2.0
hooks:
- id: flake8
additional_dependencies:
- flake8-bugbear
- flake8-pyproject
- flake8-simplify
- pep8-naming
- repo: https://github.com/pycqa/autoflake
rev: v2.3.1
hooks:
- id: autoflake
- repo: https://github.com/asottile/pyupgrade
rev: v3.20.0
hooks:
- id: pyupgrade
args: ["--py39-plus", "--keep-runtime-typing"]
- repo: local
hooks:
- id: mypy
name: mypy
language: python
types_or: [python, pyi]
entry: env -u VIRTUAL_ENV poetry run mypy
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v6.0.0
hooks:
- id: check-yaml
- id: check-merge-conflict
- id: debug-statements
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.14.11
hooks:
- id: ruff
args: ["--fix"]
- id: ruff-format
- repo: https://github.com/pycqa/bandit
rev: 1.9.2
hooks:
- id: bandit
additional_dependencies: ['.[toml]']
args: ["--configfile", "pyproject.toml"]
exclude: '^tests/'
- repo: local
hooks:
- id: mypy
name: mypy
language: python
types_or: [python, pyi]
entry: env -u VIRTUAL_ENV poetry run mypy
6 changes: 3 additions & 3 deletions cookie_python/manage/github.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import contextlib
import os
from functools import cached_property, lru_cache
from typing import Optional

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

def find_pr(
self, repo: Repository, head: str, base: str = "main"
) -> Optional[PullRequest]:
) -> PullRequest | None:
pulls = [
pr
for pr in repo.get_pulls(
head=f"{self.username}:{head}", base=base # noqa: E231
head=f"{self.username}:{head}",
base=base, # noqa: E231
)
]
if not pulls:
Expand Down
2 changes: 1 addition & 1 deletion cookie_python/manage/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

import argparse
import sys
from collections.abc import Callable
from enum import Enum
from pathlib import Path
from typing import Callable

from loguru import logger

Expand Down
5 changes: 2 additions & 3 deletions cookie_python/manage/update.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import os
from pathlib import Path
from typing import Optional

from .repo import RepoSandbox

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


def update_cruft(repo: RepoSandbox) -> Optional[str]:
def update_cruft(repo: RepoSandbox) -> str | None:
before_ref = repo.cruft_attr("commit")
repo.run(["poetry", "env", "remove", "--all"], check=False)
repo.run(["poetry", "env", "use", "/usr/bin/python3"])
Expand Down Expand Up @@ -87,7 +86,7 @@ def update_cruft(repo: RepoSandbox) -> Optional[str]:
)


def update_dependencies(repo: RepoSandbox) -> Optional[str]:
def update_dependencies(repo: RepoSandbox) -> str | None:
repo.run(["poetry", "run", "pre-commit", "autoupdate"])
updates = repo.run(
["poetry", "update", "--no-cache"], capture_output=True
Expand Down
7 changes: 4 additions & 3 deletions cookie_python/new.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,10 @@ def locate_new_project(parent_dir: str) -> str:
.strip()
== "?? .cruft.json"
), f"Detected project directory {sub_dir} has unexpected contents"
assert (
time.time() - os.stat(sub_dir).st_ctime < 60
), f"Detected project directory {sub_dir} was not created just now"
assert time.time() - os.stat(sub_dir).st_ctime < 60, (
f"Detected project directory {sub_dir}"
" was not created just now"
)
return sub_dir
raise Exception("Unable to locate newly-created project directory")

Expand Down
Loading