Dependency Management
Relevant source files
The following files were used as context for generating this wiki page:
Dependency management in the cron-ext project is handled primarily through Poetry, a tool for dependency management and packaging in Python. The project maintains a strict separation between core requirements necessary for execution and development-specific tools used for testing, linting, and formatting.
The architecture ensures that the utility remains lightweight by leveraging tools like pre-commit to isolate linter environments, thereby avoiding version conflicts in the primary virtual environment.
Sources: pyproject.toml:1-30, CONTRIBUTING.md:31-41
Dependency Architecture and Tooling
The project utilizes pyproject.toml as the single source of truth for its build system and dependency specifications. It adheres to the PEP 517 standard using poetry-core as the build backend.
Core Dependencies
The runtime environment requires specific libraries to facilitate CLI interactions and extension development within the Meltano ecosystem.
| Package | Version Constraint | Purpose |
|---|---|---|
python | >=3.9 | Minimum supported Python version. |
typer | ^0.15.3 | CLI building library. |
typing-extensions | ^4.14 | Backported type hints for compatibility. |
meltano-edk | ~=0.5.0 | Meltano Extension Development Kit for building utility extensions. |
Sources: pyproject.toml:13-17, pyproject.toml:43-45
Development and Test Dependencies
Development dependencies are categorized to support testing frameworks and the Meltano environment itself.
- Meltano: Included as a dev-dependency (
>=3.5) to allow local integration testing. - Pytest: The primary testing framework, supported by
pytest-runnerfor CLI testing. - Coverage: Used to measure code coverage during the test suite execution.
Sources: pyproject.toml:19-24
Development Workflow and Environment Isolation
The project employs multiple strategies to ensure environment stability and consistency across different development setups.
Environment Management Flow
The following diagram illustrates how dependencies are managed during development and testing phases:
The project uses pre-commit to install and run linters within their own virtual environments, which keeps the main dev-dependencies light and maximizes compatibility range.
Sources: CONTRIBUTING.md:31-41, README.md:95-103
Containerized Dependency Handling
To avoid interfering with the host system's crontab or Python environment, dependencies for tests are managed within a Docker container. The tests/compose.yml file defines the build context and volume mappings to ensure the package under development is available to the test runner without manual installation.
Sources: tests/compose.yml:1-13, README.md:95-103
Code Quality and Standards
Dependency management extends to tools that enforce code style and type safety, configured within the same pyproject.toml file.
- Black: Used for universal code formatting to ensure deterministic diffs.
- isort: Configured with the
blackprofile to manage import sorting with a vertical hanging indent (multi-line output 3). - mypy: Enforces strict type checking, including
disallow_untyped_defs = trueandwarn_return_any = true.
[tool.isort]
profile = "black"
multi_line_output = 3
[tool.mypy]
disallow_untyped_defs = true
check_untyped_defs = true
exclude = ['tests']
Sources: pyproject.toml:26-41, CONTRIBUTING.md:43-52
Integration with Meltano
As a Meltano utility, the project's own installation as a dependency within a Meltano project is defined by the pip_url. When installed via meltano add utility cron, it relies on the environment where Meltano is running to provide the necessary context.
The extension identifies the host environment's PATH and VIRTUAL_ENV to ensure that when cron jobs are executed, they use the same dependency context as the user who ran the installation.
Sources: cron_ext/extension.py:100-105, README.md:35-45
Summary
cron-ext leverages Poetry for structured dependency definition and environment isolation via pre-commit and Docker. This approach minimizes dependency conflicts and ensures that the runtime environment remains focused on the Meltano EDK and Typer-based CLI logic, while development tools are strictly confined to their respective layers.
Sources: pyproject.toml:1-45, CONTRIBUTING.md:31-41