Picterra Python API Client
Easily integrate state-of-the-art machine learning models in your app
from picterra import APIClient
# Replace this with the id of one of your detectors
detector_id = 'd552605b-6972-4a68-8d51-91e6cb531c24'
# Set the PICTERRA_API_KEY environment variable to define your API key
client = APIClient()
print('Uploading raster...')
raster_id = client.upload_raster('data/raster1.tif', name='a nice raster')
print('Upload finished, starting detector...')
result_id = client.run_detector(detector_id, raster_id)
client.download_result_to_feature_collection(result_id, 'result.geojson')
print('Detection finished, results are in result.geojson')
Installation
pip install picterra
See the examples folder for examples.
API Reference and User Guide available on Read the Docs
Development
Setup
Make sure you have Python and pip in your OS and create a virtual environment in the root folder, eg
python3 -m venv .venv
source .venv/bin/activate
Running
pip install --editable '.[lint,test]'
would allow to run test and linting locally, and also avoid re-installing the library every time you change the code.
If you want to install from a given branch, simply do
pip uninstall picterra
pip install git+https://github.com/Picterra/picterra-python.git@<branch_name>
Running tests
In order to test locally, run:
pytest
Documentation
Run
cd docs
pip install -r requirements.txt
make html
to update the HTML documentation under _build/html.
Spawn an HTTP server in that folder to see how they would look like once deployed on Read the Docs.
Checkling linting
Run
scripts/lint.sh
Sphinx docs
Run
cd docs
python -m pip install -r requirements.txt
make html
and verify no errors are output
Release process
- Preparatory work:
- 1.1 Bump the version number in
setup.py - 1.2 Update CHANGELOG.md (no need for all commits, just main changes with a tag)
- 1.1 Bump the version number in
- Manually run the publish to testpypi workflow
- Check the publication result on testpypi
- Create a release through github
- 4.1. Make sure you create a new tag vX.Y.Z through the release UI
- 4.2. Click the "generate release notes" button in the UI to get release notes (you can even do it after the release is created by updating it)
- The 'publish to pypi' workflow should automatically run
- 5.1. Note this will not work if you create the release first as a draft - you have to create it immediately
- Updated package should be available on pypi
Metadata
Release files for picterra 4.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| picterra-4.0.0.tar.gz | 32.0 kB | Without provenance | Details for picterra-4.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| picterra-4.0.0-py3-none-any.whl | Python 3 | none | any | Details for picterra-4.0.0-py3-none-any.whl |
Total release size: 52.8 kB
Release files / picterra-4.0.0.tar.gz
| Download URL | picterra-4.0.0.tar.gz |
|---|---|
| Size | 32.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
63f7cdd6f48a14a10ed82d32a2bb913b903103435c0b09d1c119d094d8f31384
|
|
BLAKE2b-256 checksum How to use checksums |
46c40516d97f3b03136a256653462b12f80559ff435ea4e7df924edd9f5c0dc7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Release files / picterra-4.0.0-py3-none-any.whl
| Download URL | picterra-4.0.0-py3-none-any.whl |
|---|---|
| Size | 20.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
2fb2db71a1ab440511db86bdf95e4f780aac90b17811f27840743d7ff03ea2b8
|
|
BLAKE2b-256 checksum How to use checksums |
6f213dc6e4f3cc469dc83f59ca962414889888e3192b9168023e35266cd94379
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Security for picterra 4.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.