Skip to content

Commit

Permalink
Decouple pyproject.toml and requirements.txt.
Browse files Browse the repository at this point in the history
Cross-package dependencies will be easier to maintain if the lower bound in `pyproject.toml` doesn't have to always track `requirements.txt`.
  • Loading branch information
blakeNaccarato committed Aug 7, 2023
1 parent 3e46b6d commit 8106784
Show file tree
Hide file tree
Showing 15 changed files with 152 additions and 222 deletions.
15 changes: 7 additions & 8 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,27 +9,24 @@ jobs:
pyright:
runs-on: "ubuntu-latest"
steps:
- uses: "blakeNaccarato/copier-python-workflow-setup@v0.1.0"
- uses: "blakeNaccarato/copier-python-workflow-setup@v0.2.0"
with:
python-version: "3.11"
- run: "pip install --no-deps --requirement .tools/requirements/requirements_nodeps.txt"
- run: ".tools/scripts/Invoke-Pyright.ps1"
shell: "pwsh"
ruff:
runs-on: "ubuntu-latest"
steps:
- uses: "blakeNaccarato/copier-python-workflow-setup@v0.1.0"
- uses: "blakeNaccarato/copier-python-workflow-setup@v0.2.0"
with:
python-version: "3.11"
- run: "pip install --no-deps --requirement .tools/requirements/requirements_nodeps.txt"
- run: "ruff --no-fix --format github ."
pytest:
runs-on: "ubuntu-latest"
steps:
- uses: "blakeNaccarato/copier-python-workflow-setup@v0.1.0"
- uses: "blakeNaccarato/copier-python-workflow-setup@v0.2.0"
with:
python-version: "3.11"
- run: "pip install --no-deps --requirement .tools/requirements/requirements_nodeps.txt"
- name: Install PySide6 system dependencies
run: |
# https://askubuntu.com/questions/900285/libegl-so-1-is-not-a-symbolic-link
Expand All @@ -41,13 +38,15 @@ jobs:
needs: ["pyright", "ruff", "pytest"]
runs-on: "ubuntu-latest"
steps:
- uses: "blakeNaccarato/copier-python-workflow-setup@v0.1.0"
- uses: "blakeNaccarato/copier-python-workflow-setup@v0.2.0"
with:
python-version: "3.11"
install-project: false
- run: "copier update --defaults --vcs-ref $(git rev-parse HEAD:template)"
shell: "pwsh"
- uses: "stefanzweifel/git-auto-commit-action@v4.16.0"
with:
commit_message: "Bump project template and compose `pyproject.toml`."
commit_message: "Update project from template."

