Skip to content

Commit

Permalink
Merge branch 'release/v0.17.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
wpk committed Jan 22, 2025
2 parents 3c1f47c + 3a7464c commit 53c80d2
Show file tree
Hide file tree
Showing 34 changed files with 1,061 additions and 2,077 deletions.
4 changes: 2 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": "3b9a6d364ccccd3fff7ff56ac83d36f102ef8bae",
"commit": "4ccec1ff95bc974fa9b3d89af39aa03dfbf0e444",
"checkout": "develop",
"context": {
"cookiecutter": {
Expand All @@ -19,7 +19,7 @@
"__answers": "",
"_copy_without_render": [],
"_template": "https://github.com/usnistgov/cookiecutter-nist-python.git",
"_commit": "3b9a6d364ccccd3fff7ff56ac83d36f102ef8bae"
"_commit": "4ccec1ff95bc974fa9b3d89af39aa03dfbf0e444"
}
},
"directory": null
Expand Down
33 changes: 21 additions & 12 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ repos:
- id: mixed-line-ending
# * Sync dependencies
- repo: https://github.com/mxr/sync-pre-commit-deps
rev: v0.0.2
rev: v0.0.3
hooks:
- id: sync-pre-commit-deps

Expand All @@ -33,21 +33,21 @@ repos:
hooks:
- id: pyproject-fmt
args: [--indent=4, --keep-full-version]
files: ^pyproject.toml$
files: ""
types: [toml]
exclude: ^tests/data

# * Prettier
- repo: https://github.com/pre-commit/mirrors-prettier
rev: v4.0.0-alpha.8
- repo: https://github.com/rbubley/mirrors-prettier
rev: v3.4.2
hooks:
- id: prettier
alias: markdownlint
stages: [pre-commit]
additional_dependencies:
- prettier-plugin-toml

# * Markdown
- repo: https://github.com/DavidAnson/markdownlint-cli2
rev: v0.17.1
rev: v0.17.2
hooks:
- id: markdownlint-cli2
alias: markdownlint
Expand All @@ -61,9 +61,9 @@ repos:
hooks:
- id: blacken-docs
additional_dependencies:
- black==24.4.2
- black==24.10.0
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.8.4
rev: v0.9.2
hooks:
- id: ruff
alias: ruff-all
Expand All @@ -75,12 +75,13 @@ repos:

# * Spelling
- repo: https://github.com/codespell-project/codespell
rev: v2.3.0
rev: v2.4.0
hooks:
- id: codespell
additional_dependencies: [tomli]
args: [-I, docs/spelling_wordlist.txt]
exclude_types: [jupyter]
exclude: ^uv[.]lock$|^requirements

# * Commit message
- repo: https://github.com/commitizen-tools/commitizen
Expand All @@ -89,6 +90,14 @@ repos:
- id: commitizen
stages: [commit-msg]

# * uv
- repo: https://github.com/astral-sh/uv-pre-commit
# uv version.
rev: 0.5.22
hooks:
- id: uv-lock
args: [--locked]

# * Manual Linting ------------------------------------------------------------
- repo: https://github.com/asottile/pyupgrade
rev: v3.19.1
Expand All @@ -100,8 +109,8 @@ repos:
# ** typos
# Probably stick with codespell, but this might also be nice...
- repo: https://github.com/crate-ci/typos
rev: v1.28.4
rev: dictgen-v0.3.1
hooks:
- id: typos
stages: [manual]
exclude: "[.]ipynb$"
exclude: "[.]ipynb$|^uv[.]lock$|^requirements"
67 changes: 67 additions & 0 deletions .pylintrc.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
[tool.pylint]
ignore = [ "_implementation.py" ]

[tool.pylint.similarities]
ignore-imports = "yes"

[tool.pylint.basic]
no-docstring-rgx = "__.*__|test[A-Z_].*|_decorator|_wrapper|_.*__.*"

[tool.pylint.classes]
defining-attr-methods = [
"__init__",
"__new__",
"__post_init__",
"setUp",
"reset",
"_reset",
]

