Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Poetry and Copier Update #32

Merged
merged 4 commits into from
Jun 14, 2024
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
380 changes: 154 additions & 226 deletions .calcipy_packaging.lock

Large diffs are not rendered by default.

3 changes: 1 addition & 2 deletions .copier-answers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Answer file maintained by Copier for: https://github.com/KyleKing/calcipy_template
# DO NOT MODIFY THIS FILE. Edit by re-running copier and changing responses to the questions
# Check into version control.
_commit: 1.9.14
_commit: 1.10.6
_src_path: gh:KyleKing/calcipy_template
author_email: [email protected]
author_name: Kyle King
Expand All @@ -12,7 +12,6 @@ copyright_date: '2022'
development_branch: main
doc_dir: docs
extends_calcipy: false
install_extras: ''
minimum_python: 3.10.5
minimum_python_short: '3.10'
package_name_py: copier_template_tester
Expand Down
16 changes: 0 additions & 16 deletions .flake8

This file was deleted.

4 changes: 2 additions & 2 deletions .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ inputs:
pipx-packages:
default: ""
poetry-version:
default: 1.7.1
default: 1.8.3
python-version:
required: true

Expand Down Expand Up @@ -46,5 +46,5 @@ runs:

- name: Install Project and Minimum Subset of Dependencies
run: |
poetry install
poetry install && poetry run calcipy-pack pack.install-extras
shell: bash
37 changes: 0 additions & 37 deletions .mypy.ini

This file was deleted.

27 changes: 14 additions & 13 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Common commands:
# pre-commit install
# pre-commit autoupdate
# pre-commit run --all-files absolufy-imports
# pre-commit run --all-files mdformat
# pre-commit run --all-files --hook-stage commit
# pre-commit run --all-files --hook-stage push
# poetry run calcipy lint.pre-commit --no-update
Expand All @@ -16,7 +16,7 @@ default_install_hook_types: ["commit-msg", "pre-commit", "pre-push"]

repos:
- 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-executables-have-shebangs
Expand All @@ -42,22 +42,25 @@ repos:
- id: trailing-whitespace
exclude: __snapshots__/.*\.ambr
- repo: https://github.com/commitizen-tools/commitizen
rev: v3.20.0
rev: v3.27.0
hooks:
- id: commitizen
- repo: https://github.com/executablebooks/mdformat
rev: 0.7.17
hooks:
- id: mdformat
additional_dependencies:
- "mdformat-mkdocs[recommended]>=2.0.6"
- "mdformat-mkdocs[recommended]>=2.1.0"
- "mdformat-gfm-alerts>=1.0.1"
args: [--wrap=no]
exclude: _.+\.md|CHANGELOG\.md|CODE_TAG_SUMMARY\.md
stages: ["pre-commit"]
- repo: https://github.com/shellcheck-py/shellcheck-py
rev: v0.10.0.1
hooks:
- id: shellcheck
args: [--severity=warning]
stages: ["pre-commit"]
- repo: https://github.com/pre-commit/mirrors-prettier
rev: "v4.0.0-alpha.8"
hooks:
Expand All @@ -66,28 +69,26 @@ repos:
# Note: this version must be the same as the hook revision
- "[email protected]"
- "prettier-plugin-sh"
exclude: \.copier-answers\.yml|tests/.*/cassettes/.*\.yaml|tests/data/.*/\.ctt/.*\.ya?ml
exclude: \.copier-answers\.yml|tests/.*/cassettes/.*\.yaml|__snapshots__/.*\.json|tests/data/.*/\.ctt/.*\.ya?ml
types_or: [html, javascript, json, shell, yaml]
stages: ["pre-commit"]
- repo: https://github.com/adrienverge/yamllint.git
rev: v1.35.1
hooks:
- id: yamllint
exclude: tests/.*/cassettes/.*\.yaml
stages: ["pre-commit"]
- repo: https://github.com/pappasam/toml-sort
rev: v0.23.1
hooks:
- id: toml-sort-fix
exclude: poetry\.lock
- repo: https://github.com/MarcoGorelli/absolufy-imports
rev: v0.3.1
hooks:
- id: absolufy-imports
args: [--never]
files: copier_template_tester/.*\.py
stages: ["pre-commit"]
- repo: https://github.com/KyleKing/calcipy
rev: 2.0.4
rev: 3.0.1
hooks:
- id: copier-forbidden-files
- id: lint-fix
- id: flake8
stages: ["pre-commit"]
- id: tags
stages: ["pre-push"]
88 changes: 0 additions & 88 deletions .ruff.toml

