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
78 changes: 63 additions & 15 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,21 +1,69 @@
dev : .venv
@source ./.venv/bin/activate && \
IRI_API_ADAPTER_facility=app.demo_adapter.DemoAdapter \
IRI_API_ADAPTER_status=app.demo_adapter.DemoAdapter \
IRI_API_ADAPTER_account=app.demo_adapter.DemoAdapter \
IRI_API_ADAPTER_compute=app.demo_adapter.DemoAdapter \
IRI_API_ADAPTER_filesystem=app.demo_adapter.DemoAdapter \
IRI_API_ADAPTER_task=app.demo_adapter.DemoAdapter \
OPENTELEMETRY_ENABLED=true \
API_URL_ROOT='http://127.0.0.1:8000' fastapi dev
PYTHON := python3.14
VENV := .venv
BIN := $(VENV)/bin
UV := uv
PIP := $(BIN)/pip

STAMP_VENV := $(VENV)/.created
STAMP_DEPS := $(VENV)/.deps

.venv:
@uv venv
@uv pip install -e .
.DEFAULT_GOAL := dev

$(STAMP_VENV):
$(UV) venv $(VENV)
touch $(STAMP_VENV)

.venv: $(STAMP_VENV)

$(STAMP_DEPS): $(STAMP_VENV) pyproject.toml
$(UV) pip install --python $(BIN)/python -e .
$(UV) pip install --python $(BIN)/python \
ruff \
pylint \
bandit
touch $(STAMP_DEPS)

deps: $(STAMP_DEPS)

dev: deps
@source $(BIN)/activate && \
IRI_API_ADAPTER_facility=app.demo_adapter.DemoAdapter \
IRI_API_ADAPTER_status=app.demo_adapter.DemoAdapter \
IRI_API_ADAPTER_account=app.demo_adapter.DemoAdapter \
IRI_API_ADAPTER_compute=app.demo_adapter.DemoAdapter \
IRI_API_ADAPTER_filesystem=app.demo_adapter.DemoAdapter \
IRI_API_ADAPTER_task=app.demo_adapter.DemoAdapter \
OPENTELEMETRY_ENABLED=true \
API_URL_ROOT='http://127.0.0.1:8000' fastapi dev

.PHONY: clean
clean:
@rm -rf iri_sandbox
@rm -rf .venv
rm -rf iri_sandbox
rm -rf .venv

# Format and lint
format: deps
$(BIN)/ruff format --line-length 200 .

ruff: deps
$(BIN)/ruff check . --fix || true

pylint: deps
find . -path ./$(VENV) -prune -o -type f -name "*.py" -print0 | while IFS= read -r -d '' f; do \
echo "Pylint $$f"; \
$(BIN)/pylint $$f --rcfile pylintrc || true; \
done

# Security
audit: deps
uv pip compile pyproject.toml -o requirements.txt
uv pip sync requirements.txt
uv pip install pip-audit
$(BIN)/pip-audit || true
rm -f requirements.txt

bandit: deps
$(BIN)/bandit -r app || true

# Full validation bundle
lint: clean format ruff pylint audit bandit
5 changes: 3 additions & 2 deletions app/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)
from pkgutil import extend_path

__path__ = extend_path(__path__, __name__)
7 changes: 2 additions & 5 deletions app/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,8 @@
"description": description,
"version": API_VERSION,
"docs_url": "/",
"contact": {
"name": "Facility API contact",
"url": "https://www.somefacility.gov/about/contact-us/"
},
"terms_of_service": "https://www.somefacility.gov/terms-of-service"
"contact": {"name": "Facility API contact", "url": "https://www.somefacility.gov/about/contact-us/"},
"terms_of_service": "https://www.somefacility.gov/terms-of-service",
}
try:
# optionally overload the init params
Expand Down
Loading