Skip to content

Commit

Permalink
chore: update cruft
Browse files Browse the repository at this point in the history
  • Loading branch information
wpk committed Dec 31, 2024
1 parent 185ac3d commit 6e1884b
Show file tree
Hide file tree
Showing 64 changed files with 6,101 additions and 2,798 deletions.
5 changes: 3 additions & 2 deletions .cruft.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"template": "https://github.com/usnistgov/cookiecutter-nist-python.git",
"commit": "226e9c70cfb1bdb489dd43cbe8fbb188e47dce92",
"commit": "3b9a6d364ccccd3fff7ff56ac83d36f102ef8bae",
"checkout": "develop",
"context": {
"cookiecutter": {
Expand All @@ -18,7 +18,8 @@
"year": "2023",
"__answers": "",
"_copy_without_render": [],
"_template": "https://github.com/usnistgov/cookiecutter-nist-python.git"
"_template": "https://github.com/usnistgov/cookiecutter-nist-python.git",
"_commit": "3b9a6d364ccccd3fff7ff56ac83d36f102ef8bae"
}
},
"directory": null
Expand Down
3 changes: 0 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,6 @@ target/
# Jupyter Notebook
.ipynb_checkpoints

# pyenv
.python-version

# celery beat schedule file
celerybeat-schedule

Expand Down
70 changes: 8 additions & 62 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ repos:
rev: v5.0.0
hooks:
- id: check-added-large-files
exclude: ^uv[.]lock
- id: check-case-conflict
- id: check-merge-conflict
- id: check-symlinks
Expand All @@ -22,7 +23,7 @@ repos:
- id: mixed-line-ending
# * Sync dependencies
- repo: https://github.com/mxr/sync-pre-commit-deps
rev: v0.0.1
rev: v0.0.2
hooks:
- id: sync-pre-commit-deps

Expand All @@ -46,11 +47,12 @@ repos:

# * Markdown
- repo: https://github.com/DavidAnson/markdownlint-cli2
rev: v0.14.0
rev: v0.17.1
hooks:
- id: markdownlint-cli2
alias: markdownlint
args: [--style, prettier]
# language_version: 10.9.0

# * Linting
# To be replace by ruff analog when I find one ...
Expand All @@ -61,7 +63,7 @@ repos:
additional_dependencies:
- black==24.4.2
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.7.2
rev: v0.8.4
hooks:
- id: ruff
alias: ruff-all
Expand All @@ -80,82 +82,26 @@ repos:
args: [-I, docs/spelling_wordlist.txt]
exclude_types: [jupyter]

# * Notebook spelling
# - repo: https://github.com/nbQA-dev/nbQA
# rev: 1.8.4
# hooks:
# - id: nbqa
# alias: nbqa-codespell
# name: nbqa-codespell
# additional_dependencies: &codespell-deps [codespell==2.2.6, tomli] # make sure same as above
# args:
# [codespell, --ignore-words=docs/spelling_wordlist.txt, --nbqa-shell]
# - id: nbqa
# alias: nbqa-codespell
# name: nbqa-codespell-markdown
# additional_dependencies: *codespell-deps
# args:
# [
# codespell,
# --ignore-words=docs/spelling_wordlist.txt,
# --nbqa-shell,
# --nbqa-md,
# ]

# * Strip out metadata from notebooks
# - repo: https://github.com/kynan/nbstripout
# rev: 0.7.1
# hooks:
# - id: nbstripout
# args: [
# --keep-output, # keep output (needed for nbval testing)
# --keep-count, # Errors with nbval without this...
# --extra-keys, # strip out kernelspec. If use this, always have to reselect kernel when open a notebook...
# "metadata.kernelspec metadata.kernel_spec",
# ]

# * Commit message
- repo: https://github.com/commitizen-tools/commitizen
rev: v3.30.0
rev: v4.1.0
hooks:
- id: commitizen
stages: [commit-msg]

# * Manual Linting ------------------------------------------------------------
- repo: https://github.com/asottile/pyupgrade
rev: v3.19.0
rev: v3.19.1
hooks:
- id: pyupgrade
stages: [manual]
args: [--py38-plus]
# - repo: https://github.com/nbQA-dev/nbQA
# rev: 1.8.4
# hooks:
# - id: nbqa-pyupgrade
# additional_dependencies: [pyupgrade]
# stages: [manual]
# args: [--py38-plus]

# ** typos
# Probably stick with codespell, but this might also be nice...
- repo: https://github.com/crate-ci/typos
rev: v1.27.0
rev: v1.28.4
hooks:
- id: typos
stages: [manual]
exclude: "[.]ipynb$"
# - repo: https://github.com/nbQA-dev/nbQA
# rev: 1.8.4
# hooks:
# - id: nbqa
# alias: nbqa-typos
# name: nbqa-typos
# additional_dependencies: &typos-deps [typos==1.19.0] # make sure save version as above.
# stages: [manual]
# args: [typos, --nbqa-shell]
# - id: nbqa
# alias: nbqa-typos
# name: nbqa-typos-markdown
# additional_dependencies: *typos-deps
# stages: [manual]
# args: [typos, --nbqa-shell, --nbqa-md]
1 change: 1 addition & 0 deletions .python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.11
34 changes: 6 additions & 28 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -429,10 +429,6 @@ conda activate {env-name}
pip install -e . --no-deps
```

If you want to include some extra tools in the environment (instead of using
[uvx], [condax], or [pipx]), use `requirements/py{version}-dev-complete.yaml`
instead.

### Create development environment with pip

Run something like the following:
Expand All @@ -453,39 +449,22 @@ Or if using [uv]:
uv venv --python 3.11 .venv
uv pip install -r requirements/dev.txt
# or locked
uv pip sync requirements/lock/py311-dev.txt
uv pip sync requirements/lock/py{version}-dev.txt

```

If you want to include the extra tools, replace `dev.txt` with
`dev-complete.txt`.

### Create development environment with nox

If you'd like to use nox to manage your development environment, use the
following:
Or you can simply use:

```bash
nox -s dev -- [++dev-envname dev/dev-complete]
make dev
```

where the option `++dev-envname` (default `dev`) can be used to specify what
kind of development environment you'd like. This will create a virtual
environment under `.venv`. To instead create a [conda] based development
environment, use `nox -s dev-conda ....`.

If you go this route, you may want to use something like
which will create a virtual environment under `.venv`. If you go this route, you
may want to use something like
[zsh-autoenv](https://github.com/Tarrasch/zsh-autoenv) (if using zsh shell) or
[autoenv](https://github.com/hyperupcall/autoenv) (if using bash) to auto
activate the development environment when in the parent directory.

Note that you can bootstrap the whole process with [uvx] using:

```bash
uvx nox -s dev/dev-conda -- \
++dev-envname dev/dev-complete
```

### Development tools

Additional tools are:
Expand All @@ -500,8 +479,7 @@ Additional tools are:
- [nbqa] (optional)

We recommend installing these tools with [uv], but feel free to use [pipx] or
[condax]. If you'd like to install them in the development environment instead,
use the `dev-complete` version of the commands above.
[condax].

```console
uv tool/condax/pipx install pre-commit
Expand Down
Loading

0 comments on commit 6e1884b

Please sign in to comment.