Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
8b1e5df
fix: remove calls to map2model
Jun 5, 2025
078a366
fix: remove m2m from deps
Jun 5, 2025
975f602
fix: use os/python matrix
Jun 5, 2025
c8ef7ac
remove gdal install from test
Jun 5, 2025
a5273a7
only run for changes of python files or the workflow
Jun 5, 2025
febdada
remove conda defaults channel
Jun 5, 2025
b955c5d
style: style fixes by ruff and autoformatting by black
lachlangrose Jun 5, 2025
628c352
remove map2model import
Jun 5, 2025
3380817
Merge branch 'fix/remove-map2model' of github.com:Loop3D/map2loop int…
Jun 5, 2025
326fb14
Merge pull request #200 from Loop3D/fix/remove-map2model
lachlangrose Jun 5, 2025
f4de309
Update linting_and_testing.yml
lachlangrose Jun 5, 2025
5be2b23
Update linting_and_testing.yml
lachlangrose Jun 5, 2025
4820d5e
Update linting_and_testing.yml
lachlangrose Jun 5, 2025
9ed4bd1
Update linting_and_testing.yml
lachlangrose Jun 5, 2025
c858a0c
trying to specify python version in conda install
lachlangrose Jun 5, 2025
d52968e
Update linting_and_testing.yml
lachlangrose Jun 5, 2025
87338ea
Update linting_and_testing.yml
lachlangrose Jun 5, 2025
154c775
fix: make shapely imports backwards compatible
Jun 5, 2025
0ee439e
Merge branch '3.2.3_dev' of github.com:Loop3D/map2loop into 3.2.3_dev
Jun 5, 2025
8ff2964
points reverted
Jun 5, 2025
408b523
remove incorrect type hinting
Jun 5, 2025
be97dee
fix: making test work on ALL python. use pathlib and not importlib to…
Jun 5, 2025
a29e9c4
fix: multilinestring import
Jun 5, 2025
eab7496
Merge branch 'master' into 3.2.3_dev
Jun 5, 2025
bfd2eec
fixing more shapley bugs
Jun 5, 2025
3e50fc4
add version constraint on shapely
Jun 5, 2025
190d5c8
remove . add gdal back
Jun 5, 2025
323ba9c
actually add gdal
Jun 5, 2025
e6b182a
make workflow runs on all pushes
noellehmcheng Jun 8, 2025
1b8f336
replace dwithin
noellehmcheng Jun 8, 2025
ee18640
fix short_line
noellehmcheng Jun 8, 2025
97016ec
fix dependency file path and handle >= version condition in check_all…
noellehmcheng Jun 8, 2025
1f42956
remove gdal from dependencies.txt
noellehmcheng Jun 9, 2025
291cdd7
change order of dependencies
noellehmcheng Jun 9, 2025
e6f363c
display gdal owslib versions
noellehmcheng Jun 9, 2025
e58156d
fix: specify gdal 3.4.3 for windows python 3.10
noellehmcheng Jun 11, 2025
1037806
print gdal owslib shapely version
noellehmcheng Jun 13, 2025
2dd81b6
set gdal>=3.6.2 and shapely>=2.0.2 in dependencies.txt
noellehmcheng Jun 13, 2025
1419270
change back to shapely>=2 in dependencies.txt
noellehmcheng Jun 13, 2025
75f08c9
remove gdal>=3.6.2 from dependencies.txt
noellehmcheng Jun 13, 2025
a4331fe
windows python 3.10 glda=3.4.3
noellehmcheng Jun 13, 2025
0d583cb
add geos version compatibility for shapely.dwithin
noellehmcheng Jun 13, 2025
e3aef22
add back branch and path restrictions
noellehmcheng Jun 16, 2025
18dd00d
remove print statements
noellehmcheng Jun 16, 2025
2deffb5
Merge pull request #204 from Loop3D/noelle/testing
lachlangrose Jun 16, 2025
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
60 changes: 43 additions & 17 deletions .github/workflows/linting_and_testing.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,20 @@
name: Linting and Testing

on:
[push]
push:
branches:
- master
paths:
- '**.py'
- .github/workflows/linting_and_testing.yml

pull_request:
branches:
- master
paths:
- '**.py'
- .github/workflows/linting_and_testing.yml
workflow_dispatch:

jobs:
linting:
Expand All @@ -21,29 +34,42 @@ jobs:


