Skip to content

Commit a89e6ae

Browse files
authored
feat: add notes about vanilla server (#23)
Closes #17
1 parent 269301a commit a89e6ae

File tree

3 files changed

+45
-47
lines changed

3 files changed

+45
-47
lines changed

README.md

Lines changed: 39 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,46 @@
22

33
Monorepo for Python Satellite Tasking API (STAPI) Specification packages.
44

5-
## Packages
5+
## Development
6+
7+
Get [uv](https://docs.astral.sh/uv/), then:
8+
9+
```shell
10+
git clone [email protected]:stapi-spec/pystapi.git
11+
cd pystapi
12+
uv sync
13+
```
14+
15+
Test:
16+
17+
```shell
18+
uv run pytest
19+
```
20+
21+
Check formatting and other lints:
22+
23+
```shell
24+
uv run pre-commit --all-files
25+
```
626

7-
This diagram is aspirational while we build out things during the 2025 STAPI sprint in Lisbon.
27+
If you don't want to type `uv run` all the time:
28+
29+
```shell
30+
source .venv/bin/activate
31+
```
32+
33+
### stapi-fastapi server
34+
35+
A minimal test implementation is provided in [stapi-fastapi/tests/application.py](stapi-fastapi/tests/application.py).
36+
Run it like so:
37+
38+
```commandline
39+
uv run fastapi dev stapi-fastapi/tests/application.py
40+
```
41+
42+
The app should be accessible at `http://localhost:8000`.
43+
44+
## Packages
845

946
```mermaid
1047
graph

docs/index.md

Lines changed: 0 additions & 1 deletion
This file was deleted.

docs/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# pystapi

stapi-fastapi/README.md

Lines changed: 5 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# STAPI FastAPI - Sensor Tasking API with FastAPI
22

3-
WARNING: The whole [STAPI spec] is very much a work in progress, so things are
4-
guaranteed to be not correct.
3+
> [!WARNING]
4+
> The whole [STAPI spec] is very much a work in progress, so things are guaranteed to be not correct.
55
66
## Usage
77

@@ -11,8 +11,9 @@ STAPI FastAPI provides an `fastapi.APIRouter` which must be included in
1111
### Pagination
1212

1313
4 endpoints currently offer pagination:
14-
`GET`: `'/orders`, `/products`, `/orders/{order_id}/statuses`
15-
`POST`: `/opportunities`.
14+
15+
- `GET`: `'/orders`, `/products`, `/orders/{order_id}/statuses`
16+
- `POST`: `/opportunities`.
1617

1718
Pagination is token based and follows recommendations in the [STAC API pagination].
1819
Limit and token are passed in as query params for `GET` endpoints, and via the body as
@@ -28,50 +29,10 @@ returned indicates there are no further records available.
2829

2930
ADRs can be found in in the [adrs](./adrs/README.md) directory.
3031

31-
## Development
32-
33-
It's 2024 and we still need to pick our poison for a 2024 dependency management
34-
solution. This project picks [poetry] for now.
35-
36-
### Dev Setup
37-
38-
Setup is managed with `poetry` and `pre-commit`. It's recommended to install
39-
the project into a virtual environment. Bootstrapping a development environment
40-
could look something like this:
41-
42-
```commandline
43-
python -m venv .venv
44-
source .venv/bin/activate
45-
pip install poetry # if not already installed to the system
46-
poetry install --with dev
47-
pre-commit install
48-
```
49-
50-
### Test Suite
51-
52-
A `pytest` based test suite is provided, and can be run simply using the
53-
command `pytest`.
54-
55-
### Dev Server
56-
57-
This project cannot be run on its own because it does not have any backend
58-
implementations. However, a minimal test implementation is provided in
59-
[`./tests/application.py`](./tests/application.py). It can be run with
60-
`uvicorn` as a way to interact with the API and to view the OpenAPI
61-
documentation. Run it like so from the project root:
62-
63-
```commandline
64-
uvicorn application:app --app-dir ./tests --reload
65-
```
66-
67-
With the `uvicorn` defaults the app should be accessible at
68-
`http://localhost:8000`.
69-
7032
### Implementing a backend
7133

7234
- The test suite assumes the backend can be instantiated without any parameters
7335
required by the constructor.
7436

7537
[STAPI spec]: https://github.com/stapi-spec/stapi-spec
76-
[poetry]: https://python-poetry.org/
7738
[STAC API pagination]: https://github.com/radiantearth/stac-api-spec/blob/release/v1.0.0/item-search/examples.md#paging-examples

0 commit comments

Comments
 (0)