Skip to content

Commit 41e20c3

Browse files
committed
Scaffold Docverse server and client packages
Restructure the repository from the legacy LTD Keeper Flask application to the new Docverse platform built on FastAPI and Safir. This establishes the foundational project layout: - Add server package (src/docverse/) with FastAPI app, config, and health check endpoints - Add client package (client/src/docverse/client/) as a separate distributable library - Switch tooling to uv, nox, ruff, and pre-commit - Rewrite CI workflow with lint, test, client-test, build, and client-publish jobs - Modernize Dockerfile with uv-based builds and Python 3.13 - Replace old docs, changelog, and license files with new Markdown equivalents and scriv changelog management - Update pyproject.toml for namespace package layout with setuptools_scm versioning
1 parent 93f9461 commit 41e20c3

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+2666
-4997
lines changed

.dockerignore

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,36 @@
1+
# Python artifacts
12
**/*.pyc
23
**/*.pyd
34
**/*.pyo
45
**/__pycache__
5-
/__pycache__
6+
*.egg-info/
67
*.sqlite
8+
9+
# Development and CI directories
10+
.claude/
11+
.github/
12+
.mypy_cache/
13+
.nox/
14+
.pytest_cache/
15+
.ruff_cache/
16+
.venv/
17+
.coverage*
18+
htmlcov/
19+
20+
# Legacy code
21+
keeper/
22+
23+
# Tests
24+
tests/
25+
client/tests/
26+
27+
# Development config files
28+
.pre-commit-config.yaml
29+
.python-version
30+
noxfile.py
31+
ruff-shared.toml
32+
scriv-client.ini
33+
scriv-server.ini
34+
server-changelog.d/
35+
client/changelog.d/
36+
Makefile

.github/dependabot.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ updates:
55
schedule:
66
interval: "weekly"
77

8-
- package-ecosystem: "docker"
8+
- package-ecosystem: "pip"
99
directory: "/"
1010
schedule:
1111
interval: "weekly"

.github/workflows/ci.yaml

Lines changed: 100 additions & 103 deletions
Original file line numberDiff line numberDiff line change
@@ -1,165 +1,162 @@
11
name: CI
22

3-
'on':
3+
"on":
4+
merge_group: {}
5+
pull_request: {}
46
push:
57
branches-ignore:
6-
# These should always correspond to pull requests, so ignore them for
7-
# the push trigger and let them be triggered by the pull_request
8-
# trigger, avoiding running the workflow twice. This is a minor
9-
# optimization so there's no need to ensure this is comprehensive.
10-
- 'dependabot/**'
11-
- 'renovate/**'
12-
- 'tickets/**'
13-
- 'u/**'
8+
- "dependabot/**"
9+
- "renovate/**"
10+
- "u/**"
1411
tags:
15-
- '*'
16-
pull_request: {}
12+
- "[0-9]*"
13+
- "client/[0-9]*"
1714

1815
jobs:
1916
lint:
2017
runs-on: ubuntu-latest
18+
timeout-minutes: 10
2119

2220
steps:
23-
- uses: actions/checkout@v3
21+
- uses: actions/checkout@v4
2422

2523
- name: Set up Python
26-
uses: actions/setup-python@v4
24+
uses: actions/setup-python@v5
2725
with:
28-
python-version: "3.10"
26+
python-version-file: ".python-version"
2927

30-
- name: Run pre-commit
31-
uses: pre-commit/action@v3.0.0
28+
- name: Install uv
29+
uses: astral-sh/setup-uv@v5
30+
31+
- name: Run linters
32+
run: uv run --only-group=lint pre-commit run --all-files
3233

3334
test:
3435
runs-on: ubuntu-latest
35-
needs: [lint]
36-
37-
strategy:
38-
matrix:
39-
python:
40-
- "3.10"
41-
db:
42-
- sqlite
43-
- postgres
44-
# - mysql
36+
timeout-minutes: 10
4537

