|
1 | 1 | # Python Personal Scripts |
2 | 2 |
|
3 | | -A collection of scripts for personal tasks and automations. |
| 3 | +Python scripts and utilities for everyday tasks and automation. |
4 | 4 |
|
5 | 5 | ## Setup |
6 | 6 |
|
| 7 | +### Prerequisites |
| 8 | + |
| 9 | +- Python 3.12+ |
| 10 | +- Virtual environment (recommended) |
| 11 | + |
| 12 | +### Installation |
| 13 | + |
| 14 | +1. Clone and navigate to the project: |
| 15 | + |
| 16 | +```bash |
| 17 | +git clone https://github.com/currantw/python-personal-scripts |
| 18 | +cd python-personal-scripts |
| 19 | +``` |
| 20 | + |
| 21 | +1. Set up a virtual environment: |
| 22 | + |
| 23 | +**On macOS/Linux:** |
| 24 | + |
7 | 25 | ```bash |
8 | | -# Install dependencies |
9 | | -make install-dev |
| 26 | +python -m venv .venv |
| 27 | +source .venv/bin/activate |
| 28 | +``` |
10 | 29 |
|
11 | | -# Run code quality checks |
12 | | -make check-all |
| 30 | +**On Windows:** |
13 | 31 |
|
14 | | -# Fix formatting and linting issues |
15 | | -make fix-all |
| 32 | +```bash |
| 33 | +python -m venv .venv |
| 34 | +.venv\Scripts\activate |
| 35 | +``` |
16 | 36 |
|
17 | | -# Run tests (lib/ directory only) |
18 | | -make test-cov |
| 37 | +1. Install dependencies: |
| 38 | + |
| 39 | +```bash |
| 40 | +make install # Production only |
| 41 | +make install-dev # With development tools |
19 | 42 | ``` |
20 | 43 |
|
21 | | -## Structure |
| 44 | +## Development |
| 45 | + |
| 46 | +This project uses modern Python tooling for fast and consistent code quality |
| 47 | +checks. |
| 48 | + |
| 49 | +Code quality tools: |
| 50 | + |
| 51 | +- **Ruff**: Fast code formatter, import sorter, and linter |
| 52 | +- **mypy**: Type checker |
| 53 | +- **markdownlint**: Markdown linter |
| 54 | +- **pre-commit**: Git hooks |
| 55 | + |
| 56 | +### Commands |
| 57 | + |
| 58 | +```bash |
| 59 | +# Checking (read-only) |
| 60 | +make check-format # Check code formatting |
| 61 | +make check-lint # Check Python and Markdown linting |
| 62 | +make check-type # Run type checker |
| 63 | +make check-all # Run all checks |
| 64 | + |
| 65 | +# Fixing (read/write) |
| 66 | +make fix-format # Format code with ruff |
| 67 | +make fix-lint # Run linters with auto-fix (Python + Markdown) |
| 68 | +make fix-all # Apply all auto-fixes (format + lint) |
| 69 | + |
| 70 | +# Testing |
| 71 | +make test # Run tests (lib/ directory only) |
| 72 | +make test-cov # Run tests with coverage (lib/ directory only) |
| 73 | + |
| 74 | +# Utilities |
| 75 | +make all # Run all checks and tests with coverage |
| 76 | +make clean # Clean cache files |
| 77 | +make help # See all commands |
| 78 | +``` |
| 79 | + |
| 80 | +Pre-commit hooks run automatically on commit. To run manually: |
| 81 | + |
| 82 | +```bash |
| 83 | +make pre-commit |
| 84 | +``` |
| 85 | + |
| 86 | +### Project Structure |
22 | 87 |
|
23 | 88 | - `lib/` - Shared library modules |
24 | 89 | - `scripts/` - Executable scripts |
25 | 90 | - `tests/` - Test files |
| 91 | + |
| 92 | +### CI/CD |
| 93 | + |
| 94 | +The project uses GitHub Actions for continuous integration. The workflow runs |
| 95 | +the same commands as local development: |
| 96 | + |
| 97 | +- **Code Quality**: `make check` (format check, linting, type checking) |
| 98 | +- **Testing**: `make test-cov` (tests with coverage reporting) |
| 99 | + |
| 100 | +This ensures consistency between local development and CI environments. |
| 101 | + |
| 102 | +### Configuration Files |
| 103 | + |
| 104 | +- `.gitignore`: Files and directories to ignore in version control |
| 105 | +- `.pre-commit-config.yaml`: Pre-commit hooks configuration |
| 106 | +- `Makefile`: Convenient commands for development tasks |
| 107 | +- `pyproject.toml`: Main configuration file for tools and project metadata |
| 108 | +- `requirements-dev.txt`: Development dependencies |
| 109 | +- `requirements.txt`: Production dependencies |
0 commit comments