diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 012e3b5e..7f25e87a 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,48 +1,58 @@ # Contributing Issues and pull requests are more than welcome. + -**dev install** +### Development Environment Setup -```bash -git clone https://github.com/stac-utils/stac-fastapi.git -cd stac-fastapi -python -m pip install -e stac_fastapi/api[dev] +To install the classes in your local Python env, run: + +```shell +pip install -e 'stac_fastapi/elasticsearch[dev]' +``` + +or + +```shell +pip install -e 'stac_fastapi/opensearch[dev]' ``` -**pre-commit** +### Pre-commit -This repo is set to use `pre-commit` to run *ruff*, *pydocstring* and mypy when committing new code. +Install [pre-commit](https://pre-commit.com/#install). -```bash +Prior to commit, run: + +```shell pre-commit install -``` +pre-commit run --all-files +``` -### Docs +### Testing -```bash -git clone https://github.com/stac-utils/stac-fastapi.git -cd stac-fastapi -python pip install -e stac_fastapi/api["docs"] +```shell +make test ``` +Test against OpenSearch only -Hot-reloading docs: - -```bash -$ mkdocs serve -f docs/mkdocs.yml +```shell +make test-opensearch ``` -To manually deploy docs (note you should never need to do this because GitHub -Actions deploys automatically for new commits.): +Test against Elasticsearch only + +```shell +make test-elasticsearch +``` -```bash -Create API documentations -$ pdocs as_markdown \ - --output_dir docs/src/api/ \ - --exclude_source \ - --overwrite \ - stac_fastapi.opensearch +### Docs -# deploy -$ mkdocs gh-deploy -f docs/mkdocs.yml -``` \ No newline at end of file +```shell +make docs +``` + +Hot-reloading docs locally: + +```shell +mkdocs serve -f docs/mkdocs.yml +``` diff --git a/README.md b/README.md index d88ae058..878ae587 100644 --- a/README.md +++ b/README.md @@ -36,32 +36,8 @@ pip install stac_fastapi.opensearch #### For changes, see the [Changelog](CHANGELOG.md) - -## Development Environment Setup - -To install the classes in your local Python env, run: - -```shell -pip install -e 'stac_fastapi/elasticsearch[dev]' -``` - -or - -```shell -pip install -e 'stac_fastapi/opensearch[dev]' -``` - - -### Pre-commit - -Install [pre-commit](https://pre-commit.com/#install). - -Prior to commit, run: - -```shell -pre-commit run --all-files -``` - +#### Development notes: [Contributing](CONTRIBUTING.md) + ## Build Elasticsearh API backend ```shell @@ -135,22 +111,6 @@ Options: python3 data_loader.py --base-url http://localhost:8080 ``` -## Testing - -```shell -make test -``` -Test against OpenSearch only - -```shell -make test-opensearch -``` - -Test against Elasticsearch only - -```shell -make test-elasticsearch -``` ## Elasticsearch Mappings diff --git a/docs/src/tips-and-tricks.md b/docs/src/tips-and-tricks.md index 587afe52..27919e5c 100644 --- a/docs/src/tips-and-tricks.md +++ b/docs/src/tips-and-tricks.md @@ -1,33 +1,3 @@ # Tips and Tricks -This page contains a few 'tips and tricks' for getting **stac-fastapi** working in various situations. - -## Get stac-fastapi working with CORS - -CORS (Cross-Origin Resource Sharing) support may be required to use stac-fastapi in certain situations. -For example, if you are running [stac-browser](https://github.com/radiantearth/stac-browser) to browse the STAC catalog created by **stac-fastapi**, then you will need to enable CORS support. -To do this, edit your backend's `app.py` and add the following import: - -```python -from fastapi.middleware.cors import CORSMiddleware -``` - -and then edit the `api = StacApi(...` call to add the following parameter: - -```python -middlewares=[lambda app: CORSMiddleware(app, allow_origins=["*"])] -``` - -If needed, you can edit the `allow_origins` parameter to only allow CORS requests from specific origins. - -## Enable the Context extension - -The Context STAC extension provides information on the number of items matched and returned from a STAC search. -This is required by various other STAC-related tools, such as the pystac command-line client. -To enable the extension, edit your backend's `app.py` and add the following import: - -```python -from stac_fastapi.extensions.core.context import ContextExtension -``` - -and then edit the `api = StacApi(...` call to add `ContextExtension()` to the list given as the `extensions` parameter. \ No newline at end of file +This page contains a few 'tips and tricks' for working with **sfeos**.