Skip to content

Commit

Permalink
Merge branch 'release/v0.9.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
wpk committed Nov 14, 2023
2 parents 595a032 + 2cc720b commit 03110e6
Show file tree
Hide file tree
Showing 39 changed files with 834 additions and 229 deletions.
25 changes: 9 additions & 16 deletions .cruft.json
Original file line number Diff line number Diff line change
@@ -1,30 +1,23 @@
{
"template": "https://github.com/usnistgov/cookiecutter-nist-python.git",
"commit": "7ba78569cba4c2b39c2706d1f95b74c919b310cf",
"commit": "8fe5103d25de7e7d13d400f599c6653866a69afc",
"checkout": "develop",
"context": {
"cookiecutter": {
"project_name": "pyproject2conda",
"project_slug": "pyproject2conda",
"project_short_description": "A script to convert a Python project declared on a pyproject.toml to a conda environment.",
"full_name": "William P. Krekelberg",
"email": "[email protected]",
"github_username": "usnistgov",
"pypi_username": "conda-forge",
"conda_channel": "wpk-nist",
"project_name": "pyproject2conda",
"project_slug": "pyproject2conda",
"_copy_without_render": [
"*.html",
"docs/_templates/*.rst",
"docs/_templates/autosummary/*.rst",
"docs/_templates/autodocsumm/*.rst",
"docs/_static/css/*",
"docs/_static/js/*",
"changelog.d/templates/*.j2",
"changelog.d/templates/auto-changelog/*.jinja2"
],
"project_short_description": "A script to convert a Python project declared on a pyproject.toml to a conda environment.",
"command_line_interface": "Typer",
"sphinx_use_autodocsumm": "y",
"command_line_interface": "typer",
"sphinx_use_autodocsumm": true,
"sphinx_theme": "sphinx_book_theme",
"year": "2023",
"__answers": "",
"_copy_without_render": [],
"_template": "https://github.com/usnistgov/cookiecutter-nist-python.git"
}
},
Expand Down
22 changes: 11 additions & 11 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ default_install_hook_types:
repos:
# * Top level
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
rev: v4.5.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
Expand All @@ -35,23 +35,23 @@ repos:
stages: [commit]
additional_dependencies:
- prettier-plugin-toml
exclude: ^requirements/lock/.*[.]yml
exclude: ^requirements/lock/.*[.]yml|^.copier-answers.ya?ml

# * Markdown
- repo: https://github.com/DavidAnson/markdownlint-cli2
rev: v0.9.2
rev: v0.10.0
hooks:
- id: markdownlint-cli2
args: ["--style prettier"]

# * Linting
- repo: https://github.com/charliermarsh/ruff-pre-commit
# Ruff version.
rev: "v0.0.289"
rev: "v0.1.3"
hooks:
- id: ruff
- repo: https://github.com/psf/black
rev: 23.9.1
rev: 23.10.1
hooks:
# NOTE: nbQA for notebook formatting
- id: black
Expand All @@ -60,19 +60,19 @@ repos:
hooks:
- id: blacken-docs
additional_dependencies:
- black==23.9.1
- black==23.10.1
# exclude: ^README.md
- repo: https://github.com/nbQA-dev/nbQA
rev: 1.7.0
hooks:
- id: nbqa-ruff
additional_dependencies: [ruff==0.0.289]
additional_dependencies: [ruff==0.1.3]
- id: nbqa-black
additional_dependencies: [black==23.9.1]
additional_dependencies: [black==23.10.1]

# * Commit message
- repo: https://github.com/commitizen-tools/commitizen
rev: 3.9.0
rev: 3.12.0
hooks:
- id: commitizen
stages: [commit-msg]
Expand All @@ -85,7 +85,7 @@ repos:
- id: isort
stages: [manual]
- repo: https://github.com/asottile/pyupgrade
rev: v3.10.1
rev: v3.15.0
hooks:
- id: pyupgrade
stages: [manual]
Expand Down Expand Up @@ -113,7 +113,7 @@ repos:
stages: [manual]
# ** spelling
- repo: https://github.com/codespell-project/codespell
rev: v2.2.5
rev: v2.2.6
hooks:
- id: codespell
types_or: [python, rst, markdown, cython, c]
Expand Down
24 changes: 22 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,36 @@
<!-- markdownlint-disable MD024 -->
<!-- markdownlint-disable MD013 -->
<!-- prettier-ignore-start -->

# Changelog

Changelog for `pyproject2conda`

## Unreleased

See the fragment files in
[changelog.d](https://github.com/usnistgov/pyproject2conda)
[changelog.d]: https://github.com/usnistgov/pyproject2conda/tree/main/changelog.d

See the fragment files in [changelog.d]

<!-- prettier-ignore-end -->

<!-- markdownlint-enable MD013 -->

<!-- scriv-insert-here -->

## v0.9.0 — 2023-11-14

### Added

- Default is now to remove whitespace from dependencies. For example, the
dependency `module > 0.1` will become `module>0.1`. To override this
behaviour, pass the option `--no-remove-whitespace`.
- Now supports python version `>3.8,<=3.12`
- Can now specify `extras = false` in pyprojec.toml to skip any extras. The
default (`extras = true`) is the same as `extras = [env_name]` where
`env_name` is the name of the environment (e.g.,
`tool.pyproject2conda.envs.env_name`).

## v0.8.0 — 2023-10-02

### Added
Expand Down
41 changes: 25 additions & 16 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ You can contribute in many ways:

## Types of Contributions

<!-- prettier-ignore-start -->
[issues]: https://github.com/usnistgov/pyproject2conda/issues
<!-- prettier-ignore-end -->

### Report Bugs

Expand All @@ -31,9 +33,9 @@ and "help wanted" is open to whoever wants to implement it.

### Write Documentation

`pyproject2conda` could always use more documentation, whether as part of the
official `pyproject2conda` docs, in docstrings, or even on the web in blog
posts, articles, and such.
This project could always use more documentation, whether as part of the
official docs, in docstrings, or even on the web in blog posts, articles, and
such.

### Submit Feedback

Expand All @@ -48,10 +50,9 @@ If you are proposing a feature:

## Making a contribution

Ready to contribute? Here's how to set up `pyproject2conda` for local
development.
Ready to contribute? Here's how to make a contribution.

- Fork the `pyproject2conda` repo on GitHub.
- Fork the repo on GitHub.

- Clone your fork locally:

Expand Down Expand Up @@ -278,6 +279,8 @@ where commands can be one of:
[ghp-import](https://github.com/c-w/ghp-import))
- livehtml : Live documentation updates
- open : open the documentation in a web browser
- serve : Serve the created documentation webpage (Need this to view javescript
in created pages).

## Testing with nox

Expand Down Expand Up @@ -517,22 +520,23 @@ Before you submit a pull request, check that it meets these guidelines:

[setuptools_scm]: https://github.com/pypa/setuptools_scm

Versioning is handled with [setuptools_scm].The package version is set by the
Versioning is handled with [setuptools_scm]. The package version is set by the
git tag. For convenience, you can override the version with nox setting
`--version ...`. This is useful for updating the docs, etc.

We use the `write_to` option to [setuptools_scm]. This stores the current
version in `_version.py`. Note that if you build the package (or, build docs
with the `--version` flag), this will overwrite information in `_version.py` in
the `src` directory. To refresh the version, run:
Note that the version in a given environment/session can become stale. The
easiest way to update the installed package version version is to reinstall the
package. This can be done using the following:

```bash
make version-scm
pip install -e . --no-deps
```

Note also that the file `_version.py` SHOULD NOT be tracked by git. It will be
autogenerated when building the package. This scheme avoids having to install
`setuptools-scm` (and `setuptools`) in each environment.
To do this in a given session, use:

```bash
nox -s {session} -- -P/--update-package
```

## Serving the documentation

Expand All @@ -542,4 +546,9 @@ To view to documentation with js headers/footers, you'll need to serve them:
python -m http.server -d docs/_build/html
```
Then open the address `localhost:8000` in a webbrowser.
Then open the address `localhost:8000` in a webbrowser. Alternatively, you can
run:
```bash
nox -s docs -- -d serve
```
13 changes: 9 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,9 @@ version-scm: ## check/update version of package with setuptools-scm
version-import: ## check version from python import
-python -c 'import pyproject2conda; print(pyproject2conda.__version__)'

version-update: ## update version using nox
nox -s update-version-scm

version: version-scm version-import

################################################################################
Expand All @@ -149,9 +152,10 @@ version: version-scm version-import
.PHONY: requirements
requirements: ## rebuild all requirements/environment files
nox -s requirements

requirements/%.yaml: pyproject.toml requirements
requirements/%.txt: pyproject.toml requirements
requirements/%.yaml: pyproject.toml
nox -s requirements
requirements/%.txt: pyproject.toml
nox -s requirements

################################################################################
# * NOX
Expand Down Expand Up @@ -283,7 +287,8 @@ pytest-nbval: ## run pytest --nbval

.PHONY: cog-readme
cog-readme: ## apply cog to README.md
P2C_COLUMNS=100 cog -rP README.md
# P2C_COLUMNS=100 cog -rP README.md
nox -s cog
pre-commit run markdownlint --files README.md

# NOTE: Some special stuff for README.pdf
Expand Down
36 changes: 30 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -507,6 +507,18 @@ python = ["3.10"]
user_config = "config/userconfig.toml"
default_envs = ["test", "dev", "dist-pypi"]
[tool.pyproject2conda.envs.base]
style = ["requirements"]
# Note that the default value for `extras` is the name of the environment.
# To have no extras, either pass
# extras = []
# or
#
extras = false
#
# A value of `extras = true` also implies using the environment name
# as the extras.
[tool.pyproject2conda.envs."test-extras"]
extras = ["test"]
style = ["yaml", "requirements"]
Expand Down Expand Up @@ -610,6 +622,18 @@ python = ["3.10"]
user_config = "config/userconfig.toml"
default_envs = ["test", "dev", "dist-pypi"]
[tool.pyproject2conda.envs.base]
style = ["requirements"]
# Note that the default value for `extras` is the name of the environment.
# To have no extras, either pass
# extras = []
# or
#
extras = false
#
# A value of `extras = true` also implies using the environment name
# as the extras.
[tool.pyproject2conda.envs."test-extras"]
extras = ["test"]
style = ["yaml", "requirements"]
Expand All @@ -629,11 +653,16 @@ python = ["3.10", "3.11"]
run through the command `pyproject2conda project` (or `p2c project`):
<!-- markdownlint-disable-next-line MD013 -->
<!-- [[[cog run_command("p2c project -f tests/data/test-pyproject.toml --dry", wrapper="bash", bounds=(None, 45))]]] -->
<!-- [[[cog run_command("p2c project -f tests/data/test-pyproject.toml --dry ", wrapper="bash", bounds=(None, 45))]]] -->
```bash
$ p2c project -f tests/data/test-pyproject.toml --dry
# --------------------
# Creating requirements base.txt
athing
bthing
cthing;python_version<'3.10'
# --------------------
# Creating yaml py310-test-extras.yaml
channels:
- conda-forge
Expand Down Expand Up @@ -673,11 +702,6 @@ dependencies:
- python=3.11
- bthing-conda
- conda-forge::pytest
- pandas
- pip
- pip:
- athing
# --------------------
...
```
Expand Down
8 changes: 6 additions & 2 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@
# "sphinx_design"
## myst stuff
"myst_nb",
# project specific
"sphinx_click",
]

Expand Down Expand Up @@ -114,7 +113,10 @@
# nb_execution_mode = "auto"

# set the kernel name
nb_kernel_rgx_aliases = {"pyproject2conda.*": "python3", "conda.*": "python3"}
nb_kernel_rgx_aliases = {
"pyproject2conda.*": "python3",
"conda.*": "python3",
}

nb_execution_allow_errors = True

Expand Down Expand Up @@ -478,7 +480,9 @@ def linkcode_resolve(domain, info):
else:
linespec = ""

# fmt: off
fn = os.path.relpath(fn, start=os.path.dirname(pyproject2conda.__file__))
# fmt: on

return f"https://github.com/{github_username}/pyproject2conda/blob/{html_context['github_version']}/src/pyproject2conda/{fn}{linespec}"

Expand Down
Loading

0 comments on commit 03110e6

Please sign in to comment.