Skip to main content

Picterra API client

Project description

Picterra logo

Picterra Python API Client

Tests Documentation Status PyPI - Version

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

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

  1. 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)
  2. Manually run the publish to testpypi workflow
  3. Check the publication result on testpypi
  4. 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)
  5. 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
  6. Updated package should be available on pypi

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

picterra-3.0.0.tar.gz (30.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

picterra-3.0.0-py3-none-any.whl (20.0 kB view details)

Uploaded Python 3

File details

Details for the file picterra-3.0.0.tar.gz.

File metadata

  • Download URL: picterra-3.0.0.tar.gz
  • Upload date:
  • Size: 30.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for picterra-3.0.0.tar.gz
Algorithm Hash digest
SHA256 791633364e8e00a9d87b2f9077e6d264cb937c3f4d1d5103cc7d37af38576a00
MD5 93d07899c67f5c9d9d40f21c47d105ae
BLAKE2b-256 40831f21d933ffdf8063c07dff52a5b7583900c21a50f45bd3f4d30f04896c52

See more details on using hashes here.

File details

Details for the file picterra-3.0.0-py3-none-any.whl.

File metadata

  • Download URL: picterra-3.0.0-py3-none-any.whl
  • Upload date:
  • Size: 20.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for picterra-3.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e9fe842de67ec0723ea6a8f80f8de472bcb108a0ec9f33d86cdee5b98131dedf
MD5 57ff4190f59383f4dd3cbdfdd843bebe
BLAKE2b-256 5b23cdca8428ea47f14153adc93d0d373d6aca64386634cec567c101df15e0c1

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page