4638
steps:
47-
- uses: actions/checkout@v3
48-
49-
- name: Install build tools
50-
run: sudo apt-get install build-essential
39+
- uses: actions/checkout@v4
40+
with:
41+
fetch-depth: 0
5142

5243
- name: Set up Python
53-
uses: actions/setup-python@v4
44+
uses: actions/setup-python@v5
5445
with:
55-
python-version: ${{ matrix.python }}
46+
python-version-file: ".python-version"
5647

57-
- name: Install tox
58-
run: |
59-
pip install 'requests<2.32.0'
60-
pip install tox
61-
pip install --pre tox-docker
48+
- name: Install uv
49+
uses: astral-sh/setup-uv@v5
6250

63-
- name: Cache tox environments
64-
id: cache-tox
65-
uses: actions/cache@v3
66-
with:
67-
path: .tox
68-
# requirements/*.txt and pyproject.toml have versioning info
69-
# that would impact the tox environment.
70-
key: tox-${{ matrix.python }}--${{ matrix.db }}-${{ hashFiles('requirements/*.txt') }}-${{ hashFiles('pyproject.toml') }}
71-
restore-keys: |
72-
tox-${{ matrix.python }}-${{ matrix.db }}-${{ hashFiles('requirements/*.txt') }}-
73-
74-
- name: Run tox with external services
75-
if: ${{ matrix.python == '3.10' && matrix.db == 'postgres' }}
76-
env:
77-
LTD_KEEPER_TEST_AWS_ID: ${{ secrets.LTD_KEEPER_TEST_AWS_ID }}
78-
LTD_KEEPER_TEST_AWS_SECRET: ${{ secrets.LTD_KEEPER_TEST_AWS_SECRET }}
79-
LTD_KEEPER_TEST_BUCKET: ${{ secrets.LTD_KEEPER_TEST_BUCKET }}
80-
# run: tox -e typing,${{matrix.db}},coverage-report # run tox using Python in path
81-
run: tox -e ${{matrix.db}},coverage-report # run tox using Python in path
82-
83-
- name: Run tox without external services
84-
if: ${{ !(matrix.python != '3.10' && matrix.db != 'postgres') }}
85-
# run: tox -e typing,${{matrix.db}},coverage-report # run tox using Python in path
86-
run: tox -e ${{matrix.db}},coverage-report # run tox using Python in path
87-
88-
docs:
51+
- name: Run typing
52+
run: uv run --only-group=nox nox -s typing
53+
54+
- name: Run tests
55+
run: uv run --only-group=nox nox -s test
56+
57+
client-test:
8958
runs-on: ubuntu-latest
90-
needs: [lint]
59+
timeout-minutes: 10
9160

9261
steps:
93-
- uses: actions/checkout@v3
62+
- uses: actions/checkout@v4
9463
with:
9564
fetch-depth: 0
9665

9766
- name: Set up Python
98-
uses: actions/setup-python@v4
67+
uses: actions/setup-python@v5
9968
with:
100-
python-version: "3.10"
69+
python-version: |
70+
3.12
71+
3.13
10172
102-
- name: Install Python dependencies
103-
run: pip install tox ltd-conveyor
73+
- name: Install uv
74+
uses: astral-sh/setup-uv@v5
10475

105-
- name: Cache tox environment for docs
106-
id: cache-tox
107-
uses: actions/cache@v3
108-
with:
109-
path: .tox
110-
# requirements/*.txt, pyproject.toml, and .pre-commit-config.yaml
111-
# have versioning info that would impact the tox environment.
112-
key: tox-docs-${{ hashFiles('requirements/*.txt') }}-${{ hashFiles('pyproject.toml') }}-${{ hashFiles('.pre-commit-config.yaml') }}
113-
114-
- name: Run tox
115-
run: tox -e docs
116-
117-
- name: Upload documentation
118-
if: ${{ github.event_name == 'push' }}
119-
env:
120-
LTD_PASSWORD: ${{ secrets.LTD_PASSWORD }}
121-
LTD_USERNAME: ${{ secrets.LTD_USERNAME }}
122-
run: |
123-
ltd upload --gh --dir docs/_build/html --product ltd-keeper
76+
- name: Run client tests
77+
run: >-
78+
uv run --only-group=nox nox -s
79+
client_test
80+
client_test_compat
81+
client_test_oldest
12482
12583
build:
12684
runs-on: ubuntu-latest
127-
needs: [test]
85+
needs: [test, client-test]
86+
timeout-minutes: 15
12887

