Skip to content

Commit 5b3c435

Browse files
committed
update documentation
1 parent b795502 commit 5b3c435

File tree

3 files changed

+43
-103
lines changed

3 files changed

+43
-103
lines changed

CONTRIBUTING.md

+40-30
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,58 @@
11
# Contributing
22

33
Issues and pull requests are more than welcome.
4+
45

5-
**dev install**
6+
### Development Environment Setup
67

7-
```bash
8-
git clone https://github.com/stac-utils/stac-fastapi.git
9-
cd stac-fastapi
10-
python -m pip install -e stac_fastapi/api[dev]
8+
To install the classes in your local Python env, run:
9+
10+
```shell
11+
pip install -e 'stac_fastapi/elasticsearch[dev]'
12+
```
13+
14+
or
15+
16+
```shell
17+
pip install -e 'stac_fastapi/opensearch[dev]'
1118
```
1219

13-
**pre-commit**
20+
### Pre-commit
1421

15-
This repo is set to use `pre-commit` to run *ruff*, *pydocstring* and mypy when committing new code.
22+
Install [pre-commit](https://pre-commit.com/#install).
1623

17-
```bash
24+
Prior to commit, run:
25+
26+
```shell
1827
pre-commit install
19-
```
28+
pre-commit run --all-files
29+
```
2030

21-
### Docs
31+
### Testing
2232

23-
```bash
24-
git clone https://github.com/stac-utils/stac-fastapi.git
25-
cd stac-fastapi
26-
python pip install -e stac_fastapi/api["docs"]
33+
```shell
34+
make test
2735
```
36+
Test against OpenSearch only
2837

29-
Hot-reloading docs:
30-
31-
```bash
32-
$ mkdocs serve -f docs/mkdocs.yml
38+
```shell
39+
make test-opensearch
3340
```
3441

35-
To manually deploy docs (note you should never need to do this because GitHub
36-
Actions deploys automatically for new commits.):
42+
Test against Elasticsearch only
43+
44+
```shell
45+
make test-elasticsearch
46+
```
3747

38-
```bash
39-
Create API documentations
40-
$ pdocs as_markdown \
41-
--output_dir docs/src/api/ \
42-
--exclude_source \
43-
--overwrite \
44-
stac_fastapi.opensearch
48+
### Docs
4549

46-
# deploy
47-
$ mkdocs gh-deploy -f docs/mkdocs.yml
48-
```
50+
```shell
51+
make docs
52+
```
53+
54+
Hot-reloading docs locally:
55+
56+
```shell
57+
mkdocs serve -f docs/mkdocs.yml
58+
```

README.md

+2-42
Original file line numberDiff line numberDiff line change
@@ -36,32 +36,8 @@ pip install stac_fastapi.opensearch
3636

3737
#### For changes, see the [Changelog](CHANGELOG.md)
3838

39-
40-
## Development Environment Setup
41-
42-
To install the classes in your local Python env, run:
43-
44-
```shell
45-
pip install -e 'stac_fastapi/elasticsearch[dev]'
46-
```
47-
48-
or
49-
50-
```shell
51-
pip install -e 'stac_fastapi/opensearch[dev]'
52-
```
53-
54-
55-
### Pre-commit
56-
57-
Install [pre-commit](https://pre-commit.com/#install).
58-
59-
Prior to commit, run:
60-
61-
```shell
62-
pre-commit run --all-files
63-
```
64-
39+
#### Development notes: [Contributing](CONTRIBUTING.md)
40+
6541
## Build Elasticsearh API backend
6642

6743
```shell
@@ -135,22 +111,6 @@ Options:
135111
python3 data_loader.py --base-url http://localhost:8080
136112
```
137113

138-
## Testing
139-
140-
```shell
141-
make test
142-
```
143-
Test against OpenSearch only
144-
145-
```shell
146-
make test-opensearch
147-
```
148-
149-
Test against Elasticsearch only
150-
151-
```shell
152-
make test-elasticsearch
153-
```
154114

155115
## Elasticsearch Mappings
156116

docs/src/tips-and-tricks.md

+1-31
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,3 @@
11
# Tips and Tricks
22

3-
This page contains a few 'tips and tricks' for getting **stac-fastapi** working in various situations.
4-
5-
## Get stac-fastapi working with CORS
6-
7-
CORS (Cross-Origin Resource Sharing) support may be required to use stac-fastapi in certain situations.
8-
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.
9-
To do this, edit your backend's `app.py` and add the following import:
10-
11-
```python
12-
from fastapi.middleware.cors import CORSMiddleware
13-
```
14-
15-
and then edit the `api = StacApi(...` call to add the following parameter:
16-
17-
```python
18-
middlewares=[lambda app: CORSMiddleware(app, allow_origins=["*"])]
19-
```
20-
21-
If needed, you can edit the `allow_origins` parameter to only allow CORS requests from specific origins.
22-
23-
## Enable the Context extension
24-
25-
The Context STAC extension provides information on the number of items matched and returned from a STAC search.
26-
This is required by various other STAC-related tools, such as the pystac command-line client.
27-
To enable the extension, edit your backend's `app.py` and add the following import:
28-
29-
```python
30-
from stac_fastapi.extensions.core.context import ContextExtension
31-
```
32-
33-
and then edit the `api = StacApi(...` call to add `ContextExtension()` to the list given as the `extensions` parameter.
3+
This page contains a few 'tips and tricks' for working with **sfeos**.

0 commit comments

Comments
 (0)