From d1349c5f456b934527e8866e4a9526ab176b2a3c Mon Sep 17 00:00:00 2001 From: Matheus-OAMK Date: Thu, 28 Aug 2025 23:06:57 +0300 Subject: [PATCH 1/3] refactor(config): Remove unecessary python-dotenv dependency - Removed python-dotenv dependency and lines utilizing it. The pydantic_settings managed the environment and should fail on missing dependencies. --- database_schema_spec/core/config.py | 6 ------ pyproject.toml | 1 - uv.lock | 4 +--- 3 files changed, 1 insertion(+), 10 deletions(-) diff --git a/database_schema_spec/core/config.py b/database_schema_spec/core/config.py index b131f4d..552bc62 100644 --- a/database_schema_spec/core/config.py +++ b/database_schema_spec/core/config.py @@ -1,9 +1,7 @@ """Configuration constants for the database schema spec generator.""" -import os from pathlib import Path -from dotenv import load_dotenv from pydantic import BaseModel, Field, ValidationError from pydantic_settings import BaseSettings @@ -70,8 +68,6 @@ def __init__(self, **data): # Enforce presence of required env variables in the process environment # before delegating to BaseSettings. This ensures tests that clear os.environ # see the expected ConfigurationError. - if "base_url" not in data and "BASE_URL" not in os.environ: - raise ConfigurationError(variable_name="BASE_URL") super().__init__(**data) except ValidationError as e: @@ -88,6 +84,4 @@ def __init__(self, **data): raise -# At application import time, populate os.environ from .env (if present), then enforce presence. -load_dotenv(override=True) config = Config() diff --git a/pyproject.toml b/pyproject.toml index 04268c8..ecdcacf 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -8,7 +8,6 @@ dependencies = [ "jsonschema>=4.25.0", "pydantic>=2.11.7", "pydantic-settings>=2.10.1", - "python-dotenv>=1.1.1", ] [dependency-groups] diff --git a/uv.lock b/uv.lock index 0b2c531..4110c67 100644 --- a/uv.lock +++ b/uv.lock @@ -1,5 +1,5 @@ version = 1 -revision = 2 +revision = 3 requires-python = ">=3.13" [[package]] @@ -99,7 +99,6 @@ dependencies = [ { name = "jsonschema" }, { name = "pydantic" }, { name = "pydantic-settings" }, - { name = "python-dotenv" }, ] [package.dev-dependencies] @@ -117,7 +116,6 @@ requires-dist = [ { name = "jsonschema", specifier = ">=4.25.0" }, { name = "pydantic", specifier = ">=2.11.7" }, { name = "pydantic-settings", specifier = ">=2.10.1" }, - { name = "python-dotenv", specifier = ">=1.1.1" }, ] [package.metadata.requires-dev] From 8da6dffbc2bf4d7a0139065b85383a2f1bbab22d Mon Sep 17 00:00:00 2001 From: Matheus-OAMK Date: Thu, 28 Aug 2025 23:11:22 +0300 Subject: [PATCH 2/3] refactor(Dockerfile): Pin UV version and simplify building stage - Refactiored the dockerfile to have a pinned version of UV for consistent builds. - Simplified dockerfile by utilizing UV's prebuilt image --- Dockerfile | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/Dockerfile b/Dockerfile index 8112059..85cab20 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,12 +1,6 @@ # Multi-stage build for database schema spec generator # Stage 1: Build the schemas -FROM alpine:3.22.1 AS builder - -# Install Python, uv, and git (needed for some dependencies) -RUN apk add --no-cache python3 py3-pip git - -# Install uv package manager -RUN pip3 install --break-system-packages uv +FROM ghcr.io/astral-sh/uv:0.8.13-alpine3.22 AS builder # Set working directory WORKDIR /app @@ -27,7 +21,7 @@ COPY .env ./ RUN uv run python main.py # Stage 2: Final lightweight image with only the output -FROM alpine:3.22.1 +FROM alpine:3.22 AS final # Create output directory RUN mkdir -p /output From 4acb74364bcf95a292aef1b456415a0a3c5c72ca Mon Sep 17 00:00:00 2001 From: Matheus-OAMK Date: Thu, 28 Aug 2025 23:25:02 +0300 Subject: [PATCH 3/3] refactor(config): Remove leftover comments --- database_schema_spec/core/config.py | 4 ---- 1 file changed, 4 deletions(-) diff --git a/database_schema_spec/core/config.py b/database_schema_spec/core/config.py index 552bc62..3978fff 100644 --- a/database_schema_spec/core/config.py +++ b/database_schema_spec/core/config.py @@ -65,10 +65,6 @@ class Config(BaseSettings): def __init__(self, **data): """Initialize config with custom error handling for missing required fields.""" try: - # Enforce presence of required env variables in the process environment - # before delegating to BaseSettings. This ensures tests that clear os.environ - # see the expected ConfigurationError. - super().__init__(**data) except ValidationError as e: # Only handle missing field errors, let other validation errors bubble up