Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CI(Ubuntu): Install latest version of Python for full config #241

Open
wants to merge 14 commits into
base: main
Choose a base branch
from
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
2 changes: 1 addition & 1 deletion .github/workflows/pytest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ jobs:
coverage html

- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@7f8b4b4bde536c465e797be725718b88c5d95e0e # v5.1.1
uses: codecov/codecov-action@1e68e06f1dbfde0e4cefc87efeba9e4643565303 # v5.1.2
with:
verbose: true
flags: pytest-python-${{ matrix.python-version }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/python-code-quality.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
# renovate: datasource=pypi depName=bandit
BANDIT_VERSION: "1.8.0"
# renovate: datasource=pypi depName=ruff
RUFF_VERSION: "0.8.3"
RUFF_VERSION: "0.8.4"

runs-on: ${{ matrix.os }}
permissions:
Expand Down Expand Up @@ -146,7 +146,7 @@
- name: Set number of cores for compilation
run: |
echo "MAKEFLAGS=-j$(nproc)" >> $GITHUB_ENV

Check warning on line 149 in .github/workflows/python-code-quality.yml

View workflow job for this annotation

GitHub Actions / Python Code Quality Checks (ubuntu-22.04)

Temporarily downgraded pytest-pylint and pytest to allow merging other PRs. The errors reported with a newer version seem legitimite and should be fixed (2023-10-18, see https://github.com/OSGeo/grass/pull/3205) (2024-01-28, see https://github.com/OSGeo/grass/issues/3380)
- uses: rui314/setup-mold@bac87d5a5820d626ba77131fbbfbce77faf03b6e # v1
- name: Build
run: .github/workflows/build_${{ matrix.os }}.sh $HOME/install
Expand Down
16 changes: 15 additions & 1 deletion .github/workflows/ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -99,13 +99,28 @@ jobs:
}}:g' .gunittest.cfg > .gunittest.extra.cfg
cat .gunittest.extra.cfg

- name: Set up Python
if: ${{ matrix.config == 'ubuntu-22.04' }}
uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5.2.0
with:
python-version: 3.13
cache: pip
allow-prereleases: true

- name: Get dependencies
run: |
sudo apt-get update -y
sudo apt-get install -y wget git gawk findutils
xargs -a <(awk '! /^ *(#|$)/' ".github/workflows/apt.txt") -r -- \
sudo apt-get install -y --no-install-recommends --no-install-suggests

- name: Install Python dependencies
if: ${{ matrix.config == 'ubuntu-22.04' }}
run: |
python -m pip install --upgrade pip
pip install -r .github/workflows/python_requirements.txt
pip install -r .github/workflows/optional_requirements.txt

- name: Create installation directory
run: |
mkdir $HOME/install
Expand All @@ -132,7 +147,6 @@ jobs:
# TODO: -pedantic-errors here won't compile
CXXFLAGS: -fPIC
run: .github/workflows/build_${{ matrix.config }}.sh $HOME/install -Werror

- name: Add the bin directory to PATH
run: |
echo "$HOME/install/bin" >> $GITHUB_PATH
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ repos:
)
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.8.3
rev: v0.8.4
hooks:
# Run the linter.
- id: ruff
Expand Down
22 changes: 13 additions & 9 deletions doc/notebooks/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,28 @@
### Using the notebooks locally

Clone this repository with `git clone` first. Then, locally start the Jupyter
notebook server from the command line in the `doc/notebooks/` directory containing
the `*.ipynb` files with:
`jupyter notebook`
notebook server from the command line in the `doc/notebooks/` directory
containing the `*.ipynb` files with: `jupyter notebook`

This will open a new browser tab or window with a list of the contents of the current
working directory. Clicking on one of the `*.ipynb` files will start the notebook.
This will open a new browser tab or window with a list of the contents of the
current working directory. Clicking on one of the `*.ipynb` files will start
the notebook.

