Skip to content

Conversation

Au2mater
Copy link

New Features & Improvements

This PR introduces environment file support for automated deployments and upgrades key dependencies for better performance and compatibility.

Environment File Support

  • New --env-file CLI parameter for automated configuration
  • Comprehensive environment variable parsing with support for:
    • SQLITE_DB_PATH - SQLite database path
    • POSTGRES_HOST/PG_HOST - PostgreSQL host
    • POSTGRES_PORT/PG_PORT - PostgreSQL port
    • POSTGRES_DB/PG_DATABASE - Database name
    • POSTGRES_USER/PG_USER - Username
    • POSTGRES_PASSWORD/PG_PASSWORD - Password
  • Flexible variable naming supporting both POSTGRES_* and PG_* prefixes
  • Automatic validation of paths and database connections from environment
  • Error handling with clear feedback for malformed or missing files

Technical Improvements

Dependency Upgrades:

  • Upgraded psycopg2-binarypsycopg2 2.9.10 (better performance, reduced binary size)
  • Upgraded rich → 14.0.0 (latest features and bug fixes)

Code Enhancements:

  • New load_env_file() function for parsing environment files
  • New get_config_from_env() function for extracting configuration
  • Enhanced get_sqlite_config() and get_pg_config() to accept environment parameters
  • Improved argument parsing with detailed help text and examples

Au2mater and others added 3 commits June 14, 2025 00:47
refactor: updgrade to psycopg2 and rich v14

Co-authored-by: Ahmad Balkiss <[email protected]>
@taylorwilsdon taylorwilsdon self-assigned this Jul 12, 2025
@taylorwilsdon taylorwilsdon added the enhancement New feature or request label Jul 12, 2025
@taylorwilsdon
Copy link
Owner

Love the idea, will get this pulled in

Copilot

This comment was marked as outdated.

Co-authored-by: Copilot <[email protected]>
@taylorwilsdon taylorwilsdon requested a review from Copilot July 12, 2025 17:11
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds support for loading configuration from an environment file and updates key dependencies for better performance.

  • Introduces a --env-file CLI option with load_env_file() and get_config_from_env()
  • Refactors database setup functions to accept environment parameters
  • Switches from psycopg to psycopg2 and updates README with env-file usage

Reviewed Changes

Copilot reviewed 2 out of 3 changed files in this pull request and generated 1 comment.

File Description
migrate.py Added load_env_file, get_config_from_env, updated migrate signature to accept env inputs, and swapped psycopgpsycopg2
README.md Documented environment-file mode in features list and configuration section, plus CLI examples
Comments suppressed due to low confidence (3)

README.md:14

  • Replace the placeholder '�' with the intended emoji (for example, 🆕 or 📂) or remove it to correct the feature bullet.
- � **Environment file support for automated deployments**

README.md:105

  • [nitpick] The code also supports POSTGRES_DATABASE as an alternative for the database name in get_config_from_env. Consider adding it here for completeness.
- `PG_HOST`, `PG_PORT`, `PG_DATABASE`, `PG_USER`, `PG_PASSWORD`

migrate.py:605

  • Add unit tests for load_env_file and get_config_from_env to cover valid parsing, skipping malformed lines, missing files, and connection validation.
def load_env_file(env_file_path: Path) -> Dict[str, str]:

Co-authored-by: Copilot <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants