Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ updates:
- package-ecosystem: "uv" # See documentation for possible values
directories:
- "/"
- "/src" # Location of package manifests
schedule:
interval: "weekly"
groups:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/deploy_site.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,15 @@ jobs:
run: |
python -m pip install --upgrade pip
python -m pip install uv
uv sync --project=src --no-dev
uv sync --no-dev

- name: Setup Pages
uses: actions/configure-pages@v5

- name: Build Site
run: |
export PYTHONPATH=src:$PYTHONPATH
uv run --project=src mkdocs build --clean --config-file mkdocs.yml
uv run mkdocs build --clean --config-file mkdocs.yml

- name: Upload artifact
uses: actions/upload-pages-artifact@v4
Expand Down
9 changes: 4 additions & 5 deletions .github/workflows/link_checker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ on:
# run on any PR that changes this workflow
- .github/workflows/linkchecker.yml
# run on any PR that changes the pip requirements
- requirements.txt
- src/pyproject.toml
- pyproject.toml
# let us trigger it manually
workflow_dispatch:

Expand All @@ -31,13 +30,13 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip uv
uv sync --dev --project=src
uv sync --dev

- name: Build Site
run: |
uv run --project=src mkdocs build --verbose --clean --config-file mkdocs.yml
uv run mkdocs build --verbose --clean --config-file mkdocs.yml

- name: Check links
run: |
uv run --project=src linkchecker site/index.html
uv run linkchecker site/index.html

6 changes: 3 additions & 3 deletions .github/workflows/python-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,14 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip uv
uv sync --project=src --dev --frozen
uv sync --dev --frozen
# - uses: psf/black@stable
- name: Test with pytest
run: |
uv run --project=src pytest
uv run pytest
- name: Build
run: |
uv build --project=src
uv build
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
Expand Down
9 changes: 4 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
# Project-specific vars
MKDOCS_PORT=8765
DOCKER_DIR=docker
PROJECT_DIR = ./src
DOCKER_COMPOSE=docker-compose --project-directory $(DOCKER_DIR)
UV_RUN=uv run --project $(PROJECT_DIR)
UV_RUN=uv run

# Targets
.PHONY: all test docs api docker_test clean help mdlint_fix up down regenerate_json
Expand All @@ -13,15 +12,15 @@ all: help

dev:
@echo "Set up dev environment..."
uv sync --dev --project $(PROJECT_DIR)
uv sync --dev

mdlint_fix:
@echo "Running markdownlint..."
markdownlint --config .markdownlint.yml --fix .

test:
@echo "Running tests locally..."
uv run --project $(PROJECT_DIR) pytest -v
$(UV_RUN) pytest -v

docker_test:
@echo "Building the latest test image..."
Expand Down Expand Up @@ -60,7 +59,7 @@ regenerate_json:
clean:
@echo "Cleaning up Docker resources..."
$(DOCKER_COMPOSE) down --rmi local || true
rm -rf $(PROJECT_DIR)/.venv $(PROJECT_DIR)/uv.lock

help:
@echo "Usage: make [target]"
@echo ""
Expand Down
23 changes: 7 additions & 16 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,35 +3,26 @@ RUN apt-get update && apt-get install -y --no-install-recommends git && rm -rf /
RUN pip install --upgrade pip uv
WORKDIR /app

ENV VIRTUAL_ENV=/app/.venv
ENV PATH="${VIRTUAL_ENV}/bin:${PATH}"

RUN python -m venv "${VIRTUAL_ENV}"
FROM base AS dependencies

ARG BASE_DIR=..
ARG SRC_DIR=${BASE_DIR}/src

# Copy the files we need
COPY ${BASE_DIR}/ /app
COPY . /app
# Set the environment variable
ENV PYTHONPATH=/app/src
COPY ${SRC_DIR}/pyproject.toml /app/src/pyproject.toml
COPY ${SRC_DIR}/uv.lock /app/src/uv.lock

# install requirements
RUN uv sync --project=/app/src --frozen

RUN uv sync --frozen

FROM dependencies AS test

ENV PYTHONPATH=/app/src
# Install pytest and dev dependencies
RUN uv sync --project=/app/src --frozen --dev
RUN uv sync --frozen --dev
# Run the unit tests
CMD ["uv", "run", "--project=/app/src", "pytest"]
CMD ["uv", "run", "pytest"]

FROM dependencies AS docs
CMD ["uv", "run", "--project=/app/src", "mkdocs", "serve", "--dev-addr", "0.0.0.0:8000"]
CMD ["uv", "run", "mkdocs", "serve", "--dev-addr", "0.0.0.0:8000"]

FROM dependencies AS registry_api
CMD ["uv", "run", "--project=/app/src", "uvicorn", "ssvc.api.main:app", "--host", "0.0.0.0", "--port", "8000"]
CMD ["uv", "run", "uvicorn", "ssvc.api.main:app", "--host", "0.0.0.0", "--port", "8000"]
3 changes: 3 additions & 0 deletions docker/env_example
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# copy or link this file to .env in this directory
# this helps avoid docker image/container naming collisions
COMPOSE_PROJECT_NAME=ssvc
7 changes: 4 additions & 3 deletions src/pyproject.toml → pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ exclude = ["test*"] # exclude packages matching these glob patterns (empty by d
#namespaces = false # to disable scanning PEP 420 namespaces (true by default)

[tool.setuptools_scm]
version_file = "ssvc/_version.py"
root = ".."
version_file = "./src/ssvc/_version.py"
root = "."
local_scheme = "no-local-version"
version_scheme = "no-guess-dev"

Expand All @@ -77,7 +77,7 @@ version_scheme = "no-guess-dev"

[tool.black]
line-length = 79
target-version = ['py38', 'py39', 'py310', 'py311']
target-version = ['py38', 'py39', 'py310', 'py311', 'py312', 'py313']

[tool.pytest.ini_options]
minversion = "6.0"
Expand All @@ -88,6 +88,7 @@ testpaths = [

[dependency-groups]
dev = [
"black>=25.9.0",
"linkchecker>=10.6.0",
"pytest>=8.4.1",
]
Loading
Loading