Newer
Older
# Installation
Python package is hosted in gitlab package registry.
You need to show pip the extra indexes:
```commandline
pip install custom-extension-example \
--extra-index-url https://forgemia.inra.fr/api/v4/projects/10919/packages/pypi/simple \
--extra-index-url https://forgemia.inra.fr/api/v4/projects/10920/packages/pypi/simple
```
Where:
- `https://forgemia.inra.fr/api/v4/projects/10919/packages/pypi/simple` is for the `stacflow-stac-extension` package
- `https://forgemia.inra.fr/api/v4/projects/10920/packages/pypi/simple` is for the `custom-extension-example` package
# Usage
## Apply extension to a STAC object
```python
from custom_extension_example import MyExtension, MyExtensionModel
ext_md = MyExtensionModel(
name="test",
authors=["michel", "denis"],
version="alpha"
)
stac_item_or_asset = ...
ext = MyExtension.ext(stac_item_or_asset, add_if_missing=True)
ext.apply(ext_md)
```
## Read extension metadata from a STAC object
```python
from custom_extension_example import MyExtension
stac_item_or_asset = ...
ext = MyExtension(stac_item_or_asset)
print(ext.name)
print(ext.version)
print(ext.authors)
```
# Developer's checklist
- [ ] Push the code on gitlab, copy-paste the schema URI in your own extension
- [ ] Bump `__version__` in `__init__.py` before each new release