Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 89b1c71e99 | |||
| 769dceca62 | |||
| c74330f33d | |||
| c136fc7f20 | |||
| 7c5d566d58 | |||
| 84c474a56e |
@@ -21,18 +21,28 @@ jobs:
|
||||
run: |
|
||||
pip install -e ".[dev]"
|
||||
|
||||
- name: Run unit tests
|
||||
run: pytest tests/unit/ -v
|
||||
- name: Run linting
|
||||
run: ruff check envschema/
|
||||
|
||||
- name: Run integration tests
|
||||
run: pytest tests/integration/ -v
|
||||
- name: Run tests
|
||||
run: pytest tests/ -v
|
||||
|
||||
- name: Check code formatting
|
||||
run: |
|
||||
pip install ruff
|
||||
ruff check envschema/
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
needs: test
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Upload coverage
|
||||
run: |
|
||||
pip install pytest-cov
|
||||
pytest --cov=envschema --cov-report=term-missing
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: '3.11'
|
||||
|
||||
- name: Install dependencies
|
||||
run: pip install -e .
|
||||
|
||||
- name: Verify import
|
||||
run: python -c "import envschema; print(envschema.__version__)"
|
||||
|
||||
- name: Verify CLI
|
||||
run: envschema --version
|
||||
@@ -1,12 +1,9 @@
|
||||
"""CLI interface for EnvSchema."""
|
||||
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
import click
|
||||
|
||||
from envschema import __version__
|
||||
from envschema.schema import load_schema_from_file, Schema
|
||||
from envschema.schema import load_schema_from_file
|
||||
from envschema.core import validate_environment
|
||||
from envschema.generator import generate_env_example_to_file
|
||||
from envschema.formatters import format_result
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
from dataclasses import dataclass, field
|
||||
from typing import Optional
|
||||
|
||||
from envschema.schema import Schema, EnvVar
|
||||
from envschema.schema import Schema
|
||||
from envschema.loader import EnvLoader
|
||||
from envschema.validators import validate_value
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
"""Output formatters for validation results."""
|
||||
|
||||
import json
|
||||
from typing import Optional
|
||||
|
||||
from envschema.core import ValidationResult
|
||||
|
||||
|
||||
@@ -25,13 +25,10 @@ def generate_env_example(schema: Schema, include_descriptions: bool = True) -> s
|
||||
lines.append(f"# {var.description}")
|
||||
|
||||
if var.required:
|
||||
lines.append(f"# REQUIRED")
|
||||
lines.append("# REQUIRED")
|
||||
elif var.default is not None:
|
||||
lines.append(f"# Default: {var.default}")
|
||||
|
||||
default_part = f"# {var.default}" if var.default else ""
|
||||
type_part = f"[{var.type.value}]"
|
||||
|
||||
if var.required:
|
||||
lines.append(f"{var.name}=")
|
||||
elif var.default is not None:
|
||||
|
||||
@@ -41,7 +41,7 @@ class IntegerValidator:
|
||||
return True, None
|
||||
except ValueError:
|
||||
return False, ValidationError(
|
||||
f"Invalid integer value",
|
||||
"Invalid integer value",
|
||||
value=value
|
||||
)
|
||||
|
||||
@@ -62,7 +62,7 @@ class BooleanValidator:
|
||||
if value_lower in BooleanValidator.FALSE_VALUES:
|
||||
return True, None
|
||||
return False, ValidationError(
|
||||
f"Invalid boolean value (expected: true, false, 1, 0, yes, no, on, off)",
|
||||
"Invalid boolean value (expected: true, false, 1, 0, yes, no, on, off)",
|
||||
value=value
|
||||
)
|
||||
|
||||
@@ -77,7 +77,7 @@ class ListValidator:
|
||||
if "," in value:
|
||||
return True, None
|
||||
return False, ValidationError(
|
||||
f"Invalid list value (expected comma-separated values)",
|
||||
"Invalid list value (expected comma-separated values)",
|
||||
value=value
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user