Linter Configured + Python Collector
Enforce Linter Configured using data collected by Python Collector. Automatically check devex build and ci standards on every PR.
How Python Collector Powers This Guardrail
The Python Collector gathers metadata from your languages, build systems. This data flows into Lunar's Component JSON, where the Linter Configured guardrail evaluates it against your standards.
When enabled, this check runs automatically on every PR and in AI coding workflows, providing real-time enforcement with actionable feedback.
Quick Start Configuration
Add both the collector and policy to your lunar-config.yml to enable this guardrail.
# Step 1: Enable the Python Collector
collectors:
- uses: github://earthly/lunar-lib/collectors/python@v1.0.0
# with: ...
# Step 2: Enable the Python Project Guardrails
policies:
- uses: github://earthly/lunar-lib/policies/python@v1.0.0
include: [linter-configured]
# with: ...
What Python Collector Collects
This collector gathers the following data that the Linter Configured guardrail evaluates.
cicd
Records every Python command executed in CI pipelines along with the Python runtime version. Writes command strings and version info to .lang.python.cicd for audit trails and build reproducibility analysis.
pip-cicd
Records every pip command executed in CI pipelines along with the pip version. Writes command strings and version info to .lang.python.pip.cicd.
poetry-cicd
Records every Poetry command executed in CI pipelines along with the Poetry version. Writes command strings and version info to .lang.python.poetry.cicd.
uv-cicd
Records every uv command executed in CI pipelines along with the uv version. Writes command strings and version info to .lang.python.uv.cicd.
Example Data Flow
Here's an example of the data that Python Collector writes to the Component JSON, which Linter Configured then evaluates.
{
"lang": {
"python": {
"version": "3.12.1",
"build_systems": ["poetry"],
"pyproject_exists": true,
"requirements_txt_exists": false,
"setup_py_exists": false,
"pipfile_exists": false,
"poetry_lock_exists": true,
"pipfile_lock_exists": false,
"python_version_file_exists": true,
"linter_configured": true,
"linter": "ruff",
"type_checker_configured": true,
"type_checker": "mypy",
"source": { "tool": "python", "integration": "code" },
"cicd": {
"cmds": [{ "cmd": "pytest --cov=src", "version": "3.12.1" }]
},
"poetry": {
"cicd": {
"cmds": [{ "cmd": "poetry install --no-root", "version": "1.8.3" }]
}
},
"tests": {
"coverage": {
"percentage": 85.5,
"source": { "tool": "coverage", "integration": "ci" }
}
},
"dependencies": {
"direct": [
{ "path": "flask", "version": "3.0.0", "indirect": false }
],
"transitive": [],
"source": { "tool": "pip", "integration": "code" }
}
}
},
"testing": {
"coverage": {
"percentage": 85.5,
"source": { "tool": "coverage", "integration": "ci" }
},
"source": { "tool": "pytest", "integration": "ci" }
}
}
Configuration Options
Python Project Guardrails Inputs
| Input | Required | Default | Description |
|---|---|---|---|
min_python_version |
Optional |
3.9
|
Minimum required Python version (e.g., "3.9", "3.11") |
min_python_version_cicd |
Optional |
3.9
|
Minimum required Python version for CI/CD commands |
Ready to Automate Your Standards?
See how Lunar can turn your engineering wiki, compliance docs, or postmortem action items into automated guardrails with our 100+ built-in guardrails.