See also the official documentation for [The Jupyter Notebook](https://jupyter-notebook.readthedocs.io/en/latest/).
See also the official documentation for
[The Jupyter Notebook](https://jupyter-notebook.readthedocs.io/en/latest/).

### Introductory notebooks to GRASS GIS and Jupyter

* GRASS GIS in Jupyter Notebook with Python and grass.jupyter: [jupyter_example.ipynb](jupyter_example.ipynb)
* GRASS GIS in Jupyter Notebook with Python and grass.jupyter:
[jupyter_example.ipynb](jupyter_example.ipynb)
* The grass.jupyter Package: [jupyter_tutorial.ipynb](jupyter_tutorial.ipynb)

## Thematic Jupyter notebooks

* Viewshed Analysis: [viewshed_analysis.ipynb](viewshed_analysis.ipynb)
* Spatio-Temporal Analysis with grass.jupyter: [temporal.ipynb](temporal.ipynb)
* Solar Energy Potential Analysis: [solar_potential.ipynb](solar_potential.ipynb)
* GRASS GIS Scripting with Python: [scripting_example.ipynb](scripting_example.ipynb)
* Solar Energy Potential Analysis:
[solar_potential.ipynb](solar_potential.ipynb)
* GRASS GIS Scripting with Python:
[scripting_example.ipynb](scripting_example.ipynb)
* Hydrology with GRASS GIS: [hydrology.ipynb](hydrology.ipynb)
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,7 @@ ignore = [
[tool.ruff.lint.flake8-import-conventions.extend-aliases]
# Declare a custom aliases, checked with rule ICN001
"grass.script" = "gs"
"grass.temporal" = "tgis"

[tool.pytest.ini_options]
minversion = "6.0"
Expand Down
2 changes: 1 addition & 1 deletion python/grass/temporal/datetime_math.py
Original file line number Diff line number Diff line change
Expand Up @@ -836,7 +836,7 @@ def string_to_datetime(time_string: str) -> datetime | None:
return time_object


def datetime_to_grass_datetime_string(dt: datetime) -> str:
def datetime_to_grass_datetime_string(dt: datetime | None) -> str:
"""Convert a python datetime object into a GRASS datetime string

.. code-block:: python
Expand Down
3 changes: 2 additions & 1 deletion python/grass/temporal/gui_support.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"""

import grass.script as gs
from grass.exceptions import ScriptError

from .core import get_available_temporal_mapsets, init_dbif
from .factory import dataset_factory
Expand Down Expand Up @@ -45,7 +46,7 @@ def tlist_grouped(type, group_type: bool = False, dbif=None):
for type_ in types:
try:
tlist_result = tlist(type=type_, dbif=dbif)
except gs.ScriptError as e:
except ScriptError as e:
gs.warning(e)
continue

Expand Down
53 changes: 24 additions & 29 deletions python/grass/temporal/testsuite/test_temporal_doctests.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@
import grass.gunittest.case
import grass.gunittest.main
import grass.gunittest.utils

import grass.temporal
import grass.temporal as tgis

doctest.DocFileCase = type(
"DocFileCase", (grass.gunittest.case.TestCase,), dict(doctest.DocFileCase.__dict__)
Expand All @@ -23,35 +22,31 @@

def load_tests(loader, tests, ignore):
grass.gunittest.utils.do_doctest_gettext_workaround()
tests.addTests(doctest.DocTestSuite(grass.temporal.abstract_dataset))
tests.addTests(doctest.DocTestSuite(grass.temporal.abstract_map_dataset))
tests.addTests(doctest.DocTestSuite(grass.temporal.abstract_space_time_dataset))
tests.addTests(doctest.DocTestSuite(grass.temporal.base))
tests.addTests(doctest.DocTestSuite(grass.temporal.core))
tests.addTests(doctest.DocTestSuite(grass.temporal.datetime_math))
tests.addTests(doctest.DocTestSuite(tgis.abstract_dataset))
tests.addTests(doctest.DocTestSuite(tgis.abstract_map_dataset))
tests.addTests(doctest.DocTestSuite(tgis.abstract_space_time_dataset))
tests.addTests(doctest.DocTestSuite(tgis.base))
tests.addTests(doctest.DocTestSuite(tgis.core))
tests.addTests(doctest.DocTestSuite(tgis.datetime_math))
# Unexpected error here
# tests.addTests(doctest.DocTestSuite(grass.temporal.list_stds))
tests.addTests(doctest.DocTestSuite(grass.temporal.metadata))
tests.addTests(doctest.DocTestSuite(grass.temporal.register))
tests.addTests(doctest.DocTestSuite(grass.temporal.space_time_datasets))
tests.addTests(doctest.DocTestSuite(grass.temporal.spatial_extent))
tests.addTests(
doctest.DocTestSuite(grass.temporal.spatial_topology_dataset_connector)
)
tests.addTests(doctest.DocTestSuite(grass.temporal.spatio_temporal_relationships))
tests.addTests(doctest.DocTestSuite(grass.temporal.temporal_extent))
tests.addTests(doctest.DocTestSuite(grass.temporal.temporal_granularity))
tests.addTests(
doctest.DocTestSuite(grass.temporal.temporal_topology_dataset_connector)
)
# tests.addTests(doctest.DocTestSuite(tgis.list_stds))
tests.addTests(doctest.DocTestSuite(tgis.metadata))
tests.addTests(doctest.DocTestSuite(tgis.register))
tests.addTests(doctest.DocTestSuite(tgis.space_time_datasets))
tests.addTests(doctest.DocTestSuite(tgis.spatial_extent))
tests.addTests(doctest.DocTestSuite(tgis.spatial_topology_dataset_connector))
tests.addTests(doctest.DocTestSuite(tgis.spatio_temporal_relationships))
tests.addTests(doctest.DocTestSuite(tgis.temporal_extent))
tests.addTests(doctest.DocTestSuite(tgis.temporal_granularity))
tests.addTests(doctest.DocTestSuite(tgis.temporal_topology_dataset_connector))
# Algebra is still very experimental
tests.addTests(doctest.DocTestSuite(grass.temporal.temporal_algebra))
tests.addTests(doctest.DocTestSuite(grass.temporal.temporal_raster3d_algebra))
tests.addTests(doctest.DocTestSuite(grass.temporal.temporal_raster_algebra))
tests.addTests(doctest.DocTestSuite(grass.temporal.temporal_raster_base_algebra))
tests.addTests(doctest.DocTestSuite(grass.temporal.temporal_operator))
tests.addTests(doctest.DocTestSuite(grass.temporal.temporal_vector_algebra))
tests.addTests(doctest.DocTestSuite(grass.temporal.c_libraries_interface))
tests.addTests(doctest.DocTestSuite(tgis.temporal_algebra))
tests.addTests(doctest.DocTestSuite(tgis.temporal_raster3d_algebra))
tests.addTests(doctest.DocTestSuite(tgis.temporal_raster_algebra))
tests.addTests(doctest.DocTestSuite(tgis.temporal_raster_base_algebra))
tests.addTests(doctest.DocTestSuite(tgis.temporal_operator))
tests.addTests(doctest.DocTestSuite(tgis.temporal_vector_algebra))
tests.addTests(doctest.DocTestSuite(tgis.c_libraries_interface))
return tests


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -677,8 +677,8 @@ def test_map_function2(self) -> None:
self.assertEqual(D.check_temporal_topology(), True)
self.assertEqual(D.get_granularity(), "1 day")

def test_temporal_select(self) -> None:
"""Testing the temporal select operator."""
def test_temporal_select_same_left_right(self) -> None:
"""Testing the temporal select operator with the same map for left and right."""
tra = tgis.TemporalRasterAlgebraParser(run=True, debug=True)
tra.parse(expression="R = A : A", basename="r", overwrite=True)

Expand Down
Loading