# * ------------------------------------------------------------------------------ * #
# * Changes below should persist in significant template updates.
3 changes: 2 additions & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@ jobs:
publish:
runs-on: "ubuntu-latest"
steps:
- uses: "blakeNaccarato/copier-python-workflow-setup@v0.1.0"
- uses: "blakeNaccarato/copier-python-workflow-setup@v0.2.0"
with:
python-version: "3.11"
install-project: false
- run: "flit publish"
env:
FLIT_USERNAME: "__token__"
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/sphinx.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,9 @@ jobs:
build:
runs-on: "ubuntu-latest"
steps:
- uses: "blakeNaccarato/copier-python-workflow-setup@v0.1.0"
- uses: "blakeNaccarato/copier-python-workflow-setup@v0.2.0"
with:
python-version: "3.11"
- run: "pip install --no-deps --requirement .tools/requirements/requirements_nodeps.txt"
- run: "python -m sphinx -T -E docs _site"
- uses: "actions/upload-pages-artifact@v1.0.8"
deploy:
Expand Down
14 changes: 0 additions & 14 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ ci:
- "pre-repro"
# - "hide-notebook-inputs"
- "update-warning-filters"
- "compose-pyproject"
# - "pyright"
- "pytest-fast-only"
# - "pytest-slow-only"
Expand Down Expand Up @@ -57,17 +56,6 @@ repos:
(?x)^(
warning_filters.py
)$
- id: "compose-pyproject"
name: "compose-pyproject"
pass_filenames: false
language: "system"
entry: "pwsh -Command python .tools/scripts/compose_pyproject.py"
files: |
(?x)^(
pyproject.toml
|requirements.txt
|.tools/pyproject.toml
)$
# - id: "pyright"
# name: "pyright"
# pass_filenames: false
Expand All @@ -78,7 +66,6 @@ repos:
# src/.*
# |tests/.*
# |pyproject.toml
# |requirements.txt
# |.tools/(
# pyproject.toml
# |requirements/.*
Expand All @@ -99,7 +86,6 @@ repos:
src/.*
|tests/.*
|requirements.txt
|.tools/(
pyproject.toml
|requirements/.*
Expand Down
130 changes: 0 additions & 130 deletions .tools/pyproject.toml

This file was deleted.

6 changes: 5 additions & 1 deletion requirements.txt → .tools/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,11 @@ sparklines==0.4.2
sympy==1.12
trackpy==0.6.1
xarray[accel,io,parallel]==2023.7.0
# Numba only supports numpy<1.25 https://github.com/numba/numba/issues/8698
# ! Unpin numba once it supports numpy>=1.25
# ? Numba only supports numpy<1.25 https://github.com/numba/numba/issues/8698
numba==0.57.1
numpy==1.24.4
# ! Consider switching to pims instead
git+https://github.com/blakeNaccarato/boilercine@main
# ! Pin the merge commit in master once it is merged
git+https://github.com/1313e/CMasher@mpl_future_proofing
3 changes: 0 additions & 3 deletions .tools/requirements/requirements_both.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
# * -------------------------------------------------------------------------------- * #
# * Changes below should persist in significant template updates.

git+https://github.com/blakeNaccarato/boilercine@main
git+https://github.com/blakeNaccarato/CMasher@fc5cb882562019f374aa5616ddf103730021a3ce

# * -------------------------------------------------------------------------------- * #
# * Changes below may be lost in significant template updates.

Expand Down
1 change: 0 additions & 1 deletion .tools/scripts/Copy-Template.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,3 @@ else {
git submodule deinit template
copier update $(if ($Defaults) { '--defaults' })
}
python '.tools/scripts/compose_pyproject.py'
1 change: 1 addition & 0 deletions .tools/scripts/Invoke-Pyright.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ $NbqaPyrightExitCode = $LastExitCode
if (($PyrightExitCode -ne 0) -or ($NbqaPyrightExitCode -ne 0)) {
Exit $PyrightExitCode -or $NbqaPyrightExitCode
}
git submodule deinit typings
18 changes: 0 additions & 18 deletions .tools/scripts/compose_pyproject.py

This file was deleted.

18 changes: 5 additions & 13 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@
"label": "dvc: freeze",
"type": "shell",
"options": { "shell": { "executable": "pwsh", "args": ["-Command"] } },
"command": "pip freeze --requirement requirements.txt --local --exclude-editable > repro.txt",
"command": "pip freeze --requirement .tools/requirements/requirements.txt --local --exclude-editable > repro.txt",
"icon": { "id": "graph" },
"problemMatcher": []
},
Expand Down Expand Up @@ -263,14 +263,6 @@

// * -------------------------------------------------------------------------- * //
// * PROJECT SETUP * //
{
"label": "setup: Compose pyproject.toml",
"type": "shell",
"options": { "shell": { "executable": "pwsh", "args": ["-Command"] } },
"command": "python .tools/scripts/compose_pyproject.py",
"icon": { "id": "file-symlink-directory" },
"problemMatcher": []
},
{
"label": "setup: Copy template",
"type": "shell",
Expand All @@ -282,15 +274,15 @@
{
"label": "setup: Setup project",
"type": "shell",
"options": { "shell": { "executable": "pwsh", "args": ["-Command"] } },
"options": { "shell": { "executable": "pwsh" } },
"command": "setup.ps1",
"icon": { "id": "file-symlink-directory" },
"problemMatcher": []
},
{
"label": "setup: Update project",
"type": "shell",
"options": { "shell": { "executable": "pwsh", "args": ["-Command"] } },
"options": { "shell": { "executable": "pwsh" } },
"command": "update.ps1",
"icon": { "id": "file-symlink-directory" },
// "runOptions": {
Expand All @@ -301,7 +293,7 @@
{
"label": "setup: Perform first-time setup",
"type": "shell",
"options": { "shell": { "executable": "pwsh", "args": ["-Command"] } },
"options": { "shell": { "executable": "pwsh" } },
"command": "first_time_setup.ps1",
"icon": { "id": "file-symlink-directory" },
"problemMatcher": []
Expand Down Expand Up @@ -457,7 +449,7 @@
{
"label": "task: Invoke pyright",
"type": "shell",
"options": { "shell": { "executable": "pwsh", "args": ["-Command"] } },
"options": { "shell": { "executable": "pwsh" } },
"command": ".tools/scripts/Invoke-Pyright.ps1",
"icon": { "id": "type-hierarchy-sub" },
"problemMatcher": []
Expand Down
1 change: 0 additions & 1 deletion params.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
project_paths:
project: .
requirements: requirements.txt
dev_requirements: .tools/requirements
package: src/boilercv
stages: src/boilercv/stages
Expand Down
Loading

0 comments on commit 8106784

Please sign in to comment.