Skip to content

Commit e3390b8

Browse files
authored
Migrate to GitHub (#2)
1 parent 22f710e commit e3390b8

10 files changed

Lines changed: 229 additions & 172 deletions
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
2+
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
3+
4+
name: Python package test
5+
6+
on:
7+
push:
8+
branches: [main]
9+
pull_request:
10+
branches: [main]
11+
schedule:
12+
- cron: '0 8 * * 1,4'
13+
14+
jobs:
15+
unit-tests:
16+
runs-on: ${{ matrix.os }}
17+
18+
strategy:
19+
fail-fast: false
20+
matrix:
21+
python-version: ["3.10", "3.11", "3.12"]
22+
os: ["ubuntu-22.04", "ubuntu-latest"]
23+
24+
steps:
25+
- uses: actions/checkout@v2
26+
27+
- name: Set up Python ${{ matrix.python-version }}
28+
uses: actions/setup-python@v2
29+
with:
30+
python-version: ${{ matrix.python-version }}
31+
32+
- name: Lint
33+
run: |
34+
python -m pip install pre-commit
35+
pre-commit run --show-diff-on-failure --all-files
36+
37+
- name: Install dependencies
38+
env:
39+
CURL_CA_BUNDLE: /etc/ssl/certs/ca-certificates.crt
40+
run: |
41+
sudo apt-add-repository -y ppa:ubuntugis/ubuntugis-unstable
42+
sudo apt-get -y update
43+
sudo apt-get install -y gdal-bin libgdal-dev libproj-dev libgeos-dev
44+
python -m pip install --upgrade pip wheel
45+
pip install -e .[complete,test]
46+
pip freeze
47+
48+
- name: Start containers
49+
run: docker compose -f "docker-compose.yml" up -d
50+
51+
# run tests
52+
- name: run
53+
env:
54+
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
55+
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
56+
run: pytest -v --cov mapchete-hub-cli --cov-report xml:coverage.xml --cov-report=term-missing:skip-covered --junitxml=pytest.xml
57+
58+
# Upload the report to Codecov
59+
- name: Upload coverage reports to Codecov
60+
uses: codecov/codecov-action@v5
61+
with:
62+
token: ${{ secrets.CODECOV_TOKEN }}
63+
slug: mapchete/mapchete-hub-cli
64+
65+
# this will let the workflow fail if coverage is below 100%
66+
- name: Pytest coverage
67+
run: coverage report --skip-covered --show-missing
68+
# --fail-under 100
69+
70+
- name: Stop containers
71+
if: always()
72+
run: docker compose -f "docker-compose.yml" down
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# This workflows will upload a Python Package using Twine when a release is created
2+
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries
3+
4+
name: Upload Python Package
5+
6+
on:
7+
release:
8+
types: [created]
9+
10+
jobs:
11+
deploy:
12+
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- uses: actions/checkout@v2
17+
- name: Set up Python
18+
uses: actions/setup-python@v2
19+
with:
20+
python-version: '3.x'
21+
- name: Install dependencies
22+
run: |
23+
python -m pip install --upgrade pip
24+
pip install hatch
25+
- name: Build and publish
26+
env:
27+
HATCH_INDEX_USER: "__token__"
28+
HATCH_INDEX_AUTH: ${{ secrets.PYPI_TOKEN }}
29+
run: |
30+
hatch build
31+
hatch publish

.gitlab-ci.yml

Lines changed: 0 additions & 127 deletions
This file was deleted.

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
The MIT License (MIT)
22

3-
Copyright (c) 2018 - 2024 EOX IT Services
3+
Copyright (c) 2018 - 2025 EOX IT Services
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.rst

Lines changed: 122 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,129 @@
1-
================
21
mapchete Hub CLI
32
================
43

5-
CLI and Python bindings to mapchete Hub API.
4+
A command line interface for mapchete Hub.
5+
6+
.. image:: https://img.shields.io/pypi/v/mapchete-hub-cli.svg
7+
:target: https://pypi.org/project/mapchete-hub-cli/
8+
9+
.. image:: https://img.shields.io/pypi/l/mapchete-hub-cli.svg
10+
:target: https://github.com/mapchete/mapchete-hub-cli/blob/main/LICENSE
11+
12+
.. image:: https://img.shields.io/github/actions/workflow/status/mapchete/mapchete-hub-cli/python-package.yml?label=tests
13+
:target: https://github.com/mapchete/mapchete-hub-cli/actions
14+
15+
.. image:: https://codecov.io/gh/mapchete/mapchete-hub-cli/graph/badge.svg?token=VD1YOF3QA2
16+
:target: https://codecov.io/gh/mapchete/mapchete-hub-cli
17+
18+
.. image:: https://img.shields.io/github/repo-size/mapchete/mapchete-hub-cli
19+
:target: https://github.com/mapchete/mapchete-hub-cli
20+
21+
About mapchete Hub CLI
22+
========================
23+
24+
The mapchete Hub CLI provides a user-friendly command line interface (``mhub``) to interact with a running mapchete Hub instance. It simplifies the process of submitting, monitoring, and managing processing jobs without needing to write custom scripts or use tools like `curl`.
25+
26+
This CLI is the recommended tool for users who want to script workflows or manage mapchete Hub jobs from their terminal.
27+
28+
29+
Key Features
30+
============
31+
32+
* **💻 Full Job Lifecycle Management**: Intuitive commands to ``execute``, ``job`` (status), ``jobs`` (list), ``cancel``, and ``retry`` processing jobs.
33+
* **⚙️ Inspection**: List available ``processes`` on a remote mapchete Hub and check remote package ``--remote-versions``.
34+
* **🔒 Authentication Support**: Handles basic authentication via command line options (``-u``, ``-p``) or environment variables.
35+
* **🤖 Script-Friendly**: Designed for easy integration into automated scripts and workflows.
36+
37+
38+
Installation
39+
============
40+
41+
Install the CLI and its dependencies from PyPI:
42+
43+
.. code-block:: bash
44+
45+
pip install mapchete-hub-cli
46+
47+
48+
Quickstart
49+
==========
50+
51+
**1. Point to your mapchete Hub**
52+
53+
All commands require you to specify the mapchete Hub's URL using the ``-h`` or ``--host`` option. If the mapchete Hub is running on the same machine with default settings (``0.0.0.0:5000``), you may not need this option.
54+
55+
**2. List Available Processes**
56+
57+
You can see what processes are available on the target mapchete Hub instance:
58+
59+
.. code-block:: bash
60+
61+
mhub -h 0.0.0.0:5000 processes
662
7-
License
8-
-------
63+
**3. Prepare a mapchete File**
964

10-
MIT License
65+
Create a `mapchete process file <https://github.com/mapchete/mapchete>`_ using YAML syntax. **Note that all input and output paths must be absolute**, as they are resolved on the remote server.
1166

12-
Copyright (c) 2018 - 2024 `EOX IT Services`_
67+
For example, `hillshade.mapchete`:
68+
69+
.. code-block:: yaml
70+
71+
process: mapchete.processes.examples.hillshade
72+
zoom_levels:
73+
- 10
74+
pyramid:
75+
grid: geodetic
76+
input:
77+
dem: https://data.example.com/path/to/dem.tif
78+
output:
79+
path: s3://my-bucket/path/to/hillshade_output
80+
format: GTiff
81+
82+
**4. Execute the Process**
83+
84+
Use the ``execute`` command to send the job to the mapchete Hub.
85+
86+
.. code-block:: bash
87+
88+
mhub -h 0.0.0.0:5000 execute hillshade.mapchete
89+
90+
The mapchete Hub will return a unique `job_id`:
91+
92+
.. code-block:: text
93+
94+
6227b68b-b7e6-4f40-a396-85763197f481
95+
96+
**5. Check Job Status and Progress**
97+
98+
Use the `job_id` with the ``job`` command to get a detailed status report, or ``progress`` for a quick look at the progress percentage.
99+
100+
.. code-block:: bash
101+
102+
# Get detailed status
103+
mhub -h 0.0.0.0:5000 job 6227b68b-b7e6-4f40-a396-85763197f481
104+
105+
# Get just the progress
106+
mhub -h 0.0.0.0:5000 progress 6227b68b-b7e6-4f40-a396-85763197f481
107+
108+
**6. Manage Jobs**
109+
110+
You can also list all jobs or cancel a running job:
111+
112+
.. code-block:: bash
113+
114+
# List all jobs on the mapchete Hub
115+
mhub -h 0.0.0.0:5000 jobs
116+
117+
# Cancel a specific job
118+
mhub -h 0.0.0.0:5000 cancel 6227b68b-b7e6-4f40-a396-85763197f481
119+
120+
121+
Contributing
122+
============
123+
124+
This is an open-source project and we welcome contributions! Please see the `Contributing Guide <https://github.com/mapchete/mapchete/blob/main/CONTRIBUTING.md>`_ in the main ``mapchete`` repository for guidelines on how to get started.
125+
126+
Acknowledgements
127+
================
13128

14-
.. _`EOX IT Services`: https://eox.at/
129+
The initial development of this project was made possible with the resources and support of `EOX IT Services GmbH <https://eox.at/>`_.

0 commit comments

Comments
 (0)