This file was deleted.

2 changes: 1 addition & 1 deletion copier_template_tester/_pre_commit_support.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def _ls_untracked_dir(base_dir: Path) -> set[Path]:


def check_for_untracked(base_dir: Path) -> None:
"""Resolves the edge case in #3 by raising when pre-commit won't error."""
"""Resolve edge case in #3 by raising when pre-commit won't error."""
if untracked_paths := _ls_untracked_dir(base_dir):
logger.text('pre-commit error: untracked files must be added', untracked_paths=untracked_paths)
sys.exit(1)
10 changes: 2 additions & 8 deletions copier_template_tester/_write_output.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ def _stabilize_answers_file(*, src_path: Path, dst_path: Path) -> None:
@contextmanager
# PLANNED: In python 3.10, there is a Beartype error for this return annotation:
# -> Generator[None, None, None]
def _output_dir(*, src_path: Path, dst_path: Path): # type: ignore[no-untyped-def] # noqa: ANN202
def _output_dir(*, src_path: Path, dst_path: Path): # noqa: ANN202
"""Manage the output directory and handle templates that cannot be updated (i.e. not answers file).

Addresses: <https://github.com/KyleKing/copier-template-tester/issues/24>
Expand All @@ -120,13 +120,7 @@ def _output_dir(*, src_path: Path, dst_path: Path): # type: ignore[no-untyped-d
answers_path.unlink()


def write_output( # type: ignore[no-untyped-def]
*,
src_path: Path,
dst_path: Path,
data: dict[str, bool | int | float | str | None],
**kwargs,
) -> None:
def write_output(*, src_path: Path, dst_path: Path, data: dict[str, bool | int | float | str | None], **kwargs) -> None:
"""Copy the specified directory to the target location with provided data.

kwargs documentation: https://github.com/copier-org/copier/blob/103828b59fd9eb671b5ffa909004d1577742300b/copier/main.py#L86-L173
Expand Down
2 changes: 1 addition & 1 deletion copier_template_tester/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@


def run(*, base_dir: Path | None = None, check_untracked: bool = False) -> None:
"""Main class to run ctt."""
"""Entry point."""
base_dir = base_dir or Path.cwd()
try:
read_copier_template(base_dir=base_dir)
Expand Down
Empty file added copier_template_tester/py.typed
Empty file.
2 changes: 2 additions & 0 deletions docs/docs/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
## Unreleased

## 2.1.2 (2024-05-02)

### Fix

- **#31**: defer to copier for template loading logic
Expand Down
9 changes: 5 additions & 4 deletions docs/docs/DEVELOPER_GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
git clone https://github.com/kyleking/copier-template-tester.git
cd copier-template-tester
poetry install --sync
poetry run calcipy-pack pack.install-extras

# See the available tasks
poetry run calcipy
Expand Down Expand Up @@ -46,12 +47,12 @@ poetry config pypi-token.pypi ...
<!-- {cts} COVERAGE -->
| File | Statements | Missing | Excluded | Coverage |
|-------------------------------------------------|--------------|-----------|------------|------------|
| `copier_template_tester/__init__.py` | 17 | 0 | 17 | 100.0% |
| `copier_template_tester/__init__.py` | 16 | 0 | 24 | 100.0% |
| `copier_template_tester/_config.py` | 14 | 0 | 3 | 100.0% |
| `copier_template_tester/_pre_commit_support.py` | 13 | 0 | 0 | 93.3% |
| `copier_template_tester/_write_output.py` | 76 | 0 | 13 | 96.9% |
| `copier_template_tester/main.py` | 30 | 4 | 14 | 86.7% |
| **Totals** | 150 | 4 | 47 | 95.5% |
| `copier_template_tester/main.py` | 30 | 4 | 20 | 86.7% |
| **Totals** | 149 | 4 | 60 | 95.5% |

Generated on: 2024-05-02
Generated on: 2024-06-13
<!-- {cte} -->
Loading