Skip to content

Commit

Permalink
Update the template and sync'ed style
Browse files Browse the repository at this point in the history
  • Loading branch information
alexamici committed Dec 19, 2024
1 parent c544713 commit 3a02250
Show file tree
Hide file tree
Showing 11 changed files with 60 additions and 20 deletions.
3 changes: 2 additions & 1 deletion .cruft.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"template": "https://github.com/ecmwf-projects/cookiecutter-conda-package",
"commit": "d379e35af1aa17d816367bcb0942fcf3e238be9d",
"commit": "8397fdf4e595402b3266e357ae5f53ebce99a0c9",
"checkout": null,
"context": {
"cookiecutter": {
Expand All @@ -11,6 +11,7 @@
"copyright_year": "2021",
"mypy_strict": true,
"integration_tests": true,
"pypi": true,
"_template": "https://github.com/ecmwf-projects/cookiecutter-conda-package"
}
},
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/on-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ jobs:
- name: Get current date
id: date
run: echo "date=$(date +%Y-%m-%d)" >> "${GITHUB_OUTPUT}"
- uses: mamba-org/setup-micromamba@v1
- uses: mamba-org/setup-micromamba@v2
with:
environment-file: ci/combined-environment-ci.yml
environment-name: DEVELOP
Expand Down Expand Up @@ -95,7 +95,7 @@ jobs:
- name: Get current date
id: date
run: echo "date=$(date +%Y-%m-%d)" >> "${GITHUB_OUTPUT}"
- uses: mamba-org/setup-micromamba@v1
- uses: mamba-org/setup-micromamba@v2
with:
environment-file: ci/combined-environment-ci.yml
environment-name: DEVELOP
Expand Down Expand Up @@ -124,7 +124,7 @@ jobs:
- name: Get current date
id: date
run: echo "date=$(date +%Y-%m-%d)" >> "${GITHUB_OUTPUT}"
- uses: mamba-org/setup-micromamba@v1
- uses: mamba-org/setup-micromamba@v2
with:
environment-file: ci/combined-environment-ci.yml
environment-name: DEVELOP
Expand Down Expand Up @@ -161,7 +161,7 @@ jobs:
- name: Get current date
id: date
run: echo "date=$(date +%Y-%m-%d)" >> "${GITHUB_OUTPUT}"
- uses: mamba-org/setup-micromamba@v1
- uses: mamba-org/setup-micromamba@v2
with:
environment-file: ci/combined-environment${{ matrix.extra }}.yml
environment-name: DEVELOP${{ matrix.extra }}
Expand Down Expand Up @@ -215,7 +215,7 @@ jobs:
runs-on: ubuntu-latest
needs: distribution
if: |
always() &&
always() && true &&
needs.distribution.result == 'success' &&
github.event_name == 'push' &&
startsWith(github.ref, 'refs/tags')
Expand All @@ -230,6 +230,6 @@ jobs:
with:
name: distribution
path: dist
- uses: pypa/gh-action-pypi-publish@v1.8.14
- uses: pypa/gh-action-pypi-publish@v1.12.3
with:
verbose: true
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
version.py

# Sphinx automatic generation of API
docs/README.md
docs/_api/

# Created by https://www.toptal.com/developers/gitignore/api/python,jupyternotebooks,vim,visualstudiocode,pycharm,emacs,linux,macos,windows
Expand Down
10 changes: 5 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
rev: v5.0.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
Expand All @@ -17,23 +17,23 @@ repos:
- id: blackdoc
additional_dependencies: [black==23.11.0]
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.1.13
rev: v0.8.3
hooks:
- id: ruff
args: [--fix, --show-fixes]
- id: ruff-format
- repo: https://github.com/executablebooks/mdformat
rev: 0.7.17
rev: 0.7.19
hooks:
- id: mdformat
- repo: https://github.com/macisamuele/language-formatters-pre-commit-hooks
rev: v2.12.0
rev: v2.14.0
hooks:
- id: pretty-format-yaml
args: [--autofix, --preserve-quotes]
- id: pretty-format-toml
args: [--autofix]
- repo: https://github.com/gitleaks/gitleaks
rev: v8.18.1
rev: v8.21.2
hooks:
- id: gitleaks
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ template-update:
pre-commit run --all-files cruft -c .pre-commit-config-cruft.yaml

docs-build:
cd docs && rm -fr _api && make clean && make html
cp README.md docs/. && cd docs && rm -fr _api && make clean && make html

