topotoolbox 0.0.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- topotoolbox-0.0.1/.github/workflows/ci.yaml +56 -0
- topotoolbox-0.0.1/.github/workflows/docs.yaml +47 -0
- topotoolbox-0.0.1/.github/workflows/release.yml +88 -0
- topotoolbox-0.0.1/.gitignore +26 -0
- topotoolbox-0.0.1/CMakeLists.txt +30 -0
- topotoolbox-0.0.1/CONTRIBUTING.md +55 -0
- topotoolbox-0.0.1/LICENSE +674 -0
- topotoolbox-0.0.1/LICENSES_bundled +35 -0
- topotoolbox-0.0.1/PKG-INFO +814 -0
- topotoolbox-0.0.1/README.md +123 -0
- topotoolbox-0.0.1/docs/Makefile +44 -0
- topotoolbox-0.0.1/docs/README.md +11 -0
- topotoolbox-0.0.1/docs/_static/thumbnails/placeholder.png +0 -0
- topotoolbox-0.0.1/docs/api.rst +20 -0
- topotoolbox-0.0.1/docs/conf.py +63 -0
- topotoolbox-0.0.1/docs/examples.rst +13 -0
- topotoolbox-0.0.1/docs/index.rst +45 -0
- topotoolbox-0.0.1/docs/installing.rst +80 -0
- topotoolbox-0.0.1/docs/logo.png +0 -0
- topotoolbox-0.0.1/docs/make.bat +35 -0
- topotoolbox-0.0.1/docs/requirements.txt +4 -0
- topotoolbox-0.0.1/docs/tutorial.ipynb +106 -0
- topotoolbox-0.0.1/examples/downloading.ipynb +54 -0
- topotoolbox-0.0.1/examples/excesstopography.ipynb +98 -0
- topotoolbox-0.0.1/examples/flowobject.ipynb +52 -0
- topotoolbox-0.0.1/examples/gradient8.ipynb +58 -0
- topotoolbox-0.0.1/examples/magicfunctions.ipynb +153 -0
- topotoolbox-0.0.1/examples/plotting.ipynb +108 -0
- topotoolbox-0.0.1/examples/streamobject.ipynb +105 -0
- topotoolbox-0.0.1/pyproject.toml +52 -0
- topotoolbox-0.0.1/requirements.txt +34 -0
- topotoolbox-0.0.1/src/lib/flow.cpp +57 -0
- topotoolbox-0.0.1/src/lib/graphflood.cpp +171 -0
- topotoolbox-0.0.1/src/lib/grid.cpp +238 -0
- topotoolbox-0.0.1/src/lib/stream.cpp +20 -0
- topotoolbox-0.0.1/src/topotoolbox/__init__.py +7 -0
- topotoolbox-0.0.1/src/topotoolbox/flow_object.py +203 -0
- topotoolbox-0.0.1/src/topotoolbox/graphflood.py +175 -0
- topotoolbox-0.0.1/src/topotoolbox/grid_object.py +618 -0
- topotoolbox-0.0.1/src/topotoolbox/stream_object.py +231 -0
- topotoolbox-0.0.1/src/topotoolbox/utils.py +368 -0
- topotoolbox-0.0.1/tests/README.md +3 -0
- topotoolbox-0.0.1/tests/__init__.py +0 -0
- topotoolbox-0.0.1/tests/test_flow_object.py +3 -0
- topotoolbox-0.0.1/tests/test_grid_object.py +91 -0
- topotoolbox-0.0.1/tests/test_stream_object.py +72 -0
- topotoolbox-0.0.1/tests/test_utils.py +2 -0
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
on:
|
|
3
|
+
pull_request:
|
|
4
|
+
push:
|
|
5
|
+
branches: ["main"]
|
|
6
|
+
jobs:
|
|
7
|
+
build-and-test:
|
|
8
|
+
runs-on: ${{ matrix.os }}
|
|
9
|
+
strategy:
|
|
10
|
+
fail-fast: false
|
|
11
|
+
matrix:
|
|
12
|
+
os: [ubuntu-latest, macos-latest, windows-latest]
|
|
13
|
+
python-version: ['3.10', '3.11']
|
|
14
|
+
|
|
15
|
+
steps:
|
|
16
|
+
- name: Checkout repository
|
|
17
|
+
uses: actions/checkout@v4
|
|
18
|
+
|
|
19
|
+
- name: Set up Python
|
|
20
|
+
uses: actions/setup-python@v5
|
|
21
|
+
with:
|
|
22
|
+
python-version: ${{ matrix.python-version }}
|
|
23
|
+
|
|
24
|
+
- name: Install dependencies
|
|
25
|
+
run: |
|
|
26
|
+
python -m pip install --upgrade pip
|
|
27
|
+
pip install pytest
|
|
28
|
+
|
|
29
|
+
- name: Build and install TopoToolbox
|
|
30
|
+
run: |
|
|
31
|
+
pip install .[opensimplex]
|
|
32
|
+
|
|
33
|
+
- name: Run tests
|
|
34
|
+
run: |
|
|
35
|
+
python -m pytest
|
|
36
|
+
|
|
37
|
+
lint:
|
|
38
|
+
runs-on: ubuntu-latest
|
|
39
|
+
strategy:
|
|
40
|
+
fail-fast: false
|
|
41
|
+
steps:
|
|
42
|
+
|
|
43
|
+
- name: Checkout
|
|
44
|
+
uses: actions/checkout@v4
|
|
45
|
+
|
|
46
|
+
- name: Setup Python
|
|
47
|
+
uses: actions/setup-python@v5
|
|
48
|
+
|
|
49
|
+
- name: Install tools
|
|
50
|
+
run: pip install -r requirements.txt
|
|
51
|
+
|
|
52
|
+
- name: Run pylint
|
|
53
|
+
run: pylint --rcfile=pyproject.toml src/topotoolbox/
|
|
54
|
+
|
|
55
|
+
- name: Run type checks
|
|
56
|
+
run: mypy --ignore-missing-imports src/topotoolbox
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
name: docs
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: ["main"]
|
|
6
|
+
|
|
7
|
+
jobs:
|
|
8
|
+
build:
|
|
9
|
+
runs-on: ubuntu-latest
|
|
10
|
+
steps:
|
|
11
|
+
- name: Checkout
|
|
12
|
+
uses: actions/checkout@v4
|
|
13
|
+
|
|
14
|
+
- name: Install Pandoc
|
|
15
|
+
run: sudo apt-get install -y pandoc
|
|
16
|
+
|
|
17
|
+
- name: Install Python build dependencies
|
|
18
|
+
run: |
|
|
19
|
+
python -m pip install --upgrade pip
|
|
20
|
+
pip install -r ${{ github.workspace }}/docs/requirements.txt
|
|
21
|
+
python3 -m pip install .[opensimplex]
|
|
22
|
+
|
|
23
|
+
- name: Build Sphinx documentation
|
|
24
|
+
working-directory: ${{ github.workspace }}/docs
|
|
25
|
+
run: |
|
|
26
|
+
make clean
|
|
27
|
+
make html
|
|
28
|
+
|
|
29
|
+
- name: Package artifact
|
|
30
|
+
uses: actions/upload-pages-artifact@v3
|
|
31
|
+
with:
|
|
32
|
+
path: ${{ github.workspace }}/docs/_build/html
|
|
33
|
+
|
|
34
|
+
deploy:
|
|
35
|
+
needs: build
|
|
36
|
+
permissions:
|
|
37
|
+
pages: write
|
|
38
|
+
id-token: write
|
|
39
|
+
|
|
40
|
+
environment:
|
|
41
|
+
name: github-pages
|
|
42
|
+
url: ${{ steps.deployment.outputs.page_url }}
|
|
43
|
+
runs-on: ubuntu-latest
|
|
44
|
+
steps:
|
|
45
|
+
- name: Deploy to GitHub Pages
|
|
46
|
+
id: deployment
|
|
47
|
+
uses: actions/deploy-pages@v4
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
name: Create and upload wheels and source distribution
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
release:
|
|
5
|
+
types: [published]
|
|
6
|
+
|
|
7
|
+
jobs:
|
|
8
|
+
make_sdist:
|
|
9
|
+
name: Make SDist
|
|
10
|
+
runs-on: ubuntu-latest
|
|
11
|
+
steps:
|
|
12
|
+
- uses: actions/checkout@v4
|
|
13
|
+
- uses: actions/setup-python@v5
|
|
14
|
+
|
|
15
|
+
- name: Install build
|
|
16
|
+
run: python -m pip install build
|
|
17
|
+
|
|
18
|
+
- name: Build SDist
|
|
19
|
+
run: python -m build --sdist
|
|
20
|
+
|
|
21
|
+
- uses: actions/upload-artifact@v4
|
|
22
|
+
with:
|
|
23
|
+
name: cibw-sdist
|
|
24
|
+
path: dist/*.tar.gz
|
|
25
|
+
build_wheels:
|
|
26
|
+
name: Wheel on ${{ matrix.os }}
|
|
27
|
+
runs-on: ${{ matrix.os }}
|
|
28
|
+
strategy:
|
|
29
|
+
fail-fast: false
|
|
30
|
+
matrix:
|
|
31
|
+
os: [ubuntu-latest, macos-latest, windows-latest, macos-13]
|
|
32
|
+
cibw_arch: ["native"]
|
|
33
|
+
cibw_build: ["cp310-* cp311-* cp312-*"]
|
|
34
|
+
steps:
|
|
35
|
+
- uses: actions/checkout@v4
|
|
36
|
+
- uses: actions/setup-python@v5
|
|
37
|
+
|
|
38
|
+
- name: Install cibuildwheel
|
|
39
|
+
run: python -m pip install cibuildwheel==2.21.3
|
|
40
|
+
|
|
41
|
+
- name: Build wheels
|
|
42
|
+
run: python -m cibuildwheel --output-dir wheelhouse
|
|
43
|
+
env:
|
|
44
|
+
CIBW_ARCHS: ${{ matrix.cibw_arch }}
|
|
45
|
+
CIBW_BUILD: ${{ matrix.cibw_build }}
|
|
46
|
+
CIBW_SKIP: "*musllinux*"
|
|
47
|
+
CIBW_TEST_REQUIRES: pytest
|
|
48
|
+
CIBW_TEST_COMMAND: pytest {package}/tests
|
|
49
|
+
CIBW_TEST_EXTRAS: opensimplex
|
|
50
|
+
|
|
51
|
+
- uses: actions/upload-artifact@v4
|
|
52
|
+
with:
|
|
53
|
+
name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }}
|
|
54
|
+
path: ./wheelhouse/*.whl
|
|
55
|
+
upload_assets:
|
|
56
|
+
name: Upload release assets
|
|
57
|
+
needs: [build_wheels, make_sdist]
|
|
58
|
+
runs-on: ubuntu-latest
|
|
59
|
+
permissions:
|
|
60
|
+
contents: write
|
|
61
|
+
steps:
|
|
62
|
+
- uses: actions/download-artifact@v4
|
|
63
|
+
with:
|
|
64
|
+
pattern: cibw-*
|
|
65
|
+
path: dist
|
|
66
|
+
merge-multiple: true
|
|
67
|
+
- name: Upload assets to release
|
|
68
|
+
run: gh release upload --repo $GITHUB_REPOSITORY $TAG dist/*
|
|
69
|
+
env:
|
|
70
|
+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
71
|
+
TAG: ${{ github.event.release.tag_name }}
|
|
72
|
+
upload-pypi:
|
|
73
|
+
name: Upload release assets to PyPI
|
|
74
|
+
needs: [build_wheels, make_sdist]
|
|
75
|
+
runs-on: ubuntu-latest
|
|
76
|
+
environment: pypi
|
|
77
|
+
permissions:
|
|
78
|
+
id-token: write
|
|
79
|
+
steps:
|
|
80
|
+
- uses: actions/download-artifact@v4
|
|
81
|
+
with:
|
|
82
|
+
pattern: cibw-*
|
|
83
|
+
path: dist
|
|
84
|
+
merge-multiple: true
|
|
85
|
+
- name: Publish package distributions to PyPI
|
|
86
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
87
|
+
with:
|
|
88
|
+
verbose: true
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# ignore .vscode settings:
|
|
2
|
+
.vscode/
|
|
3
|
+
|
|
4
|
+
# ignore dist directory
|
|
5
|
+
dist/
|
|
6
|
+
|
|
7
|
+
# ingnore tests pycache
|
|
8
|
+
tests/__pycache__
|
|
9
|
+
|
|
10
|
+
# ignore build docs
|
|
11
|
+
docs/_build/*
|
|
12
|
+
|
|
13
|
+
# ignore _autosummary
|
|
14
|
+
docs/_autosummary/*
|
|
15
|
+
|
|
16
|
+
# ignore _temp
|
|
17
|
+
docs/_temp
|
|
18
|
+
|
|
19
|
+
# ignore pytest_cache
|
|
20
|
+
.pytest_cache/
|
|
21
|
+
|
|
22
|
+
# ignore mypy_cache
|
|
23
|
+
.mypy_cache/
|
|
24
|
+
|
|
25
|
+
# ignore .venv
|
|
26
|
+
.venv/
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
cmake_minimum_required(VERSION 3.15)
|
|
2
|
+
|
|
3
|
+
project(${SKBUILD_PROJECT_NAME}
|
|
4
|
+
VERSION ${SKBUILD_PROJECT_VERSION}
|
|
5
|
+
LANGUAGES CXX)
|
|
6
|
+
|
|
7
|
+
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
|
|
8
|
+
|
|
9
|
+
# include libtopotoolbox
|
|
10
|
+
include(FetchContent)
|
|
11
|
+
FetchContent_Declare(
|
|
12
|
+
topotoolbox
|
|
13
|
+
GIT_REPOSITORY https://github.com/TopoToolbox/libtopotoolbox.git
|
|
14
|
+
GIT_TAG main
|
|
15
|
+
)
|
|
16
|
+
FetchContent_MakeAvailable(topotoolbox)
|
|
17
|
+
|
|
18
|
+
set(PYBIND11_NEWPYTHON ON)
|
|
19
|
+
find_package(pybind11 CONFIG REQUIRED)
|
|
20
|
+
|
|
21
|
+
pybind11_add_module(_grid src/lib/grid.cpp)
|
|
22
|
+
target_link_libraries(_grid PRIVATE topotoolbox)
|
|
23
|
+
|
|
24
|
+
pybind11_add_module(_flow src/lib/flow.cpp)
|
|
25
|
+
target_link_libraries(_flow PRIVATE topotoolbox)
|
|
26
|
+
|
|
27
|
+
pybind11_add_module(_graphflood src/lib/graphflood.cpp)
|
|
28
|
+
target_link_libraries(_graphflood PRIVATE topotoolbox)
|
|
29
|
+
|
|
30
|
+
install(TARGETS _grid _flow _graphflood LIBRARY DESTINATION topotoolbox)
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# Contribution Guidelines
|
|
2
|
+
|
|
3
|
+
First off, thanks for taking the time to contribute!
|
|
4
|
+
|
|
5
|
+
The following is a set of guidelines for contributing to the TopoToolbox Python Library. These are mostly guidelines, not rules. Use your best judgment, and feel free to propose changes to this document in a pull request.
|
|
6
|
+
|
|
7
|
+
## How Can I Contribute?
|
|
8
|
+
|
|
9
|
+
### Reporting Bugs
|
|
10
|
+
|
|
11
|
+
If you find a bug, please report it by opening an issue. Please include:
|
|
12
|
+
|
|
13
|
+
- A clear and descriptive title.
|
|
14
|
+
- A detailed description of the problem.
|
|
15
|
+
- Steps to reproduce the issue.
|
|
16
|
+
- Any error messages you encountered.
|
|
17
|
+
|
|
18
|
+
### Suggesting Enhancements
|
|
19
|
+
|
|
20
|
+
If you have an idea for an enhancement or new feature, please open an issue to discuss it. Please include:
|
|
21
|
+
|
|
22
|
+
- A clear and descriptive title.
|
|
23
|
+
- A detailed description of the proposed enhancement.
|
|
24
|
+
- Any relevant examples or screenshots.
|
|
25
|
+
|
|
26
|
+
### Submitting Pull Requests
|
|
27
|
+
|
|
28
|
+
If you have a patch or new feature that you would like to contribute, please submit a [pull request (PR)](https://guides.github.com/introduction/flow/). Before you do, please ensure the following:
|
|
29
|
+
|
|
30
|
+
1. Fork the repository and create your branch from `main`.
|
|
31
|
+
2. If you have added code that should be tested, add tests.
|
|
32
|
+
3. If you have changed APIs, update the documentation.
|
|
33
|
+
4. Ensure the test suite passes.
|
|
34
|
+
5. Make sure your code lints.
|
|
35
|
+
|
|
36
|
+
### Code Style
|
|
37
|
+
|
|
38
|
+
Please follow the [PEP 8](https://pep8.org/) style guide for Python code. Make sure your code passes the linting tests (`pylint --rcfile=pyproject.toml src/topotoolbox/`, `mypy --ignore-missing-imports src/topotoolbox`) and the pytests (`python -m pytest`). Also add tests for new content you want to contribute.
|
|
39
|
+
|
|
40
|
+
It may also be a good idea to run pylint without specifying the rcfile to check for potential code smells that need to be addressed.
|
|
41
|
+
|
|
42
|
+
### Commit Messages
|
|
43
|
+
|
|
44
|
+
Use [clear and descriptive commit messages](https://cbea.ms/git-commit/). Follow these conventions:
|
|
45
|
+
|
|
46
|
+
- Use the present tense ("Analyze terrain" not "Analyzed terrain").
|
|
47
|
+
- Use the imperative mood ("Generate contour map" not "Generates contour map").
|
|
48
|
+
- Limit the first line to 50 characters or less. All other lines should not be longer than 72 characters.
|
|
49
|
+
- Reference issues and pull requests liberally.
|
|
50
|
+
|
|
51
|
+
### Documentation
|
|
52
|
+
|
|
53
|
+
Improvements to the documentation are always welcome. Please ensure that your changes are clear and concise.
|
|
54
|
+
|
|
55
|
+
Thank you for contributing!
|