Skip to content

Commit 379c8a4

Browse files
authored
Merge branch 'main' into use-stapi-pydantic-in-stapi-fastapi
2 parents 919653e + 19cb707 commit 379c8a4

File tree

6 files changed

+132
-48
lines changed

6 files changed

+132
-48
lines changed

.github/pull_request_template.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
## What I'm changing
2+
3+
- <!-- a list of changes, including any issues this might close or reference -->
4+
5+
## How I did it
6+
7+
- <!-- more detail on decisions and choices -->
8+
9+
## Checklist
10+
11+
- [ ] Tests pass: `uv run pytest`
12+
- [ ] Checks pass: `uv run pre-commit --all-files`
13+
- [ ] CHANGELOG is updated (if necessary)

CONTRIBUTING.md

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
# Contributing
2+
3+
First, thanks for contributing to **pystapi**!
4+
The [README](./README.md#development) as instructions on setting up your development environment, which is a great place to start.
5+
6+
## Repository organization
7+
8+
**pystapi** is a "monorepo", meaning that it contains several sub-projects.
9+
Each project has it's own `pyproject.toml` file, README, CHANGELOG, tests, and more.
10+
Development dependencies should be specified at the top-level `pyproject.toml` file, as tests are intended to be run for the entire repository at once.
11+
12+
## Branches
13+
14+
We have a single primary development branch, **main**.
15+
Releases are cut from this branch by tags.
16+
Tags are named to identify which project they are releasing, e.g. a **stapi-pydantic** tag might look like `stapi-pydantic/v0.1.2`.
17+
If necessary, long-lived release branches are used to manage non-breaking changes and fixes, e.g. a `stapi-pydantic/v0.1` branch to handle any bugfixes that need to be backported to the v0.1 lineage of the project after **main** has incorporated breaking changes.
18+
19+
## Testing
20+
21+
We use [pytest](https://docs.pytest.org).
22+
Tests should be written in the "pytest style", i.e. free functions.
23+
24+
Good:
25+
26+
```python
27+
def test_foo() -> None:
28+
assert 1 == 1
29+
```
30+
31+
Bad:
32+
33+
```python
34+
class FooTest(unittest.TestCase):
35+
def test_foo(self) -> None:
36+
assert 1 == 1
37+
```
38+
39+
## Static typing
40+
41+
We use [mypy](https://mypy-lang.org/) for static typing.
42+
When possible, projects work in `strict` mode, meaning that type checking is strongly enforced.
43+
Some projects are not quite ready for `strict` mode, but we want to get them there.
44+
45+
## Lints and checks
46+
47+
We use [pre-commit](https://pre-commit.com/).
48+
If you want to run checks on every commit:
49+
50+
```shell
51+
uv run pre-commit install
52+
```
53+
54+
If you ever need to disable **pre-commit** when committing use `--no-verify`:
55+
56+
```shell
57+
git commit --no-verify
58+
```
59+
60+
## Submitting changes
61+
62+
Open a [pull request](https://github.com/stapi-spec/pystapi/pulls) with your changes, and fill out the provided template.
63+
It's not required, but it's helpful if you name your pull request in the [Conventional Commit](https://www.conventionalcommits.org/en/v1.0.0/) style, as the pull request titles are the eventual commit title for your changes (we use squash-and-merge).
64+
A **pystapi** maintainer will review your PR and request any changes.
65+
Once approved, if you have the permissions you can merge your PR ... if you don't, a maintainer will.
66+
67+
If your PR is not ready for review, but you'd like some feedback on it anyways, open it as a draft.

README.md

Lines changed: 44 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,52 @@
11
# pystapi
22

3+
[![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/stapi-spec/pystapi/ci.yaml?style=for-the-badge)](https://github.com/stapi-spec/pystapi/actions/workflows/ci.yaml)
4+
35
Monorepo for Python Satellite Tasking API (STAPI) Specification packages.
6+
For more, see our [docs](https://stapi-spec.github.io/pystapi/).
47

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

7-
This diagram is aspirational while we build out things during the 2025 STAPI sprint in Lisbon.
30+
If you don't want to type `uv run` all the time:
31+
32+
```shell
33+
source .venv/bin/activate
34+
```
35+
36+
See our [contribution guidelines](./CONTRIBUTING.md) for information on contributing any changes, fixes, or features.
37+
38+
### stapi-fastapi server
39+
40+
A minimal test implementation is provided in [stapi-fastapi/tests/application.py](stapi-fastapi/tests/application.py).
41+
Run it like so:
42+
43+
```commandline
44+
uv run fastapi dev stapi-fastapi/tests/application.py
45+
```
46+
47+
The app should be accessible at `http://localhost:8000`.
48+
49+
## Packages
850

951
```mermaid
1052
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

pyproject.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,9 @@ module = "pygeofilter.parsers.*"
7070
ignore_missing_imports = true
7171

7272
[tool.pymarkdown]
73-
plugins.md013.line_length = 120
73+
plugins.md013.enabled = false # @gadomski likes to do one-line-per-sentence in markdown
7474
plugins.md024.enabled = false # duplicate headers in changelog
75+
plugins.md041.enabled = false # github templates don't start with an h1
7576

7677
[tool.coverage.report]
7778
show_missing = true

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)