[tool.pylint.design]
max-args = 35
max-attributes = 40
max-bool-expr = 5
max-branches = 50
max-locals = 50
max-parents = 12
max-positional-arguments = 35
max-public-methods = 500
max-returns = 20
max-statements = 150
min-public-methods = 0

[tool.pylint."messages control"]
enable = [
# "useless-suppression",
"all",
]
disable = [
# defer to ruff
"line-too-long",
"missing-module-docstring",
"missing-function-docstring",
"redefined-outer-name",
"unused-argument",
"too-complex",
"missing-param-doc",
# Silly
"docstring-first-line-empty",
"magic-value-comparison",
# Can be useful to see what is ignored
"locally-disabled",
"suppressed-message",
# Questionable things, but it's ok, I don't need to be told:
"import-outside-toplevel",
"superfluous-parens",
"too-many-lines",
# Messages that are noisy for now, eventually maybe we'll turn them on:
"invalid-name",
# "protected-access",
"unspecified-encoding",
"consider-using-f-string",
# "duplicate-code",
# "cyclic-import",
]

[tool.pylint.reports]
output-format = "colorized"
2 changes: 1 addition & 1 deletion .python-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.11
3.12
55 changes: 36 additions & 19 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -264,20 +264,23 @@ requirement files are under something like
Additionally, requirement files for virtualenvs (e.g., `requirements.txt` like
files) will be "locked" using `uv pip compile` from [uv]. These files are placed
under `requirements/lock`. Note the the session `requirements` automatically
calls the session `uv-compile`.
calls the session `lock`.

To upgrade the dependencies in the lock, you'll need to pass the option:

```bash
nox -s uv-compile -- +L/++pip-compile-upgrade
nox -s lock -- +L/++lock-upgrade
```

This will also update `uv.lock` if it's being used.

## ipykernel

The environments created by nox `dev` and `docs-conda` will try to add
meaningful display names for ipykernel. These are installed at the user level.
To cleanup the kernels (meaning, removing installed kernels that point to a
removed environment), You can use the script `tools/clean_kernelspec.py`:
The environments created by nox `dev`, or running `make install-kernel`, will
try to add meaningful display names for ipykernel. These are installed at the
user level. To cleanup the kernels (meaning, removing installed kernels that
point to a removed environment), You can use the script
`tools/clean_kernelspec.py`:

```bash
python tools/clean_kernelspec.py
Expand Down Expand Up @@ -429,34 +432,48 @@ conda activate {env-name}
pip install -e . --no-deps
```

### Create development environment with pip
### Create development environment with uv/pip

Run something like the following:
The easiest way to create an development environment, if using `uv.lock`
mechanism is:

```bash
uv sync
```

If the project does not use `uv.lock`, or you don't want to use uv to manage
your environment, then use one of the following:

```bash
# using venv
python -m venv .venv
source .venv/bin/activate
# unlocked
python -m pip install -r requirements/dev.txt
# locked:
pip-sync --python-path .venv/bin/python requirements/lock/py{version}-dev.txt
python -m pip install -r requirements/lock/py{version}-dev.txt
python -m pip install -e . --no-deps
# using uv
uv venv --python 3.11 .venv
uv pip sync requirements/lock/py{version}-dev.txt
```

Or if using [uv]:
Note that if the project is setup to use `uv.lock` but you'd like to use one of
the above, you may have to run something like:

```bash
uv venv --python 3.11 .venv
uv pip install -r requirements/dev.txt
# or locked
uv pip sync requirements/lock/py{version}-dev.txt
uv export --dev > requirements.txt
```

and use this requirement file in the commands above.

If the project includes an ipython kernel, you can install it with:

```bash
make install-kernel
```

Or you can simply use:
Alternatively, you can simply use:

```bash
make dev
nox -s dev
```

which will create a virtual environment under `.venv`. If you go this route, you
Expand Down
Loading

0 comments on commit 53c80d2

Please sign in to comment.