Loading .env.example 0 → 100644 +22 −0 Changes for .env.example: 22 added lines, 0 removed lines. Original line number Diff line number Diff line # Copy this file to .env and adjust as needed. Every value below is optional # -- open_exposure_gateway/app/core/config.py already has a working default # for each one, shown here. Uncomment and edit only what you need to change. # APP_NAME="Open Exposure Gateway" # APP_VERSION="1.0.0" # DEBUG=false # HOST="0.0.0.0" # PORT=8080 # SRM_SETTINGS__BASE_URL="http://localhost:8081" # SRM_SETTINGS__TIMEOUT=10.0 # POSTGRESQL_SETTINGS__URL="postgresql+asyncpg://postgres:postgres@localhost:5432/oeg" # POSTGRESQL_SETTINGS__ECHO=false # POSTGRESQL_SETTINGS__CREATE_SCHEMA_ON_STARTUP=false # NATS_SETTINGS__URL="nats://localhost:4222" # NATS_SETTINGS__CONNECT_TIMEOUT=10 # NATS_SETTINGS__MAX_RECONNECT_ATTEMPTS=3 # OBSERVABILITY_SETTINGS__LOG_LEVEL="INFO" .gitignore +4 −1 Changes for .gitignore: 4 added lines, 1 removed line. Original line number Diff line number Diff line Loading @@ -15,6 +15,10 @@ wheels/ # code editors .vscode/ # AI software tools .claude CLAUDE.md .tox/ htmlcov/ .mypy_cache/ Loading @@ -24,4 +28,3 @@ htmlcov/ .coverage .python_version coverage.xml uv.lock .gitlab-ci.yml +76 −24 Changes for .gitlab-ci.yml: 76 added lines, 24 removed lines. Original line number Diff line number Diff line default: image: python:3.12-slim cache: paths: - .cache/uv before_script: - . "$CI_PROJECT_DIR/scripts/ci/setup-proxy.sh" - . "$CI_PROJECT_DIR/scripts/ci/setup-extra-ca.sh" - cd "$CI_PROJECT_DIR/${BACKEND_DIR:-.}" - pip install uv - export UV_SYSTEM_CERTS=1 - uv sync --locked --extra dev - . .venv/bin/activate stages: - type - architecture - lint - format - test - build - push before_script: - docker info variables: UV_CACHE_DIR: "$CI_PROJECT_DIR/.cache/uv" type: stage: type script: - mypy open_exposure_gateway/app/ open_exposure_gateway/test/ architecture: stage: architecture script: - lint-imports lint: stage: lint script: - ruff check open_exposure_gateway/ format: stage: format script: - ruff format --check open_exposure_gateway/ test: stage: test # TODO: add integration tests when we move this to ETSI gitlab # Scoped to test/unit explicitly (not just -m deselection): pytest must still # import every collected module to read its markers, and test/conformance's # module-level schemathesis schema loading is expensive — collecting it here # would cost minutes on every pipeline even though none of its tests run. script: - pytest open_exposure_gateway/test/unit || [ $? -eq 5 ] #bypass no tests found error. conformance: stage: test allow_failure: true script: - pytest open_exposure_gateway/test/conformance build: stage: build tags: - shell script: - docker build -t $CI_REGISTRY_IMAGE:$CI_COMMIT_TAG -t $CI_REGISTRY_IMAGE:latest . rules: - if: $CI_COMMIT_TAG =~ /^\d+\.\d+\.\d+$/ push: stage: push tags: - shell needs: - build image: docker:29.3.0 services: - docker:29.3.0-dind before_script: - . "$CI_PROJECT_DIR/scripts/ci/setup-proxy.sh" - . "$CI_PROJECT_DIR/scripts/ci/setup-extra-ca.sh" - cd "$CI_PROJECT_DIR/${BACKEND_DIR:-.}" script: - echo "$CI_REGISTRY_PASSWORD" | docker login -u "$CI_REGISTRY_USER" $CI_REGISTRY --password-stdin - docker push $CI_REGISTRY_IMAGE:$CI_COMMIT_TAG - docker push $CI_REGISTRY_IMAGE:latest - docker logout $CI_REGISTRY rules: - if: $CI_COMMIT_TAG =~ /^\d+\.\d+\.\d+$/ No newline at end of file - docker build -t $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA . - | docker tag "$CI_REGISTRY_IMAGE:$CI_COMMIT_SHORT_SHA" "$CI_REGISTRY_IMAGE:latest" docker push "$CI_REGISTRY_IMAGE:latest" - | if [ -n "$CI_COMMIT_TAG" ]; then docker tag "$CI_REGISTRY_IMAGE:$CI_COMMIT_SHORT_SHA" "$CI_REGISTRY_IMAGE:$CI_COMMIT_TAG" docker push "$CI_REGISTRY_IMAGE:$CI_COMMIT_TAG" fi only: - main .pre-commit-config.yaml 0 → 100644 +28 −0 Changes for .pre-commit-config.yaml: 28 added lines, 0 removed lines. Original line number Diff line number Diff line repos: - repo: https://github.com/pre-commit/pre-commit-hooks rev: v6.0.0 hooks: - id: check-yaml - id: check-toml - id: end-of-file-fixer - id: trailing-whitespace args: [--markdown-linebreak-ext=md] - repo: https://github.com/astral-sh/ruff-pre-commit # Ruff version. rev: v0.15.6 hooks: # Run the linter. - id: ruff-check args: ["--cache-dir", "open_exposure_gateway/.cache/ruff"] # Run the formatter. - id: ruff-format args: ["--cache-dir", "open_exposure_gateway/.cache/ruff"] - repo: https://github.com/pre-commit/mirrors-mypy rev: v1.19.1 # Use the sha / tag you want to point at hooks: - id: mypy files: ^open_exposure_gateway/app/|^open_exposure_gateway/test/ args: [--strict, --ignore-missing-imports, --cache-dir, open_exposure_gateway/.cache/mypy] additional_dependencies: ["fastapi[standard]>=0.135.1", "pydantic>=2.0", "pydantic-settings>=2.0", "httpx>=0.27", "pytest>=9.0.2", "sqlalchemy>=2.0.48", "pytest-asyncio>=0.24", "testcontainers>=4.0.0"] #TODO, always add necessary Makefile +23 −17 Changes for Makefile: 23 added lines, 17 removed lines. Original line number Diff line number Diff line .PHONY: install clean lint format precommit type test run .PHONY: install clean lint format precommit type test conformance run PYTHON := python3.12 PIP := .venv/bin/pip SRC := open_exposure_gateway/app TEST := open_exposure_gateway/test DB ?= base DEV ?= false # Trust the OS certificate store (uv doesn't by default, unlike pip) so # installs work behind corporate TLS-inspecting proxies. export UV_SYSTEM_CERTS := 1 ## Database Package Handling ifeq ($(DB),postgres) EXTRA := postgre EXTRA := postgres else ifeq ($(DB),mongo) EXTRA := mongo else Loading @@ -19,26 +21,26 @@ endif ## Dev tools Packages Handling ifeq ($(DEV),true) ifneq ($(EXTRA),) EXTRAS := $(EXTRA),dev EXTRAS := --extra $(EXTRA) --extra dev else EXTRAS := dev EXTRAS := --extra dev endif else EXTRAS := $(EXTRA) endif ## Pip install command ifeq ($(EXTRAS),) PIP_INSTALL = $(PIP) install -e . ifneq ($(EXTRA),) EXTRAS := --extra $(EXTRA) else PIP_INSTALL = $(PIP) install -e .[$(EXTRAS)] EXTRAS := endif endif ## Uv sync command # --locked fails fast if uv.lock is out of sync with pyproject.toml, instead of # silently re-resolving, so local dev and CI always install the same versions. UV_SYNC = uv sync --locked $(EXTRAS) ## Make Commands install: $(PYTHON) -m venv .venv $(PIP) install --upgrade pip setuptools wheel $(PIP_INSTALL) $(UV_SYNC) clean: rm -rf .venv Loading Loading @@ -67,7 +69,11 @@ type: test: make install DEV=true .venv/bin/pytest .venv/bin/pytest $(TEST)/unit $(TEST)/integration -m "not conformance" conformance: make install DEV=true .venv/bin/pytest $(TEST)/conformance run: make install Loading Loading
.env.example 0 → 100644 +22 −0 Changes for .env.example: 22 added lines, 0 removed lines. Original line number Diff line number Diff line # Copy this file to .env and adjust as needed. Every value below is optional # -- open_exposure_gateway/app/core/config.py already has a working default # for each one, shown here. Uncomment and edit only what you need to change. # APP_NAME="Open Exposure Gateway" # APP_VERSION="1.0.0" # DEBUG=false # HOST="0.0.0.0" # PORT=8080 # SRM_SETTINGS__BASE_URL="http://localhost:8081" # SRM_SETTINGS__TIMEOUT=10.0 # POSTGRESQL_SETTINGS__URL="postgresql+asyncpg://postgres:postgres@localhost:5432/oeg" # POSTGRESQL_SETTINGS__ECHO=false # POSTGRESQL_SETTINGS__CREATE_SCHEMA_ON_STARTUP=false # NATS_SETTINGS__URL="nats://localhost:4222" # NATS_SETTINGS__CONNECT_TIMEOUT=10 # NATS_SETTINGS__MAX_RECONNECT_ATTEMPTS=3 # OBSERVABILITY_SETTINGS__LOG_LEVEL="INFO"
.gitignore +4 −1 Changes for .gitignore: 4 added lines, 1 removed line. Original line number Diff line number Diff line Loading @@ -15,6 +15,10 @@ wheels/ # code editors .vscode/ # AI software tools .claude CLAUDE.md .tox/ htmlcov/ .mypy_cache/ Loading @@ -24,4 +28,3 @@ htmlcov/ .coverage .python_version coverage.xml uv.lock
.gitlab-ci.yml +76 −24 Changes for .gitlab-ci.yml: 76 added lines, 24 removed lines. Original line number Diff line number Diff line default: image: python:3.12-slim cache: paths: - .cache/uv before_script: - . "$CI_PROJECT_DIR/scripts/ci/setup-proxy.sh" - . "$CI_PROJECT_DIR/scripts/ci/setup-extra-ca.sh" - cd "$CI_PROJECT_DIR/${BACKEND_DIR:-.}" - pip install uv - export UV_SYSTEM_CERTS=1 - uv sync --locked --extra dev - . .venv/bin/activate stages: - type - architecture - lint - format - test - build - push before_script: - docker info variables: UV_CACHE_DIR: "$CI_PROJECT_DIR/.cache/uv" type: stage: type script: - mypy open_exposure_gateway/app/ open_exposure_gateway/test/ architecture: stage: architecture script: - lint-imports lint: stage: lint script: - ruff check open_exposure_gateway/ format: stage: format script: - ruff format --check open_exposure_gateway/ test: stage: test # TODO: add integration tests when we move this to ETSI gitlab # Scoped to test/unit explicitly (not just -m deselection): pytest must still # import every collected module to read its markers, and test/conformance's # module-level schemathesis schema loading is expensive — collecting it here # would cost minutes on every pipeline even though none of its tests run. script: - pytest open_exposure_gateway/test/unit || [ $? -eq 5 ] #bypass no tests found error. conformance: stage: test allow_failure: true script: - pytest open_exposure_gateway/test/conformance build: stage: build tags: - shell script: - docker build -t $CI_REGISTRY_IMAGE:$CI_COMMIT_TAG -t $CI_REGISTRY_IMAGE:latest . rules: - if: $CI_COMMIT_TAG =~ /^\d+\.\d+\.\d+$/ push: stage: push tags: - shell needs: - build image: docker:29.3.0 services: - docker:29.3.0-dind before_script: - . "$CI_PROJECT_DIR/scripts/ci/setup-proxy.sh" - . "$CI_PROJECT_DIR/scripts/ci/setup-extra-ca.sh" - cd "$CI_PROJECT_DIR/${BACKEND_DIR:-.}" script: - echo "$CI_REGISTRY_PASSWORD" | docker login -u "$CI_REGISTRY_USER" $CI_REGISTRY --password-stdin - docker push $CI_REGISTRY_IMAGE:$CI_COMMIT_TAG - docker push $CI_REGISTRY_IMAGE:latest - docker logout $CI_REGISTRY rules: - if: $CI_COMMIT_TAG =~ /^\d+\.\d+\.\d+$/ No newline at end of file - docker build -t $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA . - | docker tag "$CI_REGISTRY_IMAGE:$CI_COMMIT_SHORT_SHA" "$CI_REGISTRY_IMAGE:latest" docker push "$CI_REGISTRY_IMAGE:latest" - | if [ -n "$CI_COMMIT_TAG" ]; then docker tag "$CI_REGISTRY_IMAGE:$CI_COMMIT_SHORT_SHA" "$CI_REGISTRY_IMAGE:$CI_COMMIT_TAG" docker push "$CI_REGISTRY_IMAGE:$CI_COMMIT_TAG" fi only: - main
.pre-commit-config.yaml 0 → 100644 +28 −0 Changes for .pre-commit-config.yaml: 28 added lines, 0 removed lines. Original line number Diff line number Diff line repos: - repo: https://github.com/pre-commit/pre-commit-hooks rev: v6.0.0 hooks: - id: check-yaml - id: check-toml - id: end-of-file-fixer - id: trailing-whitespace args: [--markdown-linebreak-ext=md] - repo: https://github.com/astral-sh/ruff-pre-commit # Ruff version. rev: v0.15.6 hooks: # Run the linter. - id: ruff-check args: ["--cache-dir", "open_exposure_gateway/.cache/ruff"] # Run the formatter. - id: ruff-format args: ["--cache-dir", "open_exposure_gateway/.cache/ruff"] - repo: https://github.com/pre-commit/mirrors-mypy rev: v1.19.1 # Use the sha / tag you want to point at hooks: - id: mypy files: ^open_exposure_gateway/app/|^open_exposure_gateway/test/ args: [--strict, --ignore-missing-imports, --cache-dir, open_exposure_gateway/.cache/mypy] additional_dependencies: ["fastapi[standard]>=0.135.1", "pydantic>=2.0", "pydantic-settings>=2.0", "httpx>=0.27", "pytest>=9.0.2", "sqlalchemy>=2.0.48", "pytest-asyncio>=0.24", "testcontainers>=4.0.0"] #TODO, always add necessary
Makefile +23 −17 Changes for Makefile: 23 added lines, 17 removed lines. Original line number Diff line number Diff line .PHONY: install clean lint format precommit type test run .PHONY: install clean lint format precommit type test conformance run PYTHON := python3.12 PIP := .venv/bin/pip SRC := open_exposure_gateway/app TEST := open_exposure_gateway/test DB ?= base DEV ?= false # Trust the OS certificate store (uv doesn't by default, unlike pip) so # installs work behind corporate TLS-inspecting proxies. export UV_SYSTEM_CERTS := 1 ## Database Package Handling ifeq ($(DB),postgres) EXTRA := postgre EXTRA := postgres else ifeq ($(DB),mongo) EXTRA := mongo else Loading @@ -19,26 +21,26 @@ endif ## Dev tools Packages Handling ifeq ($(DEV),true) ifneq ($(EXTRA),) EXTRAS := $(EXTRA),dev EXTRAS := --extra $(EXTRA) --extra dev else EXTRAS := dev EXTRAS := --extra dev endif else EXTRAS := $(EXTRA) endif ## Pip install command ifeq ($(EXTRAS),) PIP_INSTALL = $(PIP) install -e . ifneq ($(EXTRA),) EXTRAS := --extra $(EXTRA) else PIP_INSTALL = $(PIP) install -e .[$(EXTRAS)] EXTRAS := endif endif ## Uv sync command # --locked fails fast if uv.lock is out of sync with pyproject.toml, instead of # silently re-resolving, so local dev and CI always install the same versions. UV_SYNC = uv sync --locked $(EXTRAS) ## Make Commands install: $(PYTHON) -m venv .venv $(PIP) install --upgrade pip setuptools wheel $(PIP_INSTALL) $(UV_SYNC) clean: rm -rf .venv Loading Loading @@ -67,7 +69,11 @@ type: test: make install DEV=true .venv/bin/pytest .venv/bin/pytest $(TEST)/unit $(TEST)/integration -m "not conformance" conformance: make install DEV=true .venv/bin/pytest $(TEST)/conformance run: make install Loading