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
4 changes: 2 additions & 2 deletions .github/workflows/apptainer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ on:
- "*.def"
- "swvo/**"
- "pyproject.toml"
- "requirements.txt"
- "uv.lock"
- "download_daily_files.py"
- ".github/workflows/apptainer.yml"
pull_request:
Expand All @@ -20,7 +20,7 @@ on:
- "*.def"
- "swvo/**"
- "pyproject.toml"
- "requirements.txt"
- "uv.lock"
- "download_daily_files.py"
- ".github/workflows/apptainer.yml"
workflow_dispatch:
Expand Down
48 changes: 0 additions & 48 deletions .github/workflows/claude-code-review.yml

This file was deleted.

54 changes: 0 additions & 54 deletions .github/workflows/claude.yml

This file was deleted.

9 changes: 5 additions & 4 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,15 @@ jobs:

- name: Install uv
uses: astral-sh/setup-uv@main
with:
enable-cache: true

- name: Set up Python
run: uv python install

- name: Install project and ty
run: |
uv venv
uv pip install . ty -U
uv sync --locked
echo "$PWD/.venv/bin" >> "$GITHUB_PATH"

- name: Run ty
Expand All @@ -58,11 +59,11 @@ jobs:
uses: astral-sh/setup-uv@v7
with:
python-version: ${{ matrix.python-version }}
enable-cache: true

- name: Install dependencies
run: |
uv venv
uv pip install .
uv sync --locked
uv pip install coveralls coverage pytest-cov

- name: Run tests
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ docs/_build/*
docs/api/*
.nfs*
.env
uv.lock


**/.DS_Store
*.sif
5 changes: 5 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,18 @@
# SPDX-License-Identifier: Apache-2.0

repos:
- repo: https://github.com/astral-sh/uv-pre-commit
rev: 0.12.10
hooks:
- id: uv-lock
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v6.0.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files
exclude: ^uv\.lock$
- id: check-toml
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
Expand Down
6 changes: 4 additions & 2 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,7 @@ sphinx:
# See https://docs.readthedocs.io/en/stable/guides/reproducible-builds.html
python:
install:
- requirements: docs/requirements.txt
- requirements: requirements.txt
- method: pip
path: .
extra_requirements:
- docs
44 changes: 0 additions & 44 deletions install.sh

This file was deleted.

32 changes: 29 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,38 @@ classifiers = [
'Operating System :: Unix',
'Operating System :: MacOS',
]
dynamic = ["dependencies", "optional-dependencies", "version"]

dependencies = [
"astropy>=7.2.0",
"beautifulsoup4",
"csem-midl>=1.1.2",
"distance>=0.1.3",
"icecream>=2.1.10",
"ipython",
"mat73>=0.65",
"matplotlib>=3.10.8",
"netcdf4>=1.7.2",
"numpy>=2.4.2",
"pandas>=2.3",
"python-dateutil",
"requests>=2.32.5",
"rich",
"richpool",
"scipy>=1.17.0",
"sunpy>=7.0.5",
"tqdm>=4.67.3",
"wget>=3.2",
"xarray>=2025.1.0",
"pytest>=9.0.2",
"pytest-mock>=3.15.1",
"reuseify",
"ruff",
"ty",
"pre-commit",
]
dynamic = ["optional-dependencies", "version"]

[tool.setuptools.dynamic]
version = { attr = "swvo.__version__" }
dependencies = { file = ["requirements.txt"] }
optional-dependencies.docs = { file = ["docs/requirements.txt"] }

[project.urls]
Expand Down
29 changes: 0 additions & 29 deletions requirements.txt

This file was deleted.

7 changes: 0 additions & 7 deletions run_downloads.sh

This file was deleted.

5 changes: 3 additions & 2 deletions swvo.def
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ From: astral/uv:python3.12-bookworm-slim
%files
swvo /opt/swvo/
pyproject.toml /opt/swvo/
requirements.txt /opt/swvo/
uv.lock /opt/swvo/
docs/requirements.txt /opt/swvo/docs/requirements.txt
download_daily_files.py /opt/swvo/

%environment
Expand All @@ -36,7 +37,7 @@ From: astral/uv:python3.12-bookworm-slim
export XDG_CONFIG_HOME

cd /opt/swvo/
uv sync
uv sync --locked

%runscript
exec "$@"
14 changes: 7 additions & 7 deletions swvo/io/kp/bgs.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,16 +75,16 @@ def download_and_process(self, request_time: Optional[datetime] = None, reproces

self._resolved_urls = []

temporary_dir = Path("./temp_kp_bgs_wget")
temporary_dir.mkdir(exist_ok=True, parents=True)

logger.debug(f"Downloading file {self.URL} ...")

file_path = self.data_dir / request_time.strftime("%Y") / f"BGS_KP_FORECAST_{request_time.strftime('%Y%m')}.csv"

if file_path.exists() and not reprocess_files:
return

logger.debug(f"Downloading file {self.URL} ...")

temporary_dir = Path("./temp_kp_bgs_wget")
temporary_dir.mkdir(exist_ok=True, parents=True)

tmp_path = file_path.with_suffix(file_path.suffix + ".tmp")
try:
logger.info(f"Downloading file for {request_time.strftime('%Y-%m')} from {self.URL}")
Expand All @@ -109,8 +109,8 @@ def download_and_process(self, request_time: Optional[datetime] = None, reproces
if tmp_path.exists():
tmp_path.unlink()
return

rmtree(temporary_dir, ignore_errors=True)
finally:
rmtree(temporary_dir, ignore_errors=True)

def _download(self, temporary_dir: Path, request_time: datetime) -> None:
"""Download BGS Kp data for a specific month.
Expand Down
1 change: 0 additions & 1 deletion tests/io/hp/test_hp.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,6 @@ def test_download_and_process(self, hp30gfz, mocker):
mock_response.raise_for_status = Mock()
mock_get = mocker.patch("swvo.io.hp.gfz.requests.get", return_value=mock_response)

mocker.patch("swvo.io.hp.gfz.rmtree")
mocker.patch.object(hp30gfz, "_process_single_file", return_value=pd.DataFrame())

hp30gfz.download_and_process(start_time, end_time)
Expand Down
Loading
Loading