Skip to content

Commit d26f690

Browse files
authored
feat: add stapi-pydantic (#6)
* feat: add stapi-pydantic * fix: mypy * fix: unused import * fix: runs-on * feat: add concurrency * fix; uv run mypy
1 parent 270f7ac commit d26f690

File tree

20 files changed

+1003
-0
lines changed

20 files changed

+1003
-0
lines changed

.github/workflows/ci.yaml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: "Continuous integration"
2+
3+
concurrency:
4+
group: ${{ github.ref }}
5+
cancel-in-progress: false
6+
7+
on:
8+
push:
9+
branches:
10+
- main
11+
pull_request:
12+
13+
jobs:
14+
ci:
15+
name: Continuous integration
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: actions/checkout@v4
19+
- uses: astral-sh/setup-uv@v5
20+
- name: Sync
21+
run: uv sync
22+
- name: Lint
23+
run: scripts/lint
24+
- name: Test
25+
run: uv run pytest

.python-version

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

pyproject.toml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
[project]
2+
name = "pystapi"
3+
version = "0.0.0" # This package should never be released, only the workspace members should be
4+
description = "Monorepo for Satellite Tasking API (STAPI) Specification Python packages"
5+
readme = "README.md"
6+
requires-python = ">=3.10"
7+
dependencies = [
8+
"stapi-pydantic"
9+
]
10+
11+
[dependency-groups]
12+
dev = [
13+
"mypy>=1.15.0",
14+
"pytest>=8.3.5",
15+
"ruff>=0.11.2",
16+
]
17+
18+
[tool.uv.workspace]
19+
members = ["stapi-pydantic"]
20+
21+
[tool.uv.sources]
22+
stapi-pydantic.workspace = true
23+
24+
[tool.mypy]
25+
strict = true
26+
files = "stapi-pydantic/src/stapi_pydantic/**/*.py"

scripts/format

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/usr/bin/env sh
2+
3+
uv run ruff check --fix
4+
uv run ruff format

scripts/lint

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
2+
#!/usr/bin/env sh
3+
4+
uv run ruff check
5+
uv run ruff format --check
6+
uv run mypy

stapi-pydantic/README.md

Whitespace-only changes.

stapi-pydantic/pyproject.toml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
[project]
2+
name = "stapi-pydantic"
3+
version = "0.0.1"
4+
description = "Pydantic models for Satellite Tasking API (STAPI) Specification"
5+
readme = "README.md"
6+
authors = [
7+
{ name = "Phil Varner", email = "[email protected]" },
8+
{ name = "Pete Gadomski", email = "[email protected]" },
9+
]
10+
requires-python = ">=3.10"
11+
dependencies = [
12+
"cql2>=0.3.6",
13+
"geojson-pydantic>=1.2.0",
14+
]
15+
16+
[project.scripts]
17+
stapi-pydantic = "stapi_pydantic:main"
18+
19+
[build-system]
20+
requires = ["hatchling"]
21+
build-backend = "hatchling.build"
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
from .opportunity import OpportunityProperties
2+
from .product import Product, Provider, ProviderRole
3+
from .shared import Link
4+
5+
__all__ = [
6+
"Link",
7+
"OpportunityProperties",
8+
"Product",
9+
"Provider",
10+
"ProviderRole",
11+
]
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
from pydantic import BaseModel, Field
2+
3+
CORE = "https://stapi.example.com/v0.1.0/core"
4+
OPPORTUNITIES = "https://stapi.example.com/v0.1.0/opportunities"
5+
ASYNC_OPPORTUNITIES = "https://stapi.example.com/v0.1.0/async-opportunities"
6+
7+
8+
class Conformance(BaseModel):
9+
conforms_to: list[str] = Field(
10+
default_factory=list, serialization_alias="conformsTo"
11+
)
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
from pydantic import BaseModel, ConfigDict
2+
3+
4+
class Constraints(BaseModel):
5+
model_config = ConfigDict(extra="allow")

0 commit comments

Comments
 (0)