Contribution Workflow
Relevant source files
The following files were used as context for generating this wiki page:
The contribution workflow for cron-ext is designed to ensure code quality, maintain consistent formatting, and automate the release process through structured pull requests and rigorous testing. As a Meltano utility extension, the project follows Meltano's general contribution standards while utilizing specific tools like pre-commit, Black, and mypy for local development and pytest within Docker for validation.
Contributors are expected to adhere to the project's Code of Conduct and use Semantic Pull Requests to facilitate automated changelog management. The workflow emphasizes "Black" formatting for deterministic code style and pervasive Python type hints to improve developer ergonomics and code reliability.
Sources: CONTRIBUTING.md:1-12, README.md:1-5
Development Standards and Tooling
The project enforces several development standards to maintain high code quality and consistency across the codebase.
Pull Request and Commit Strategy
The repository utilizes the semantic-prs GitHub app to enforce conventional commit syntax on Pull Request titles. This automation streamlines the generation of release notes and changelogs.
| PR Type | Description |
|---|---|
feat | A new feature |
fix | A bug fix |
docs | Documentation only changes |
test | Adding missing tests or correcting existing tests |
refactor | A code change that neither fixes a bug nor adds a feature |
chore | Updates to the build process or auxiliary tools |
Sources: CONTRIBUTING.md:14-34
Code Quality Tools
Local development relies on pre-commit to manage linters and formatting tools without cluttering the project's primary dependencies.
- Universal Formatting: The project uses Black for deterministic code formatting, ensuring that diffs remain small and focused on content rather than style.
- Type Hinting: Mypy is configured to enforce pervasive type hints, which reduces the need for extensive manual documentation reading.
- Docstrings: Public modules, classes, and functions must follow the Google Style convention, requiring descriptions for all arguments and return values.
Sources: CONTRIBUTING.md:41-69, pyproject.toml:35-45
Testing Infrastructure
Testing for cron-ext is primarily conducted using pytest. Because the utility interacts directly with the system crontab, tests are containerized to prevent modifications to the developer's host system.
Containerized Testing Flow
The project includes a Docker configuration specifically for running tests in an isolated environment.
The testing suite ensures that cron-ext correctly manages the "Meltano Crontab Section" without interfering with non-managed system entries.
Sources: README.md:92-98, tests/conftest.py:11-16, tests/test_cron_ext.py:53-75
Test Environment Setup
The testing environment is initialized using a session-scoped fixture that creates a temporary Meltano project and installs the cron utility.
@pytest.fixture(scope="session", autouse=True)
def meltano_project(tmp_path_factory: pytest.TempPathFactory) -> None:
with pytest.MonkeyPatch.context() as monkeypatch:
monkeypatch.chdir(tmp_path_factory.mktemp(f"cron-ext-projects-{os.getpid()}"))
subprocess.run(
("meltano", "init", "--no_usage_stats", project_name), check=True
)
# ... additional setup ...
Sources: tests/test_cron_ext.py:33-60
Project Architecture and Implementation
The extension is built using the Meltano EDK (Extension Development Kit), inheriting from ExtensionBase.
Core Components
The workflow for adding functionality involves modifying the Cron class in cron_ext/extension.py.
| Component | Responsibility |
|---|---|
Cron Class | Primary extension logic, managing schedule retrieval and script generation. |
EntryStore | Abstract interface for storing cron entries (e.g., crontab, stdout). |
cron_ext_dir | A directory (.meltano/run/cron-ext/) where generated .sh wrappers reside. |
Sources: cron_ext/extension.py:27-75, cron_ext/stores/base.py:10-28
Extension Lifecycle Diagram
This sequence shows how the extension processes a Meltano schedule into a system cron entry.
Sources: cron_ext/extension.py:87-124, README.md:14-25
Conclusion
The contribution workflow ensures that every change is validated against existing system logic through isolated Docker tests and consistent coding standards. By leveraging Semantic PRs and the Meltano EDK, the project maintains a professional and automated lifecycle for a system-level utility.
Sources: CONTRIBUTING.md:14-20, README.md:92-94