# DO NOT EDIT ABOVE THIS LINE, ADD COMMANDS BELOW

Expand Down
2 changes: 2 additions & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,10 @@
autodoc_typehints = "none"

# autoapi configuration
autoapi_add_toctree_entry = False
autoapi_dirs = ["../xarray_sentinel"]
autoapi_ignore = ["*/version.py"]
autoapi_member_order = "groupwise"
autoapi_options = [
"members",
"inherited-members",
Expand Down
1 change: 1 addition & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ Easily access and explore the SAR data products of the Copernicus Sentinel-1 sat
:caption: 'Contents:'
:maxdepth: 2
README.md
API Reference <_api/xarray_sentinel/index>
```

Expand Down
5 changes: 4 additions & 1 deletion notebooks/fsspec.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,10 @@
"account_name = \"sentinel1euwest\"\n",
"token = planetary_computer.sas.get_token(account_name, \"s1-grd\").token\n",
"\n",
"product_folder = \"s1-grd/GRD/2022/1/10/IW/DV/S1A_IW_GRDH_1SDV_20220110T050922_20220110T050947_041394_04EBF7_A360\"\n",
"product_folder = (\n",
" \"s1-grd/GRD/2022/1/10/IW/DV/\"\n",
" \"S1A_IW_GRDH_1SDV_20220110T050922_20220110T050947_041394_04EBF7_A360\"\n",
")\n",
"\n",
"storage_options = {\"account_name\": \"sentinel1euwest\", \"sas_token\": token}\n",
"product_path = f\"abfs://{product_folder}/manifest.safe\"\n",
Expand Down
13 changes: 8 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
[build-system]
requires = ["setuptools>=45", "setuptools_scm[toml]>=6.2"]
build-backend = "setuptools.build_meta"
requires = ["setuptools>=64", "setuptools_scm>=8"]

[project]
authors = [{"name" = "B-Open", "email" = "[email protected]"}]
Expand Down Expand Up @@ -66,13 +67,15 @@ module = [
]

[tool.ruff]
# Same as Black.
indent-width = 4
line-length = 88

[tool.ruff.lint]
ignore = [
# pydocstyle: Missing Docstrings
"D1"
]
# Same as Black.
indent-width = 4
line-length = 88
select = [
# pyflakes
"F",
Expand All @@ -88,7 +91,7 @@ select = [
[tool.ruff.lint.pycodestyle]
max-line-length = 110

[tool.ruff.pydocstyle]
[tool.ruff.lint.pydocstyle]
convention = "numpy"

[tool.setuptools]
Expand Down
28 changes: 28 additions & 0 deletions pyproject.toml.rej
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
diff a/pyproject.toml b/pyproject.toml (rejected hunks)
@@ -1,5 +1,6 @@
[build-system]
-requires = ["setuptools>=45", "setuptools_scm[toml]>=6.2"]
+build-backend = "setuptools.build_meta"
+requires = ["setuptools>=64", "setuptools_scm>=8"]

[project]
classifiers = [
@@ -25,13 +26,15 @@ branch = true
strict = true

[tool.ruff]
+# Same as Black.
+indent-width = 4
+line-length = 88
+
+[tool.ruff.lint]
ignore = [
# pydocstyle: Missing Docstrings
"D1"
]
-# Same as Black.
-indent-width = 4
-line-length = 88
select = [
# pyflakes
"F",
3 changes: 2 additions & 1 deletion xarray_sentinel/sentinel1.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
- Sentinel-1 Product Specification v3.7 27 February 2020 S1-RS-MDA-52-7441 documenting IPF 3.30
https://sentinel.esa.int/documents/247904/1877131/Sentinel-1-Product-Specification
"""

from __future__ import annotations

import os
Expand Down Expand Up @@ -518,7 +519,7 @@ def open_rasterio_dataarray(
# fsspec needs rasterio >= 1.3.0, but we allow earlier rasterio versions for local files
if fs is None or isinstance(fs, fsspec.implementations.local.LocalFileSystem):
try:
arr = xr.open_dataarray(measurement, engine="rasterio", chunks=chunks) # type: ignore
arr = xr.open_dataarray(measurement, engine="rasterio", chunks=chunks)
except rasterio.RasterioIOError as ex:
if "No such file" in str(ex):
raise FileNotFoundError(str(ex))
Expand Down

0 comments on commit 3a02250

Please sign in to comment.