Skip to content
Open
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
19 changes: 3 additions & 16 deletions .github/workflows/deptry.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,6 @@ jobs:
- uses: actions/checkout@v4
# Setup the minimum required python distribution
- uses: actions/setup-python@v5
with:
python-version: "3.13"
# Install deptry
- run: pip install deptry
# Remove testing related packages
- run: sed -e '/hypothesis*/d' -e '/pytest*/d' -i requirements.txt
# Install all other packages
- run: pip install -r requirements.txt
# Remove pyproject.toml so that deptry doesn't get confused
- run: rm pyproject.toml
# Remove the pytest modules because they are for testing only.
- run: sed -i -e '/pytest/d' -e '/hypothesis/d' -e '/diffimg/d' requirements.txt
# Install requirements
- run: pip install -r requirements.txt
# Run deptry to check that all dependencies are present.
- run: deptry .
- name: Setup uv
uses: astral-sh/setup-uv@v5
- run: uv run --all-extras deptry .
70 changes: 50 additions & 20 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,41 @@ authors = [{ name = "QuakeCoRE" }]
description = "Visualisation repository for plotting scripts."
readme = "README.md"
requires-python = ">=3.12"
dynamic = ["version", "dependencies"]
dynamic = ["version"]
dependencies = [
"cartopy",
"matplotlib",
"numpy",
"ffmpeg-python",
"pygmt",
"pygmt-helper>=2025.12.1",
"source-modelling>=2025.12.1",
"workflow @ git+https://github.com/ucgmsim/workflow.git@pegasus",
"qcore-utils>=2025.12.2",
"geopandas",
"pandas",
"shapely",
"scipy >= 1.15.0",
"pooch",
"typer",
"tqdm",
]
Comment on lines +12 to +29
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

For better maintainability and to avoid potential merge conflicts, it's a good practice to keep the main dependency list sorted alphabetically.

Suggested change
dependencies = [
"cartopy",
"matplotlib",
"numpy",
"ffmpeg-python",
"pygmt",
"pygmt-helper>=2025.12.1",
"source-modelling>=2025.12.1",
"workflow @ git+https://github.com/ucgmsim/workflow.git@pegasus",
"qcore-utils>=2025.12.2",
"geopandas",
"pandas",
"shapely",
"scipy >= 1.15.0",
"pooch",
"typer",
"tqdm",
]
dependencies = [
"cartopy",
"ffmpeg-python",
"geopandas",
"matplotlib",
"numpy",
"pandas",
"pooch",
"pygmt",
"pygmt-helper>=2025.12.1",
"qcore-utils>=2025.12.2",
"scipy >= 1.15.0",
"shapely",
"source-modelling>=2025.12.1",
"tqdm",
"typer",
"workflow @ git+https://github.com/ucgmsim/workflow.git@pegasus",
]



[project.optional-dependencies]
test = [
"diffimg",
"pytest",
"pytest-cov",
"hypothesis[pandas, numpy]",
"hypothesis-networkx",
]
Comment on lines +33 to +39
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The pytest-xdist dependency, which was present in the old requirements.txt, seems to be missing from the new test optional dependencies. Was its removal intentional? If not, it should be added back to ensure tests can be run in parallel. For consistency and maintainability, it's also a good idea to keep this list sorted alphabetically.

Suggested change
test = [
"diffimg",
"pytest",
"pytest-cov",
"hypothesis[pandas, numpy]",
"hypothesis-networkx",
]
test = [
"diffimg",
"hypothesis[pandas, numpy]",
"hypothesis-networkx",
"pytest",
"pytest-cov",
"pytest-xdist",
]

types = ["types-geopandas", "types-shapely", "scipy-stubs", "pandas-stubs"]
dev = ["ty", "ruff", "deptry"]


[tool.deptry]
pep621_dev_dependency_groups = ["test", "dev", "types"]


[project.scripts]
Expand All @@ -25,13 +59,11 @@ plot-1d-velocity-model = "visualisation.plot_1d_velocity_model:app"
plot-rupture-path = "visualisation.plot_rupture_path:app"
plot-stoch = "visualisation.sources.plot_stoch:app"
plot-ts = "visualisation.plot_ts:app"
plot-realisation = "visualisation.realisation:app"

[tool.setuptools.package-dir]
visualisation = "visualisation"

[tool.setuptools.dynamic]
dependencies = { file = ["requirements.txt"] }

[tool.ruff.lint]
extend-select = [
# isort imports
Expand All @@ -53,7 +85,7 @@ extend-select = [
# Missing function argument type-annotation
"ANN001",
# Using except without specifying an exception type to catch
"BLE001"
"BLE001",
]
ignore = ["D104"]

Expand All @@ -62,15 +94,15 @@ convention = "numpy"

[tool.ruff.lint.isort]
known-first-party = [
"source_modelling",
"visualisation",
"workflow",
"pygmt_helper",
"qcore",
"empirical",
"nshmdb",
"IM_calculation",
"mera"
"source_modelling",
"visualisation",
"workflow",
"pygmt_helper",
"qcore",
"empirical",
"nshmdb",
"IM_calculation",
"mera",
]

[tool.ruff.lint.per-file-ignores]
Expand All @@ -80,9 +112,7 @@ known-first-party = [
"tests/**.py" = ["D"]

[tool.coverage.run]
omit = [
"visualisation/plot_ts.py"
]
omit = ["visualisation/plot_ts.py"]

[tool.numpydoc_validation]
checks = [
Expand All @@ -103,7 +133,7 @@ checks = [
"YD01",
]
# remember to use single quotes for regex in TOML
exclude = [ # don't report on objects that match any of these regex
'\.undocumented_method$',
'\.__repr__$',
exclude = [ # don't report on objects that match any of these regex
'\.undocumented_method$',
'\.__repr__$',
]
20 changes: 0 additions & 20 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,20 +0,0 @@
diffimg
cartopy
matplotlib
numpy
ffmpeg-python
pygmt
pygmt_helper @ git+https://github.com/ucgmsim/pygmt_helper.git
source_modelling @ git+https://github.com/ucgmsim/source_modelling.git
workflow @ git+https://github.com/ucgmsim/workflow.git@pegasus
qcore @ git+https://github.com/ucgmsim/qcore.git
geopandas
pandas
shapely
scipy >= 1.15.0
pooch
pytest
pytest-cov
pytest-xdist
typer
tqdm
4 changes: 0 additions & 4 deletions tests/test_plots.py
Original file line number Diff line number Diff line change
Expand Up @@ -290,10 +290,6 @@ def test_plot_velocity_model(
{"show_geometry": False},
"alpine_base_1_no_geometry.png",
),
(
{"pgv_targets": [5.0, 1.0]},
"alpine_base_1_pgv_targets.png",
),
(
{"stations": STATIONS_FFP},
"alpine_base_1_stations.png",
Expand Down
Loading
Loading