|
| 1 | +# Project Context for Agents |
| 2 | + |
| 3 | +## Project Overview |
| 4 | +This is a Python project that implements an "End Of File Fixer" - a tool that ensures files end with exactly one newline character. The tool scans files in a directory and automatically adds or removes newlines at the end of files to maintain consistent formatting. |
| 5 | + |
| 6 | +Despite the project name, the description in `pyproject.toml` mentions "Implementations of the Circuit Breaker" which appears to be incorrect or outdated. |
| 7 | + |
| 8 | +### Key Technologies |
| 9 | +- **Language**: Python 3.10+ |
| 10 | +- **Dependencies**: |
| 11 | + - `pathspec` for gitignore pattern matching |
| 12 | +- **Development Tools**: |
| 13 | + - `uv` for package management and building |
| 14 | + - `ruff` for linting and formatting |
| 15 | + - `mypy` for type checking |
| 16 | + - `pytest` for testing |
| 17 | + - `just` as a command runner |
| 18 | + |
| 19 | +### Architecture |
| 20 | +The project follows a simple CLI tool structure: |
| 21 | +- Main entry point: `end_of_file_fixer/main.py` |
| 22 | +- CLI interface using `argparse` |
| 23 | +- File processing logic in `_fix_file()` function |
| 24 | +- Integration with `.gitignore` patterns via `pathspec` |
| 25 | + |
| 26 | +## Building and Running |
| 27 | + |
| 28 | +### Setup |
| 29 | +```bash |
| 30 | +# Install dependencies |
| 31 | +just install |
| 32 | +``` |
| 33 | + |
| 34 | +### Development Commands |
| 35 | +```bash |
| 36 | +# Run linting and type checking |
| 37 | +just lint |
| 38 | + |
| 39 | +# Run tests |
| 40 | +just test |
| 41 | + |
| 42 | +# Run tests with arguments |
| 43 | +just test -v |
| 44 | + |
| 45 | +# Format code |
| 46 | +just lint # Includes auto-formatting |
| 47 | +``` |
| 48 | + |
| 49 | +### Using the Tool |
| 50 | +```bash |
| 51 | +# Fix files in a directory (modifies files) |
| 52 | +python -m end_of_file_fixer.main /path/to/directory |
| 53 | + |
| 54 | +# Check files in a directory (dry run) |
| 55 | +python -m end_of_file_fixer.main /path/to/directory --check |
| 56 | +``` |
| 57 | + |
| 58 | +Or using the installed script: |
| 59 | +```bash |
| 60 | +# Fix files |
| 61 | +end-of-file-fixer /path/to/directory |
| 62 | + |
| 63 | +# Check files |
| 64 | +end-of-file-fixer /path/to/directory --check |
| 65 | +``` |
| 66 | + |
| 67 | +## Development Conventions |
| 68 | + |
| 69 | +### Code Style |
| 70 | +- Line length: 120 characters |
| 71 | +- Strict type checking with mypy |
| 72 | +- Ruff linting with specific rule exceptions (see pyproject.toml) |
| 73 | +- No mandatory docstrings (D1 ignored) |
| 74 | + |
| 75 | +### Testing |
| 76 | +- Uses pytest framework |
| 77 | +- Tests should be placed in the `tests/` directory |
| 78 | +- Follow standard pytest naming conventions (`test_*.py` files, `test_*` functions) |
| 79 | + |
| 80 | +### Project Structure |
| 81 | +``` |
| 82 | +end-of-file-fixer/ |
| 83 | +├── end_of_file_fixer/ # Main package |
| 84 | +│ ├── __init__.py # Package initializer |
| 85 | +│ └── main.py # Main CLI implementation |
| 86 | +├── tests/ # Test files |
| 87 | +│ └── test_dummy.py # Sample test file |
| 88 | +├── pyproject.toml # Project configuration |
| 89 | +├── Justfile # Command definitions |
| 90 | +├── README.md # Project description |
| 91 | +└── .gitignore # Git ignore patterns |
| 92 | +``` |
| 93 | + |
| 94 | +### Dependency Management |
| 95 | +- Uses `uv` for fast dependency resolution and installation |
| 96 | +- Dependencies defined in `pyproject.toml` |
| 97 | +- Development dependencies in `[dependency-groups].dev` |
| 98 | + |
| 99 | +### CI/CD |
| 100 | +- Linting and type checking enforced in CI |
| 101 | +- Publishing handled via `just publish` command |
0 commit comments