[REWRITE] cookiecutter + cruft template with modern tooling#36
[REWRITE] cookiecutter + cruft template with modern tooling#36zacharyburnett wants to merge 48 commits intospacetelescope:mainfrom
Conversation
|
add our default to LICENSE at the top: "BSD 3-Clause License" |
|
@zacharyburnett you want me to pr some of the standard file/templates I already have to your branch? Or elsewhere? |
Sure, feel free to PR against this branch! Thanks! |
23c45f9 to
c61bd65
Compare
64971ff to
6776f32
Compare
|
I removed the built docs, because as far as I understand this repo does not need a dedicated RTD page |
|
as far as the pre-commit hooks, the base |
I think However, you do make a good point that for initial adoption and to reduce friction with maintainers, we can implement the first rollout of this template with extras, and then later change them to dependency groups and have cruft pick those up as PRs |
Thanks. This was in reference to the rendered .pre-commit. For the test pure python project it generated: ci:
autofix_prs: false
autoupdate_schedule: monthly
exclude: ".*\\.asdf$"
repos:
# basic checks
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v6.0.0
hooks:
- id: check-added-large-files
- id: check-case-conflict
- id: check-merge-conflict
- id: check-symlinks
- id: detect-private-key
- id: end-of-file-fixer
- id: trailing-whitespace
# validate change log and fragments in `changes/`
- repo: https://github.com/twisted/towncrier
rev: 25.8.0
hooks:
- id: towncrier-check
# spell-checking
- repo: https://github.com/codespell-project/codespell
rev: v2.4.1
hooks:
- id: codespell
args:
- --write-changes
- --summary
additional_dependencies:
- tomli
# lint GitHub Actions workflows
- repo: https://github.com/rhysd/actionlint
rev: v1.7.11
hooks:
- id: actionlintDid it render the wrong template? |
yes it looks like the symlinks were pointing to the wrong file 😅 |
| # format and lint TOML | ||
| - repo: https://github.com/tombi-toml/tombi-pre-commit | ||
| rev: v0.9.17 | ||
| hooks: | ||
| - id: tombi-format | ||
| - id: tombi-lint |
There was a problem hiding this comment.
we can use some combination of taplo, tombi, validate-pyproject, and / or tomllint here
|
Thanks for making the updates! Testing the template by re-making the package shows most of the issues are resolved. There are some remaining/new issues:
|
|
there's also the lingering question of whether the "recommendation" of this template should be to do type checking with mypy in the pre-commit config, since a lot of our packages don't do type hinting; perhaps that should be put into a task runner like @sydduckworth has been doing some work with type checking with Pyrefly and establishing baselines for packages adopting type checking; maybe we can explore that in a future PR that adds a new option to the cookiecutter |
I think we should consider this in a future PR, type checking isn't a standard across our packages |
building on suggestions from @sosey and @pllim and @braingram, this is a total rewrite of this repository to turn it into a Cookiecutter template with best practices, that we can use with
cruftto keep downstream templated repositories up-to-date.Feedback is welcome! I split these changes into several commits; see https://github.com/zacharyburnett/stsci-package-template/tree/modernize for a current state of the template in this PR
templated example of a pure-Python package (
stpipe) here: spacetelescope/stpipe#306and a Python package with C extensions (
stsci.imagestats): spacetelescope/stsci.imagestats#93Tasks
towncriernoxtoxhatchlingsetuptoolspyo3andmaturin.gitignorecruftinto template - see example at https://github.com/Roman-Supernova-PIT/snappl/blob/main/.github/workflows/sub_package_update.ymlNotes