Skip to content

Commit

Permalink
Merge branch 'main' into 2.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
remi-braun committed Dec 17, 2024
2 parents 829ef81 + 08e1367 commit dac6505
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 11 deletions.
23 changes: 13 additions & 10 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,25 @@ jobs:
name: Build and publish to PyPI
runs-on: ubuntu-latest
environment:
name: release
name: release
permissions:
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
steps:
- name: Checkout source
uses: actions/checkout@v4

- name: Set up Python 3.9
uses: actions/setup-python@v5
with:
python-version: "3.9"
# Get history and tags for SCM versioning to work
fetch-depth: 0
- name: Install the latest version of uv with cache enabled
uses: astral-sh/setup-uv@v3
with:
version: "latest"
enable-cache: true
cache-dependency-glob: ""

- name: Check that the current version isn't already on PyPI
- name: Check that the current version isn't already on PyPi
run: |
if [ "$(./get_pypi_latest_version.sh)" != "$(python setup.py --version)" ]
if [ "$(./get_pypi_latest_version.sh)" != "$(git describe --tags)" ]
then
echo "Current version is not on PyPI, proceed with bulding"
else
Expand All @@ -34,8 +38,7 @@ jobs:
fi
- name: Build a binary wheel and a source tarball
run: |
python -m pip install setuptools wheel methodtools
python setup.py sdist bdist_wheel
run: uvx --from build pyproject-build --sdist --wheel

- name: Publish distribution to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
2 changes: 2 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
- **ENH: Drop `isort`, `black` and `flake8` and use `ruff`**
- **ENH: Use `pyproject.toml` instead of `setup.py`**
- FIX: Fix too broad exception in case of `geopandas >= 1.0`
- FIX: Fix deprecation warning for `get_nodata_value_from_dtype` in `rasters_rio`
- OPTIM: Compute the spatial index by default in `vectors.read` (set `vectors.read(..., compute_sindex=False)` if you don't want to compute them)

## 1.44.1 (2024-12-12)

Expand Down
10 changes: 9 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,11 @@ Bug_Tracker = "https://github.com/sertit/sertit-utils/issues"
Documentation = "https://sertit-utils.readthedocs.io/en/latest/"
Source_Code = "https://github.com/sertit/sertit-utils"

[tool.ruff]
exclude = [
"docs"
]

[tool.ruff.lint]
select = [
# pycodestyle
Expand All @@ -85,11 +90,14 @@ select = [
]
ignore = ["E501"]

[tool.ruff.lint.pyupgrade]
# Preserve types, even if a file imports `from __future__ import annotations`.
keep-runtime-typing = true

# Pytest options
[tool.pytest.ini_options]
log_cli = true
log_cli_format = "%(asctime)s - [%(levelname)s] - %(message)s"
log_cli_format = "%(name)s: %(asctime)s - [%(levelname)s] - %(message)s"
log_cli_date_format = "%Y-%m-%d %H:%M:%S"
log_cli_level = "INFO"

Expand Down
5 changes: 5 additions & 0 deletions sertit/vectors.py
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,7 @@ def read(
In case of an iterable, assumption is made it corresponds to geographic bounds. Mimics :code:`rasters.read(..., window=)`. If given, :code:`bbox` is ignored.
**kwargs: Additional arguments used in gpd.read_file.
You can also give :code:`file_list`, the list of files of the archive to get the vector from, as this operation is expensive when done with large archives stored on the cloud.
You can also set :code:`compute_sindex=False` to avoid computing the spatial index of the vector.
Returns:
gpd.GeoDataFrame: Read vector as a GeoDataFrame
Expand Down Expand Up @@ -477,6 +478,10 @@ def read(
vect.attrs["path"] = str(vector_path)
vect.attrs["name"] = path.get_filename(vector_path)

# Generate spatial index for optimization
if kwargs.get("compute_sindex", True) and not vect.has_sindex:
vect.sindex # noqa

return vect


Expand Down

0 comments on commit dac6505

Please sign in to comment.