testing:
name: Testing
runs-on: ubuntu-24.04
name: Testing${{ matrix.os }} python ${{ matrix.python-version }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: ${{ fromJSON(vars.BUILD_OS)}}
python-version: ${{ fromJSON(vars.PYTHON_VERSIONS)}}

steps:
- uses: actions/checkout@v4
- name: Install GDAL
run: |
sudo add-apt-repository ppa:ubuntugis/ubuntugis-unstable
sudo apt-get update
sudo apt-get install -y libgdal-dev gdal-bin
- uses: conda-incubator/setup-miniconda@v3
with:
python-version: ${{ matrix.python-version }}
conda-remove-defaults: "true"

- name: Install dependencies

- name: Install dependencies for windows python 3.10
if: ${{ matrix.os == 'windows-latest' && matrix.python-version == '3.10' }}
run: |
conda update -n base -c defaults conda -y
conda install -n base conda-libmamba-solver -c conda-forge -y
conda install -c conda-forge gdal -y
conda install -c conda-forge -c loop3d --file dependencies.txt -y
conda install pytest -y
conda run -n test conda info
conda run -n test conda install -c loop3d -c conda-forge "gdal=3.4.3" python=${{ matrix.python-version }} -y
conda run -n test conda install -c loop3d -c conda-forge --file dependencies.txt python=${{ matrix.python-version }} -y
conda run -n test conda install pytest python=${{ matrix.python-version }} -y

- name: Install dependencies for other environments
if: ${{ matrix.os != 'windows-latest' || matrix.python-version != '3.10' }}
run: |
conda run -n test conda info
conda run -n test conda install -c loop3d -c conda-forge gdal python=${{ matrix.python-version }} -y
conda run -n test conda install -c loop3d -c conda-forge --file dependencies.txt python=${{ matrix.python-version }} -y
conda run -n test conda install pytest python=${{ matrix.python-version }} -y

- name: Install map2loop
run: |
python -m pip install .
conda run -n test python -m pip install .

- name: Run tests
run: |
pytest

conda run -n test pytest
3 changes: 1 addition & 2 deletions dependencies.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
numpy
scipy
geopandas
shapely
shapely>=2
networkx
owslib
map2model
loopprojectfile==0.2.2
beartype
pytest
Expand Down
6 changes: 4 additions & 2 deletions map2loop/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class DependencyChecker:

def __init__(self, package_name, dependency_file="dependencies.txt"):
self.package_name = package_name
self.dependency_file = pathlib.Path(__file__).parent / dependency_file
self.dependency_file = pathlib.Path(__file__).parent.parent / dependency_file
self.required_version = self.get_required_version()
self.installed_version = self.get_installed_version()

Expand Down Expand Up @@ -93,7 +93,7 @@ def check_version(self):


def check_all_dependencies(dependency_file="dependencies.txt"):
dependencies_path = pathlib.Path(__file__).parent / dependency_file
dependencies_path = pathlib.Path(__file__).parent.parent / dependency_file
try:
with dependencies_path.open("r") as file:
for line in file:
Expand All @@ -103,6 +103,8 @@ def check_all_dependencies(dependency_file="dependencies.txt"):
if line:
if "==" in line:
package_name, _ = line.split("==")
elif ">=" in line:
package_name, _ = line.split(">=")
else:
package_name = line

Expand Down
21 changes: 13 additions & 8 deletions map2loop/_datasets/geodata_files/load_map2loop_data.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
import geopandas
from importlib.resources import files
import map2loop
import pathlib
from osgeo import gdal
gdal.UseExceptions()

def map2loop_dir(folder)-> pathlib.Path:
path = pathlib.Path(map2loop.__file__).parent
path = path / "_datasets"/"geodata_files"/f'{folder}'
return path
def load_hamersley_geology():
"""
Loads Hamersley geology data from a shapefile
Expand All @@ -14,8 +18,9 @@ def load_hamersley_geology():
Returns:
geopandas.GeoDataFrame: The geology data
"""
stream = files("map2loop._datasets.geodata_files.hamersley").joinpath("geology.geojson")
return geopandas.read_file(stream)

path = map2loop_dir('hamersley') / "geology.geojson"
return geopandas.read_file(str(path))


def load_hamersley_structure():
Expand All @@ -30,8 +35,8 @@ def load_hamersley_structure():
geopandas.GeoDataFrame: The structure data
"""

path = files("map2loop._datasets.geodata_files.hamersley").joinpath("structure.geojson")
return geopandas.read_file(path)
path = map2loop_dir('hamersley') / "structure.geojson"
return geopandas.read_file(str(path))


def load_hamersley_dtm():
Expand All @@ -41,5 +46,5 @@ def load_hamersley_dtm():
Returns:
gdal.Dataset: The DTM data
"""
path = files("map2loop._datasets.geodata_files.hamersley").joinpath("dtm_rp.tif")
return gdal.Open(path)
path = map2loop_dir('hamersley') / "dtm_rp.tif"
return gdal.Open(str(path))
2 changes: 1 addition & 1 deletion map2loop/data_checks.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def check_geology_fields_validity(mapdata) -> tuple[bool, str]:
# 2. Validate geometry
failed, message = validate_geometry(
geodata=geology_data,
expected_geom_types=[shapely.Polygon, shapely.MultiPolygon],
expected_geom_types=[shapely.geometry.Polygon, shapely.geometry.MultiPolygon],
datatype_name="GEOLOGY"
)
if failed:
Expand Down
Loading
Loading