Skip to content

Commit

Permalink
Fixed cookiecutter update incompatibilities
Browse files Browse the repository at this point in the history
- fixed version to 2.6.0
- fixed outdated requirements management
  • Loading branch information
coordt committed May 3, 2024
1 parent 10f147f commit 9132c3c
Show file tree
Hide file tree
Showing 10 changed files with 28 additions and 868 deletions.
12 changes: 6 additions & 6 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: 'v0.2.0'
rev: 'v0.4.2'
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
exclude: test.*
- repo: https://github.com/psf/black
rev: 24.1.1
rev: 24.4.2
hooks:
- id: black
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
rev: v4.6.0
hooks:
- id: check-added-large-files
- id: check-case-conflict
Expand All @@ -36,20 +36,20 @@ repos:
- id: fix-encoding-pragma
args: ["--remove"]
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.8.0
rev: v1.10.0
hooks:
- id: mypy
exclude: test.*
args: [--no-strict-optional, --ignore-missing-imports]
additional_dependencies: ["pydantic", "toml", "types-all"]
- repo: https://github.com/jsh9/pydoclint
rev: 0.3.9
rev: 0.4.1
hooks:
- id: pydoclint
args:
- "--config=pyproject.toml"
- repo: https://github.com/econchick/interrogate
rev: 1.5.0 # or master if you're bold
rev: 1.7.0 # or master if you're bold
hooks:
- id: interrogate
exclude: test.*
Expand Down
2 changes: 1 addition & 1 deletion cookie_composer/layers.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,9 +222,9 @@ def get_template_rendered_name(template: Template, context: MutableMapping) -> s
"""Find and render the template's root directory's name."""
from cookiecutter.find import find_template

template_dir = find_template(template.cached_path)
envvars = context.get("cookiecutter", {}).get("_jinja2_env_vars", {})
env = CustomStrictEnvironment(context=context, keep_trailing_newline=True, **envvars)
template_dir = find_template(template.cached_path, env)
name_tmpl = env.from_string(template_dir.name)
return name_tmpl.render(**context)

Expand Down
3 changes: 2 additions & 1 deletion cookie_composer/templates/zipfile_repo.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
from zipfile import BadZipFile, ZipFile

import requests
from cookiecutter.utils import make_sure_path_exists, prompt_and_delete
from cookiecutter.prompt import prompt_and_delete
from cookiecutter.utils import make_sure_path_exists

from cookie_composer.exceptions import (
EmptyZipRepositoryError,
Expand Down
4 changes: 2 additions & 2 deletions cookie_composer/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,15 +100,15 @@ def remove_single_path(path: Path) -> None:
if path.is_dir():
try:
rmtree(path, ignore_errors=False, onerror=remove_readonly_bit)
except Exception as e: # noqa: BLE001 pragma: no-coverage
except Exception as e: # pragma: no-coverage
raise IOError("Failed to remove directory.") from e
elif path.is_file():
try:
path.unlink()
except PermissionError: # pragma: no-coverage
path.chmod(stat.S_IWRITE)
path.unlink()
except Exception as exc: # noqa: BLE001 pragma: no-coverage
except Exception as exc: # pragma: no-coverage
raise IOError("Failed to remove file.") from exc


Expand Down
27 changes: 17 additions & 10 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ classifiers = [
]
dependencies = [
"click-log",
"cookiecutter>=2.4.0",
"cookiecutter==2.6.0",
"fsspec[http]",
"ghapi",
"gitpython>=3.1.37",
Expand Down Expand Up @@ -50,15 +50,22 @@ dev = [
"pip-tools",
]
docs = [
"astroid<3.0.0", # astroid 3.0.0 breaks sphinx-autodoc2 0.4.2
"ghp-import",
"linkify-it-py",
"myst-parser",
"Sphinx>=7.2.0",
"sphinx-autodoc2",
"sphinx-click",
"sphinx-copybutton",
"sphinx-material",
"black",
"markdown-customblocks",
"mdx-truly-sane-lists",
"mkdocs",
"mkdocs-click",
"mkdocs-drawio",
"mkdocs-gen-files",
"mkdocs-git-authors-plugin",
"mkdocs-git-committers-plugin",
"mkdocs-git-revision-date-localized-plugin",
"mkdocs-include-markdown-plugin",
"mkdocs-literate-nav",
"mkdocs-material",
"mkdocstrings[python]",
"python-frontmatter",
"pyyaml",
]
test = [
"coverage>=6.1.2",
Expand Down
1 change: 0 additions & 1 deletion requirements.txt

This file was deleted.

Loading

0 comments on commit 9132c3c

Please sign in to comment.