Skip to content

Commit e4da46c

Browse files
committed
switch to uv and pyproject.toml
1 parent 2c1182b commit e4da46c

File tree

20 files changed

+1781
-262
lines changed

20 files changed

+1781
-262
lines changed

.github/workflows/cicd.yaml

Lines changed: 29 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -5,44 +5,41 @@ on:
55
pull_request:
66
branches: [main]
77

8+
env:
9+
LATEST_PY_VERSION: '3.14'
10+
811
jobs:
912
test:
1013
runs-on: ubuntu-latest
1114
strategy:
1215
matrix:
13-
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
16+
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13", "3.14"]
1417
timeout-minutes: 20
1518

1619
steps:
1720
- name: Check out repository code
1821
uses: actions/checkout@v5
19-
20-
# Setup Python (faster than using Python container)
21-
- name: Setup Python
22-
uses: actions/setup-python@v6
22+
23+
- name: Install uv
24+
uses: astral-sh/setup-uv@v3
2325
with:
24-
python-version: ${{ matrix.python-version }}
25-
26-
- name: Lint code
27-
if: ${{ matrix.python-version == 3.13 }}
28-
run: |
29-
python -m pip install pre-commit
30-
pre-commit run --all-files
31-
32-
- name: Install types
33-
run: |
34-
python -m pip install ./stac_fastapi/types[dev]
26+
version: "0.9.*"
27+
enable-cache: true
28+
29+
- name: Set up Python ${{ matrix.python-version }}
30+
run: uv python install ${{ matrix.python-version }}
3531

36-
- name: Install core api
32+
- name: Install dependencies
3733
run: |
38-
python -m pip install ./stac_fastapi/api[dev]
34+
uv sync --all-extras
3935
40-
- name: Install Extensions
36+
- name: Lint code
37+
if: ${{ matrix.python-version == env.LATEST_PY_VERSION }}
4138
run: |
42-
python -m pip install ./stac_fastapi/extensions[dev]
39+
uv run pre-commit run --all-files
4340
44-
- name: Test
45-
run: python -m pytest -svvv
41+
- name: Run tests
42+
run: uv run pytest -svvv
4643
env:
4744
ENVIRONMENT: testing
4845

@@ -60,25 +57,21 @@ jobs:
6057
- name: Check out repository code
6158
uses: actions/checkout@v5
6259

63-
- name: Setup Python
64-
uses: actions/setup-python@v6
60+
- name: Install uv
61+
uses: astral-sh/setup-uv@v3
6562
with:
66-
python-version: "3.13"
67-
68-
- name: Install types
69-
run: |
70-
python -m pip install ./stac_fastapi/types[dev]
71-
72-
- name: Install core api
73-
run: |
74-
python -m pip install ./stac_fastapi/api[dev,benchmark]
63+
version: "0.9.*"
64+
enable-cache: true
65+
66+
- name: Set up Python3
67+
run: uv python install 3
7568

76-
- name: Install extensions
69+
- name: Install dependencies
7770
run: |
78-
python -m pip install ./stac_fastapi/extensions
71+
uv sync --all-extras
7972
8073
- name: Run Benchmark
81-
run: python -m pytest stac_fastapi/api/tests/benchmarks.py --benchmark-only --benchmark-columns 'min, max, mean, median' --benchmark-json output.json
74+
run: uv run pytest stac_fastapi/api/tests/benchmarks.py --benchmark-only --benchmark-columns 'min, max, mean, median' --benchmark-json output.json
8275

8376
- name: Store and benchmark result
8477
if: github.repository == 'stac-utils/stac-fastapi'

.github/workflows/deploy_mkdocs.yml

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,18 +20,22 @@ jobs:
2020
- name: Checkout main
2121
uses: actions/checkout@v5
2222

23-
- name: Set up Python 3.11
24-
uses: actions/setup-python@v6
23+
- name: Install uv
24+
uses: astral-sh/setup-uv@v3
2525
with:
26-
python-version: 3.11
26+
version: "0.9.*"
27+
enable-cache: true
28+
29+
- name: Set up Python3
30+
run: uv python install 3
31+
32+
- name: Install dependencies
33+
run: |
34+
uv sync --all-extras
2735
2836
- name: Install dependencies
2937
run: |
30-
python -m pip install --upgrade pip
31-
python -m pip install \
32-
stac_fastapi/types[docs] \
33-
stac_fastapi/api[docs] \
34-
stac_fastapi/extensions[docs] \
38+
uv run pip install -r requirements/requirements-docs.txt
3539
3640
- name: Deploy docs
37-
run: mkdocs gh-deploy --force -f docs/mkdocs.yml
41+
run: uv run mkdocs gh-deploy --force -f docs/mkdocs.yml

.github/workflows/publish.yml

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,18 @@ jobs:
1212
steps:
1313
- uses: actions/checkout@v5
1414

15-
- name: Set up Python 3.x
16-
uses: actions/setup-python@v6
15+
- name: Install uv
16+
uses: astral-sh/setup-uv@v3
1717
with:
18-
python-version: "3.x"
19-
20-
- name: Install release dependencies
21-
run: |
22-
python -m pip install --upgrade pip
23-
pip install setuptools wheel twine
18+
version: "0.9.*"
19+
enable-cache: true
20+
21+
- name: Set up Python3
22+
run: uv python install 3
2423

2524
- name: Build and publish package
2625
env:
27-
TWINE_USERNAME: ${{ secrets.PYPI_STACUTILS_USERNAME }}
28-
TWINE_PASSWORD: ${{ secrets.PYPI_STACUTILS_PASSWORD }}
26+
UV_PUBLISH_USERNAME: ${{ secrets.PYPI_STACUTILS_USERNAME }}
27+
UV_PUBLISH_PASSWORD: ${{ secrets.PYPI_STACUTILS_PASSWORD }}
2928
run: |
3029
scripts/publish

