|
1 | | -# Tilebox Python Packages |
| 1 | +<h1 align="center"> |
| 2 | + <img src="https://storage.googleapis.com/tbx-web-assets-2bad228/banners/tilebox-banner.svg" alt="Tilebox Logo"> |
| 3 | + <br> |
| 4 | +</h1> |
| 5 | + |
| 6 | +<div align="center"> |
| 7 | + <a href="https://pypi.org/project/tilebox-workflows/"> |
| 8 | + <img src="https://img.shields.io/pypi/v/tilebox-workflows.svg?style=flat-square&label=version&color=f43f5e" alt="PyPi Latest Release badge"/> |
| 9 | + </a> |
| 10 | + <a href="https://pypi.org/project/tilebox-workflows/"> |
| 11 | + <img src="https://img.shields.io/pypi/pyversions/tilebox-workflows.svg?style=flat-square&logo=python&color=f43f5e&logoColor=f43f5e" alt="Required Python Version badge"/> |
| 12 | + </a> |
| 13 | + <a href="https://github.com/tilebox/tilebox-python/blob/main/LICENSE"> |
| 14 | + <img src="https://img.shields.io/github/license/tilebox/tilebox-python.svg?style=flat-square&color=f43f5e" alt="MIT License"/> |
| 15 | + </a> |
| 16 | + <a href="https://github.com/tilebox/tilebox-python/actions"> |
| 17 | + <img src="https://img.shields.io/github/actions/workflow/status/tilebox/tilebox-python/main.yml?style=flat-square&color=f43f5e" alt="Build Status"/> |
| 18 | + </a> |
| 19 | + <a href="https://tilebox.com/discord"> |
| 20 | + <img src="https://img.shields.io/badge/Discord-%235865F2.svg?style=flat-square&logo=discord&logoColor=white" alt="Join us on Discord"/> |
| 21 | + </a> |
| 22 | +</div> |
| 23 | + |
| 24 | +<p align="center"> |
| 25 | + <a href="https://docs.tilebox.com/"><b>Documentation</b></a> |
| 26 | + | |
| 27 | + <a href="https://console.tilebox.com/"><b>Console</b></a> |
| 28 | + | |
| 29 | + <a href="https://examples.tilebox.com/"><b>Example Gallery</b></a> |
| 30 | +</p> |
| 31 | + |
| 32 | +# Tilebox Python |
| 33 | + |
| 34 | +Python clients for [Tilebox](https://tilebox.com) - a framework for space data management and workflow orchestration. |
| 35 | + |
| 36 | +## Install |
2 | 37 |
|
3 | | -Mono-repo containing various Tilebox python packages. |
4 | | - |
5 | | -## Module and package structure |
6 | | - |
7 | | -We use python [namespace packages](https://packaging.python.org/en/latest/guides/packaging-namespace-packages/) to |
8 | | -organize our code into multiple packages that then share a common python module name. |
9 | | - |
10 | | -Currently we use the following top level module names: |
11 | | - |
12 | | -``` |
13 | | -import tilebox # public API |
14 | | -import _tilebox # private, internal modules |
| 38 | +```bash |
| 39 | +pip install tilebox-datasets tilebox-workflows tilebox-storage |
15 | 40 | ``` |
16 | 41 |
|
17 | | -There is some inter-dependency across packages in this repository. A quick overview of how they are connected |
18 | | -provides this diagram: |
| 42 | +> [!TIP] |
| 43 | +> For new projects we recommend using [uv](https://docs.astral.sh/uv/) - `uv add tilebox-datasets tilebox-workflows tilebox-storage`. Additional installation options are available [in our docs](https://docs.tilebox.com/sdks/python/install). |
19 | 44 |
|
20 | | - |
| 45 | +## Documentation |
21 | 46 |
|
22 | | -## Required tooling |
| 47 | +Documentation is available at [docs.tilebox.com](https://docs.tilebox.com). |
23 | 48 |
|
24 | | -Before starting to work on this repository, make sure you have uv installed. [Install instructions](https://docs.astral.sh/uv/getting-started/installation/). |
| 49 | +## Getting started |
25 | 50 |
|
26 | | -## Workspace setup |
| 51 | +### Tilebox Datasets |
27 | 52 |
|
28 | | -This repository is set up as a [uv workspace](https://docs.astral.sh/uv/concepts/workspaces/). |
| 53 | +Structured and high-performance satellite metadata storage, indexing and querying. [See documentation](https://docs.tilebox.com/datasets/introduction) |
29 | 54 |
|
30 | | -This means it contains multiple packages, which all share the same virtualenv, and may have interdependencies between |
31 | | -them. |
| 55 | +```python |
| 56 | +from tilebox.datasets import Client |
| 57 | +from shapely.geometry import shape |
32 | 58 |
|
33 | | -## Useful commands for development |
| 59 | +# create your API key at https://console.tilebox.com |
| 60 | +client = Client(token="YOUR_TILEBOX_API_KEY") |
| 61 | +datasets = client.datasets() |
| 62 | +print(datasets) |
34 | 63 |
|
35 | | -### Initial setup |
| 64 | +sentinel2_msi = client.dataset("open_data.copernicus.sentinel2_msi") |
| 65 | +collections = sentinel2_msi.collections() |
| 66 | +print(collections) |
36 | 67 |
|
37 | | -```bash |
38 | | -uv sync |
| 68 | +area_of_interest = shape({ |
| 69 | + "type": "Polygon", # coords in lon, lat |
| 70 | + "coordinates": [[[-5, 50], [-5, 56], [-11, 56], [-11, 50], [-5, 50]]]} |
| 71 | +) |
| 72 | +s2a_l1c = sentinel2_msi.collection("S2A_S2MSI1C") |
| 73 | +results = s2a_l1c.query( |
| 74 | + temporal_extent=("2022-07-13", "2022-07-13T02:00"), |
| 75 | + spatial_extent=area_of_interest, |
| 76 | + show_progress=True |
| 77 | +) |
| 78 | +print(f"Found {results.sizes['time']} datapoints") # Found 979 datapoints |
39 | 79 | ``` |
40 | 80 |
|
41 | | -### Copying proto files to the correct locations |
42 | | - |
43 | | -```bash |
44 | | -uv run copy-protobuf |
45 | | -``` |
46 | 81 |
|
47 | | -### Running tests |
| 82 | +### Tilebox Workflows |
48 | 83 |
|
49 | | -```bash |
50 | | -./tests.sh # helper script for running with coverage |
| 84 | +A parallel processing engine to simplify the creation of dynamic tasks that can be executed across various computing environments, including on-premise and auto-scaling clusters in public clouds. |
51 | 85 |
|
52 | | -# testing a single package |
53 | | -uv run --package tilebox-datasets pytest tilebox-datasets |
54 | | -``` |
| 86 | +```python |
| 87 | +from tilebox.workflows import Client, Task |
55 | 88 |
|
56 | | -### Running code analysis |
| 89 | +class MyFirstTask(Task): |
| 90 | + def execute(self): |
| 91 | + print("Hello World from my first Tilebox task!") |
57 | 92 |
|
58 | | -```bash |
59 | | -# formatting and linting: |
60 | | -uv run ruff format . && uv run ruff check --fix . |
61 | 93 |
|
62 | | -# type checking: |
63 | | -uv run pyright . |
64 | | -``` |
| 94 | +# create your API key at https://console.tilebox.com |
| 95 | +client = Client(token="YOUR_TILEBOX_API_KEY") |
65 | 96 |
|
66 | | -### Adding dependencies to one of the packages |
| 97 | +# submit a job |
| 98 | +jobs = client.jobs() |
| 99 | +jobs.submit("my-very-first-job", MyFirstTask()) |
67 | 100 |
|
68 | | -```bash |
69 | | -uv add --package tilebox-datasets "numpy>=2" |
| 101 | +# and run it |
| 102 | +runner = client.runner(tasks=[MyFirstTask]) |
| 103 | +runner.run_all() |
70 | 104 | ``` |
71 | 105 |
|
72 | | -### Used code quality tools |
73 | | - |
74 | | -- [ruff](https://github.com/astral-sh/ruff) for linting and formatting |
75 | | -- [pyright](https://github.com/microsoft/pyright) for type checking |
76 | | -- [pre-commit](https://pre-commit.com/) for running all of the above automatically on each git commit |
| 106 | +## Contributing |
77 | 107 |
|
78 | | -## Releasing and deploying a new version |
| 108 | +Contributions are welcome! Please see the [contributing guide](https://github.com/tilebox/tilebox-python/blob/main/CONTRIBUTING.md) for more information. |
79 | 109 |
|
80 | | -There is a Github CI workflow set up for building the packages and pushing them to the internal `pypi`. |
81 | | -All that is needed is to create a github release for a given tag. This can be done in the github web UI or on the |
82 | | -command line. |
| 110 | +You can also join us on [Discord](https://tilebox.com/discord) if you have any questions or want to share your ideas. |
83 | 111 |
|
84 | | -For example, to release a version `0.1.0` via the CLI the following commands could be used: |
85 | | -(this uses [parse-changelog](https://github.com/taiki-e/parse-changelog) for release notes) |
| 112 | +## License |
86 | 113 |
|
87 | | -```bash |
88 | | -git tag "v0.1.0" -m "Tilebox Python Release v0.1.0" |
89 | | -git push -u origin v0.1.0 |
90 | | -gh release create v0.1.0 --notes $(parse-changelog CHANGELOG.md) |
91 | | -# wait a bit until CI pipeline is done and voila! |
92 | | -``` |
| 114 | +Distributed under the MIT License (`The MIT License`). |
0 commit comments