129-
# Only do Docker builds of ticket branches and tagged releases, as well
130-
# as J.Sick Codes branches.
131-
# if: >
132-
# (startsWith(github.ref, 'refs/tags/') || startsWith(github.ref, 'refs/heads/tickets/')) || startsWith(github.ref, 'refs/heads/u/jsickcodes/')
88+
# Build on server tags and ticket branch PRs (exclude client tags)
89+
if: >
90+
(startsWith(github.ref, 'refs/tags/')
91+
&& !startsWith(github.ref, 'refs/tags/client/'))
92+
|| github.event_name == 'pull_request'
13393
13494
steps:
135-
- uses: actions/checkout@v3
95+
- uses: actions/checkout@v4
13696
with:
13797
fetch-depth: 0
13898

13999
- name: Define the Docker tag
140100
id: vars
141-
run: echo ::set-output name=tag::$(bin/docker-tag.sh)
142-
143-
- name: Print the tag
144-
id: print
145-
run: echo ${{ steps.vars.outputs.tag }}
101+
run: |
102+
if [[ "$GITHUB_REF" == refs/tags/* ]]; then
103+
echo "tag=${GITHUB_REF#refs/tags/}" >> "$GITHUB_OUTPUT"
104+
elif [[ "$GITHUB_HEAD_REF" != "" ]]; then
105+
echo "tag=${GITHUB_HEAD_REF}" >> "$GITHUB_OUTPUT"
106+
else
107+
echo "tag=${GITHUB_REF#refs/heads/}" >> "$GITHUB_OUTPUT"
108+
fi
146109
147110
- name: Set up Docker Buildx
148-
uses: docker/setup-buildx-action@v2
111+
uses: docker/setup-buildx-action@v3
149112

150113
- name: Log in to GitHub Container Registry
151-
uses: docker/login-action@v2
114+
uses: docker/login-action@v3
152115
with:
153116
registry: ghcr.io
154117
username: ${{ github.repository_owner }}
155118
password: ${{ secrets.GITHUB_TOKEN }}
156119

157120
- name: Build and push
158-
uses: docker/build-push-action@v3
121+
uses: docker/build-push-action@v6
159122
with:
160123
context: .
161124
push: true
162125
tags: |
163-
ghcr.io/lsst-sqre/ltd-keeper:${{ steps.vars.outputs.tag }}
126+
ghcr.io/lsst-sqre/docverse:${{ steps.vars.outputs.tag }}
164127
cache-from: type=gha
165128
cache-to: type=gha,mode=max
129+
130+
client-publish:
131+
runs-on: ubuntu-latest
132+
needs: [test, client-test]
133+
timeout-minutes: 10
134+
135+
if: startsWith(github.ref, 'refs/tags/client/')
136+
137+
environment: pypi
138+
139+
permissions:
140+
id-token: write
141+
142+
steps:
143+
- uses: actions/checkout@v4
144+
with:
145+
fetch-depth: 0
146+
147+
- name: Set up Python
148+
uses: actions/setup-python@v5
149+
with:
150+
python-version-file: ".python-version"
151+
152+
- name: Install uv
153+
uses: astral-sh/setup-uv@v5
154+
155+
- name: Build client package
156+
working-directory: client
157+
run: uv build
158+
159+
- name: Publish to PyPI
160+
uses: pypa/gh-action-pypi-publish@release/v1
161+
with:
162+
packages-dir: client/dist/

0 commit comments

Comments
 (0)