Skip to content
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
2 changes: 1 addition & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,5 @@
// Mount the parent as /workspaces so we can pip install peers as editable
"workspaceMount": "source=${localWorkspaceFolder}/..,target=/workspaces,type=bind",
// After the container is created, install the python project in editable form
"postCreateCommand": "pip install -c dev-requirements.txt -e '.[dev]'"
"postCreateCommand": "pip install -c requirements/constraints.txt -e '.[dev]'"
}
2 changes: 1 addition & 1 deletion .github/workflows/_docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
python-version: "3.11"

- name: Install python packages
run: pip install -c dev-requirements.txt -e .[dev]
run: pip install -c requirements/constraints.txt -e .[dev]

- name: Build docs
run: tox -e docs
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/_tox.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
python-version: "3.11"

- name: Install python packages
run: pip install -c dev-requirements.txt -e .[dev]
run: pip install -c requirements/constraints.txt -e .[dev]

- name: Run tox
run: tox -e ${{ inputs.tox }}
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,6 @@ repos:
- id: constraints
name: check constraints match installed
language: system
entry: pip-compile
files: ^(pyproject\.toml|dev-requirements\.txt)$
entry: ./requirements/regenerate.sh --if-non-empty
files: ^(pyproject\.toml|requirements/constraints\.txt)$
pass_filenames: false
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Releases | <https://github.com/DiamondLightSource/python-copier-template/
It integrates the following tools:

- [setuptools](https://setuptools.pypa.io) and [setuptools-scm](https://setuptools-scm.readthedocs.io) for packaging
- [pip](https://pip.pypa.io) and [pip-compile](https://pip-tools.readthedocs.io) to manage installation
- [pip](https://pip.pypa.io) to manage installation
- [pytest](https://docs.pytest.org) for code testing and coverage
- [pre-commit](https://pre-commit.com) to run linting and formatting such as [ruff](https://docs.astral.sh/ruff)
- [pyright](https://microsoft.github.io/pyright) for static type checking
Expand Down
2 changes: 1 addition & 1 deletion docs/how-to/dev-install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ requires python 3.8 or later) or to run in a container under `VSCode
$ cd python3-pip-skeleton-cli
$ python3 -m venv venv
$ source venv/bin/activate
$ pip install -c dev-requirements.txt -e .[dev]
$ pip install -c requirements/constraints.txt -e .[dev]

.. tab-item:: VSCode devcontainer

Expand Down
11 changes: 0 additions & 11 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ dynamic = ["version"]
dev = [
"copier",
"myst-parser",
"pip-tools",
"pre-commit",
"pydata-sphinx-theme>=0.12",
"pytest",
Expand Down Expand Up @@ -60,13 +59,3 @@ select = [
"W", # pycodestyle warnings - https://beta.ruff.rs/docs/rules/#warning-w
"I", # isort - https://docs.astral.sh/ruff/rules/#isort-i
]

[tool.pip-tools]
src-files = ["pyproject.toml"]
extras = ["dev"]
output-file = "dev-requirements.txt"
quiet = true
# Make output suitable for use as a constraints file
strip-extras = true
# Remove annotations as coverage source seems to make false positive in CI
annotate = false
35 changes: 10 additions & 25 deletions dev-requirements.txt → requirements/constraints.txt
Original file line number Diff line number Diff line change
@@ -1,19 +1,11 @@
#
# This file is autogenerated by pip-compile with Python 3.11
# by the following command:
#
# pip-compile --extra=dev --no-annotate --output-file=dev-requirements.txt --strip-extras
#
accessible-pygments==0.0.4
alabaster==0.7.16
annotated-types==0.6.0
babel==2.14.0
beautifulsoup4==4.12.3
build==1.0.3
Babel==2.14.0
beautifulsoup4==4.12.2
certifi==2023.11.17
cfgv==3.4.0
charset-normalizer==3.3.2
click==8.1.7
colorama==0.4.6
copier==9.1.1
decorator==5.1.1
Expand All @@ -26,43 +18,41 @@ identify==2.5.33
idna==3.6
imagesize==1.4.1
iniconfig==2.0.0
jinja2==3.1.3
Jinja2==3.1.3
jinja2-ansible-filters==1.3.2
livereload==2.6.3
markdown-it-py==3.0.0
markupsafe==2.1.4
MarkupSafe==2.1.4
mdit-py-plugins==0.4.0
mdurl==0.1.2
myst-parser==2.0.0
nodeenv==1.8.0
packaging==23.2
pathlib2==2.3.7.post1
pathspec==0.12.1
pip-tools==7.3.0
platformdirs==4.1.0
pluggy==1.3.0
plumbum==1.8.2
pre-commit==3.6.0
prompt-toolkit==3.0.36
py==1.11.0
pydantic==2.5.3
pydantic-core==2.14.6
pydantic_core==2.14.6
pydata-sphinx-theme==0.15.2
pygments==2.17.2
pyproject-hooks==1.0.0
Pygments==2.17.2
pytest==7.4.4
pyyaml==6.0.1
PyYAML==6.0.1
pyyaml-include==1.3.2
questionary==2.0.1
requests==2.31.0
ruff==0.1.14
six==1.16.0
snowballstemmer==2.2.0
soupsieve==2.5
sphinx==7.2.6
Sphinx==7.2.6
sphinx-autobuild==2021.3.14
sphinx-copybutton==0.5.2
sphinx-design==0.5.0
sphinx_design==0.5.0
sphinxcontrib-applehelp==1.0.8
sphinxcontrib-devhelp==1.0.6
sphinxcontrib-htmlhelp==2.0.5
Expand All @@ -72,12 +62,7 @@ sphinxcontrib-serializinghtml==1.1.10
tornado==6.4
tox==3.28.0
tox-direct==0.4
typing-extensions==4.9.0
typing_extensions==4.9.0
urllib3==2.1.0
virtualenv==20.25.0
wcwidth==0.2.13
wheel==0.42.0

# The following packages are considered to be unsafe in a requirements file:
# pip
# setuptools
26 changes: 26 additions & 0 deletions requirements/regenerate.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/bin/bash

CONSTRAINTS="$(dirname $0)/constraints.txt"
if [ "$#" -eq 0 ]; then
# Run with no args then always generate
pip freeze --exclude-editable > $CONSTRAINTS
elif [ "$1" == "--if-non-empty" ]; then
# Under pre-commit only generate if non empty
[ -s "$CONSTRAINTS" ] && pip freeze --exclude-editable > $CONSTRAINTS
else
# Not recognised, provide help
cat <<EOF
Usage: $(basename "$0") [options]

Regenerates the pip constraints that will be used to make sure the dev
environment and production environment are using the same superset of
dependencies.

Writes $CONSTRAINTS

Options:
--if-non-empty Only regenerate if the file is non-empty. Use this
under pre-commit to allow optional constraints.
EOF
exit 0;
fi