CHANGES.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22

33
## [Unreleased]
44

5+
### Changed
6+
7+
- switch to pyproject.toml for package metadata
8+
- use `uv` for project managment
9+
- add python 3.14 support
10+
511
## [6.0.0] - 2025-06-19
612

713
### Changed

CONTRIBUTING.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,35 +7,35 @@ Issues and pull requests are more than welcome.
77
```bash
88
git clone https://github.com/stac-utils/stac-fastapi.git
99
cd stac-fastapi
10-
python -m pip install -e stac_fastapi/api[dev]
10+
uv sync --dev
1111
```
1212

1313
**pre-commit**
1414

1515
This repo is set to use `pre-commit` to run *ruff*, *pydocstring* and mypy when committing new code.
1616

1717
```bash
18-
pre-commit install
18+
uv run pre-commit install
1919
```
2020

2121
### Docs
2222

2323
```bash
2424
git clone https://github.com/stac-utils/stac-fastapi.git
2525
cd stac-fastapi
26-
python pip install -e stac_fastapi/api["docs"]
26+
uv pip instal -r requirements/requirements-docs.txt
2727
```
2828

2929
Hot-reloading docs:
3030

3131
```bash
32-
$ mkdocs serve -f docs/mkdocs.yml
32+
uv run mkdocs serve -f docs/mkdocs.yml
3333
```
3434

3535
To manually deploy docs (note you should never need to do this because GitHub
3636
Actions deploys automatically for new commits.):
3737

3838
```bash
3939
# deploy
40-
$ mkdocs gh-deploy -f docs/mkdocs.yml
40+
uv run mkdocs gh-deploy -f docs/mkdocs.yml
4141
```

README.md

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -78,16 +78,13 @@ Other backends may be available from other sources, search [PyPI](https://pypi.o
7878
Install the packages in editable mode:
7979

8080
```shell
81-
python -m pip install \
82-
-e 'stac_fastapi/types[dev]' \
83-
-e 'stac_fastapi/api[dev]' \
84-
-e 'stac_fastapi/extensions[dev]'
81+
uv sync --dev
8582
```
8683

8784
To run the tests:
8885

8986
```shell
90-
python -m pytest
87+
uv run pytest
9188
```
9289

9390
## Releasing

RELEASING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ This is a checklist for releasing a new version of **stac-fastapi**.
88

99
Note: You can use [`bump-my-version`](https://github.com/callowayproject/bump-my-version) CLI
1010
```
11-
bump-my-version bump --new-version 3.1.0
11+
uv run bump-my-version bump --new-version 3.1.0
1212
```
1313
1414
4. Update [CHANGES.md](./CHANGES.md) for the new version. Add the appropriate header, and update the links at the bottom of the file.

pyproject.toml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,39 @@
1+
[project]
2+
name = "stac-fastapi"
3+
version = "6.0.0"
4+
description = "Python library for building a STAC-compliant FastAPI application."
5+
requires-python = ">=3.9"
6+
readme = "README.md"
7+
dependencies = []
8+
9+
[tool.uv.sources]
10+
stac_fastapi_types = { workspace = true }
11+
stac_fastapi_extensions = { workspace = true }
12+
stac_fastapi_api = { workspace = true }
13+
14+
[tool.uv.workspace]
15+
members = [
16+
"stac_fastapi/*"
17+
]
18+
19+
[tool.uv]
20+
dev-dependencies = [
21+
"pytest",
22+
"pytest-cov",
23+
"pytest-asyncio",
24+
"pytest-benchmark",
25+
"pre-commit",
26+
"bump-my-version",
27+
"httpx",
28+
"requests",
29+
# These are added as dev dependencies because they should be available
30+
# when developing the project.
31+
"stac_fastapi_types",
32+
"stac_fastapi_api",
33+
"stac_fastapi_extensions",
34+
]
35+
package = false
36+
137
[tool.ruff]
238
target-version = "py39" # minimum supported version
339
line-length = 90
@@ -61,6 +97,11 @@ filename = "VERSION"
6197
search = "{current_version}"
6298
replace = "{new_version}"
6399

100+
[[tool.bumpversion.files]]
101+
filename = "stac_fastapi/pyproject.toml"
102+
search = 'version = "{current_version}"'
103+
replace = 'version = "{new_version}"'
104+
64105
[[tool.bumpversion.files]]
65106
filename = "stac_fastapi/api/stac_fastapi/api/version.py"
66107
search = '__version__ = "{current_version}"'

requirements/requirements-docs.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
black>=23.10.1
2+
mkdocs>=1.4.3
3+
mkdocs-jupyter>=0.24.5
4+
mkdocs-material[imaging]>=9.5
5+
griffe-inherited-docstrings>=1.0.0
6+
mkdocstrings[python]>=0.25.1

scripts/publish

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,8 @@ if [ "${BASH_SOURCE[0]}" = "${0}" ]; then
6060
for PACKAGE_DIR in "${SUBPACKAGE_DIRS[@]}"
6161
do
6262
echo ${PACKAGE_DIR}
63-
pushd ./${PACKAGE_DIR}
6463
rm -rf dist
65-
python setup.py sdist bdist_wheel
66-
twine upload ${TEST_PYPI} dist/*
67-
popd
68-
64+
uv build --package PACKAGE_DIR
65+
uv publish --publish-url ${TEST_PYPI}
6966
done
7067
fi

0 commit comments

Comments
 (0)