Initial commit
This commit is contained in:
34
commands/py-deps.md
Normal file
34
commands/py-deps.md
Normal file
@@ -0,0 +1,34 @@
|
||||
---
|
||||
description: Manage Python dependencies with uv package manager
|
||||
---
|
||||
|
||||
# Manage Python Dependencies
|
||||
|
||||
Add, update, or remove project dependencies using the uv package manager.
|
||||
|
||||
## Tasks to Complete
|
||||
|
||||
1. **Add Dependencies**
|
||||
- For runtime: `uv add <package-name>`
|
||||
- For development: `uv add --dev <package-name>`
|
||||
- Confirm package was added to `pyproject.toml`
|
||||
|
||||
2. **Update Dependencies**
|
||||
- Run `uv sync` to sync all dependencies
|
||||
- Update specific package: `uv add <package-name>@latest`
|
||||
- Report outdated packages if requested
|
||||
|
||||
3. **Remove Dependencies**
|
||||
- Run `uv remove <package-name>` to remove a package
|
||||
- Clean up unused dependencies
|
||||
|
||||
4. **Verify Environment**
|
||||
- Ensure virtual environment is active
|
||||
- Verify all dependencies are installed correctly
|
||||
- Check for dependency conflicts
|
||||
|
||||
## Expected Outcome
|
||||
|
||||
- Up-to-date dependencies in sync with `pyproject.toml`
|
||||
- Clean, conflict-free dependency tree
|
||||
- Clear confirmation of changes made
|
||||
51
commands/py-init.md
Normal file
51
commands/py-init.md
Normal file
@@ -0,0 +1,51 @@
|
||||
---
|
||||
description: Initialize a new Python project with modern tooling (uv, ruff, pytest)
|
||||
---
|
||||
|
||||
# Initialize Python Project
|
||||
|
||||
Initialize a new Python project following modern best practices. This command sets up the project structure, tooling, and configuration.
|
||||
|
||||
## Tasks to Complete
|
||||
|
||||
1. **Project Initialization**
|
||||
- Run `uv init <project-name>` to create the project
|
||||
- Create `.python-version` file for pyenv compatibility
|
||||
- Initialize git repository if not already present
|
||||
|
||||
2. **Directory Structure**
|
||||
- Create `src/<project_name>/` for main code
|
||||
- Create `tests/` directory for test files
|
||||
- Create `.vscode/` for editor configuration
|
||||
- Create `docs/` for documentation
|
||||
|
||||
3. **Essential Dependencies**
|
||||
- Add `pytest` as dev dependency: `uv add --dev pytest`
|
||||
- Add `ruff` as dev dependency: `uv add --dev ruff`
|
||||
- Add `mypy` as dev dependency: `uv add --dev mypy`
|
||||
- Add `pydantic` as runtime dependency: `uv add pydantic`
|
||||
|
||||
4. **Configuration Files**
|
||||
- Create `pyproject.toml` with ruff and pytest configuration
|
||||
- Create `.gitignore` for Python projects
|
||||
- Create `.vscode/settings.json` with Python and ruff settings
|
||||
|
||||
5. **Documentation**
|
||||
- Create `README.md` with project overview and setup instructions
|
||||
- Create initial documentation structure
|
||||
|
||||
## Expected Outcome
|
||||
|
||||
A fully initialized Python project ready for development with:
|
||||
- Modern package management (uv)
|
||||
- Fast linting and formatting (ruff)
|
||||
- Testing framework (pytest)
|
||||
- Type checking (mypy)
|
||||
- Editor configuration (VSCode)
|
||||
- Version control (git)
|
||||
|
||||
## User Inputs Required
|
||||
|
||||
- Project name
|
||||
- Python version (default: latest stable)
|
||||
- Whether to include FastAPI for API projects
|
||||
33
commands/py-lint.md
Normal file
33
commands/py-lint.md
Normal file
@@ -0,0 +1,33 @@
|
||||
---
|
||||
description: Run ruff linter and formatter to check code quality
|
||||
---
|
||||
|
||||
# Lint Python Code
|
||||
|
||||
Check and fix code quality issues using ruff, the fast Python linter and formatter.
|
||||
|
||||
## Tasks to Complete
|
||||
|
||||
1. **Run Linter**
|
||||
- Execute `ruff check .` to identify issues
|
||||
- Report all linting errors and warnings
|
||||
- Categorize issues by severity
|
||||
|
||||
2. **Auto-fix Issues** (if requested)
|
||||
- Run `ruff check --fix .` to automatically fix issues
|
||||
- Report which issues were fixed automatically
|
||||
|
||||
3. **Format Code**
|
||||
- Execute `ruff format .` to format all Python files
|
||||
- Ensure PEP 8 compliance
|
||||
- Report which files were reformatted
|
||||
|
||||
4. **Type Checking** (if mypy is installed)
|
||||
- Run `mypy .` to check type annotations
|
||||
- Report type errors with file locations
|
||||
|
||||
## Expected Outcome
|
||||
|
||||
- Clean, well-formatted code following PEP 8
|
||||
- All auto-fixable issues resolved
|
||||
- Clear report of remaining issues requiring manual intervention
|
||||
30
commands/py-test.md
Normal file
30
commands/py-test.md
Normal file
@@ -0,0 +1,30 @@
|
||||
---
|
||||
description: Run pytest with proper configuration and coverage reporting
|
||||
---
|
||||
|
||||
# Run Python Tests
|
||||
|
||||
Execute the project's test suite using pytest with appropriate options and coverage reporting.
|
||||
|
||||
## Tasks to Complete
|
||||
|
||||
1. **Run Tests**
|
||||
- Execute `uv run pytest` to run all tests
|
||||
- Display test results clearly
|
||||
- Report any failures with details
|
||||
|
||||
2. **Coverage Analysis** (if requested)
|
||||
- Run `uv run pytest --cov` for coverage report
|
||||
- Generate HTML coverage report if needed
|
||||
- Highlight areas needing more test coverage
|
||||
|
||||
3. **Test Filtering** (if requested)
|
||||
- Run specific test files: `uv run pytest tests/test_specific.py`
|
||||
- Run tests matching pattern: `uv run pytest -k "pattern"`
|
||||
- Run only failed tests: `uv run pytest --lf`
|
||||
|
||||
## Expected Outcome
|
||||
|
||||
- Clear test results showing passes/failures
|
||||
- Coverage percentages for each module
|
||||
- Actionable information about test failures
|
||||
Reference in New Issue
Block a user