qcp-cli 0.1.5__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. qcp_cli-0.1.5/.agents/skills/python-code-style/SKILL.md +360 -0
  2. qcp_cli-0.1.5/.agents/skills/uv-package-manager/SKILL.md +345 -0
  3. qcp_cli-0.1.5/.agents/skills/uv-package-manager/references/advanced-patterns.md +473 -0
  4. qcp_cli-0.1.5/.github/workflows/ci.yml +60 -0
  5. qcp_cli-0.1.5/.github/workflows/release.yml +101 -0
  6. qcp_cli-0.1.5/.gitignore +16 -0
  7. qcp_cli-0.1.5/.pre-commit-config.yaml +7 -0
  8. qcp_cli-0.1.5/.python-version +1 -0
  9. qcp_cli-0.1.5/.vscode/settings.json +13 -0
  10. qcp_cli-0.1.5/AGENTS.md +78 -0
  11. qcp_cli-0.1.5/CONTRIBUTING.md +29 -0
  12. qcp_cli-0.1.5/Formula/qcp.rb +30 -0
  13. qcp_cli-0.1.5/LICENSE +21 -0
  14. qcp_cli-0.1.5/Makefile +60 -0
  15. qcp_cli-0.1.5/PKG-INFO +207 -0
  16. qcp_cli-0.1.5/README.md +179 -0
  17. qcp_cli-0.1.5/main.py +6 -0
  18. qcp_cli-0.1.5/pyproject.toml +65 -0
  19. qcp_cli-0.1.5/qcp/__init__.py +8 -0
  20. qcp_cli-0.1.5/qcp/agent.py +165 -0
  21. qcp_cli-0.1.5/qcp/cli.py +191 -0
  22. qcp_cli-0.1.5/qcp/config.py +85 -0
  23. qcp_cli-0.1.5/qcp/db.py +176 -0
  24. qcp_cli-0.1.5/qcp/errors.py +61 -0
  25. qcp_cli-0.1.5/qcp/llm.py +61 -0
  26. qcp_cli-0.1.5/qcp/memory.py +94 -0
  27. qcp_cli-0.1.5/qcp/models.py +125 -0
  28. qcp_cli-0.1.5/qcp/output.py +119 -0
  29. qcp_cli-0.1.5/qcp/tools.py +168 -0
  30. qcp_cli-0.1.5/scripts/build.sh +12 -0
  31. qcp_cli-0.1.5/scripts/clean.sh +10 -0
  32. qcp_cli-0.1.5/scripts/install.ps1 +32 -0
  33. qcp_cli-0.1.5/scripts/install.sh +73 -0
  34. qcp_cli-0.1.5/skills-lock.json +17 -0
  35. qcp_cli-0.1.5/tests/test_agent.py +138 -0
  36. qcp_cli-0.1.5/tests/test_cli.py +83 -0
  37. qcp_cli-0.1.5/tests/test_core.py +141 -0
  38. qcp_cli-0.1.5/tests/test_memory.py +74 -0
  39. qcp_cli-0.1.5/tests/test_output.py +63 -0
  40. qcp_cli-0.1.5/tests/test_tools.py +139 -0
  41. qcp_cli-0.1.5/tests/test_version.py +17 -0
  42. qcp_cli-0.1.5/uv.lock +1058 -0
@@ -0,0 +1,360 @@
1
+ ---
2
+ name: python-code-style
3
+ description: Python code style, linting, formatting, naming conventions, and documentation standards. Use when writing new code, reviewing style, configuring linters, writing docstrings, or establishing project standards.
4
+ ---
5
+
6
+ # Python Code Style & Documentation
7
+
8
+ Consistent code style and clear documentation make codebases maintainable and collaborative. This skill covers modern Python tooling, naming conventions, and documentation standards.
9
+
10
+ ## When to Use This Skill
11
+
12
+ - Setting up linting and formatting for a new project
13
+ - Writing or reviewing docstrings
14
+ - Establishing team coding standards
15
+ - Configuring ruff, mypy, or pyright
16
+ - Reviewing code for style consistency
17
+ - Creating project documentation
18
+
19
+ ## Core Concepts
20
+
21
+ ### 1. Automated Formatting
22
+
23
+ Let tools handle formatting debates. Configure once, enforce automatically.
24
+
25
+ ### 2. Consistent Naming
26
+
27
+ Follow PEP 8 conventions with meaningful, descriptive names.
28
+
29
+ ### 3. Documentation as Code
30
+
31
+ Docstrings should be maintained alongside the code they describe.
32
+
33
+ ### 4. Type Annotations
34
+
35
+ Modern Python code should include type hints for all public APIs.
36
+
37
+ ## Quick Start
38
+
39
+ ```bash
40
+ # Install modern tooling
41
+ pip install ruff mypy
42
+
43
+ # Configure in pyproject.toml
44
+ [tool.ruff]
45
+ line-length = 120
46
+ target-version = "py312" # Adjust based on your project's minimum Python version
47
+
48
+ [tool.mypy]
49
+ strict = true
50
+ ```
51
+
52
+ ## Fundamental Patterns
53
+
54
+ ### Pattern 1: Modern Python Tooling
55
+
56
+ Use `ruff` as an all-in-one linter and formatter. It replaces flake8, isort, and black with a single fast tool.
57
+
58
+ ```toml
59
+ # pyproject.toml
60
+ [tool.ruff]
61
+ line-length = 120
62
+ target-version = "py312" # Adjust based on your project's minimum Python version
63
+
64
+ [tool.ruff.lint]
65
+ select = [
66
+ "E", # pycodestyle errors
67
+ "W", # pycodestyle warnings
68
+ "F", # pyflakes
69
+ "I", # isort
70
+ "B", # flake8-bugbear
71
+ "C4", # flake8-comprehensions
72
+ "UP", # pyupgrade
73
+ "SIM", # flake8-simplify
74
+ ]
75
+ ignore = ["E501"] # Line length handled by formatter
76
+
77
+ [tool.ruff.format]
78
+ quote-style = "double"
79
+ indent-style = "space"
80
+ ```
81
+
82
+ Run with:
83
+
84
+ ```bash
85
+ ruff check --fix . # Lint and auto-fix
86
+ ruff format . # Format code
87
+ ```
88
+
89
+ ### Pattern 2: Type Checking Configuration
90
+
91
+ Configure strict type checking for production code.
92
+
93
+ ```toml
94
+ # pyproject.toml
95
+ [tool.mypy]
96
+ python_version = "3.12"
97
+ strict = true
98
+ warn_return_any = true
99
+ warn_unused_ignores = true
100
+ disallow_untyped_defs = true
101
+ disallow_incomplete_defs = true
102
+
103
+ [[tool.mypy.overrides]]
104
+ module = "tests.*"
105
+ disallow_untyped_defs = false
106
+ ```
107
+
108
+ Alternative: Use `pyright` for faster checking.
109
+
110
+ ```toml
111
+ [tool.pyright]
112
+ pythonVersion = "3.12"
113
+ typeCheckingMode = "strict"
114
+ ```
115
+
116
+ ### Pattern 3: Naming Conventions
117
+
118
+ Follow PEP 8 with emphasis on clarity over brevity.
119
+
120
+ **Files and Modules:**
121
+
122
+ ```python
123
+ # Good: Descriptive snake_case
124
+ user_repository.py
125
+ order_processing.py
126
+ http_client.py
127
+
128
+ # Avoid: Abbreviations
129
+ usr_repo.py
130
+ ord_proc.py
131
+ http_cli.py
132
+ ```
133
+
134
+ **Classes and Functions:**
135
+
136
+ ```python
137
+ # Classes: PascalCase
138
+ class UserRepository:
139
+ pass
140
+
141
+ class HTTPClientFactory: # Acronyms stay uppercase
142
+ pass
143
+
144
+ # Functions and variables: snake_case
145
+ def get_user_by_email(email: str) -> User | None:
146
+ retry_count = 3
147
+ max_connections = 100
148
+ ```
149
+
150
+ **Constants:**
151
+
152
+ ```python
153
+ # Module-level constants: SCREAMING_SNAKE_CASE
154
+ MAX_RETRY_ATTEMPTS = 3
155
+ DEFAULT_TIMEOUT_SECONDS = 30
156
+ API_BASE_URL = "https://api.example.com"
157
+ ```
158
+
159
+ ### Pattern 4: Import Organization
160
+
161
+ Group imports in a consistent order: standard library, third-party, local.
162
+
163
+ ```python
164
+ # Standard library
165
+ import os
166
+ from collections.abc import Callable
167
+ from typing import Any
168
+
169
+ # Third-party packages
170
+ import httpx
171
+ from pydantic import BaseModel
172
+ from sqlalchemy import Column
173
+
174
+ # Local imports
175
+ from myproject.models import User
176
+ from myproject.services import UserService
177
+ ```
178
+
179
+ Use absolute imports exclusively:
180
+
181
+ ```python
182
+ # Preferred
183
+ from myproject.utils import retry_decorator
184
+
185
+ # Avoid relative imports
186
+ from ..utils import retry_decorator
187
+ ```
188
+
189
+ ## Advanced Patterns
190
+
191
+ ### Pattern 5: Google-Style Docstrings
192
+
193
+ Write docstrings for all public classes, methods, and functions.
194
+
195
+ **Simple Function:**
196
+
197
+ ```python
198
+ def get_user(user_id: str) -> User:
199
+ """Retrieve a user by their unique identifier."""
200
+ ...
201
+ ```
202
+
203
+ **Complex Function:**
204
+
205
+ ```python
206
+ def process_batch(
207
+ items: list[Item],
208
+ max_workers: int = 4,
209
+ on_progress: Callable[[int, int], None] | None = None,
210
+ ) -> BatchResult:
211
+ """Process items concurrently using a worker pool.
212
+
213
+ Processes each item in the batch using the configured number of
214
+ workers. Progress can be monitored via the optional callback.
215
+
216
+ Args:
217
+ items: The items to process. Must not be empty.
218
+ max_workers: Maximum concurrent workers. Defaults to 4.
219
+ on_progress: Optional callback receiving (completed, total) counts.
220
+
221
+ Returns:
222
+ BatchResult containing succeeded items and any failures with
223
+ their associated exceptions.
224
+
225
+ Raises:
226
+ ValueError: If items is empty.
227
+ ProcessingError: If the batch cannot be processed.
228
+
229
+ Example:
230
+ >>> result = process_batch(items, max_workers=8)
231
+ >>> print(f"Processed {len(result.succeeded)} items")
232
+ """
233
+ ...
234
+ ```
235
+
236
+ **Class Docstring:**
237
+
238
+ ```python
239
+ class UserService:
240
+ """Service for managing user operations.
241
+
242
+ Provides methods for creating, retrieving, updating, and
243
+ deleting users with proper validation and error handling.
244
+
245
+ Attributes:
246
+ repository: The data access layer for user persistence.
247
+ logger: Logger instance for operation tracking.
248
+
249
+ Example:
250
+ >>> service = UserService(repository, logger)
251
+ >>> user = service.create_user(CreateUserInput(...))
252
+ """
253
+
254
+ def __init__(self, repository: UserRepository, logger: Logger) -> None:
255
+ """Initialize the user service.
256
+
257
+ Args:
258
+ repository: Data access layer for users.
259
+ logger: Logger for tracking operations.
260
+ """
261
+ self.repository = repository
262
+ self.logger = logger
263
+ ```
264
+
265
+ ### Pattern 6: Line Length and Formatting
266
+
267
+ Set line length to 120 characters for modern displays while maintaining readability.
268
+
269
+ ```python
270
+ # Good: Readable line breaks
271
+ def create_user(
272
+ email: str,
273
+ name: str,
274
+ role: UserRole = UserRole.MEMBER,
275
+ notify: bool = True,
276
+ ) -> User:
277
+ ...
278
+
279
+ # Good: Chain method calls clearly
280
+ result = (
281
+ db.query(User)
282
+ .filter(User.active == True)
283
+ .order_by(User.created_at.desc())
284
+ .limit(10)
285
+ .all()
286
+ )
287
+
288
+ # Good: Format long strings
289
+ error_message = (
290
+ f"Failed to process user {user_id}: "
291
+ f"received status {response.status_code} "
292
+ f"with body {response.text[:100]}"
293
+ )
294
+ ```
295
+
296
+ ### Pattern 7: Project Documentation
297
+
298
+ **README Structure:**
299
+
300
+ ```markdown
301
+ # Project Name
302
+
303
+ Brief description of what the project does.
304
+
305
+ ## Installation
306
+
307
+ \`\`\`bash
308
+ pip install myproject
309
+ \`\`\`
310
+
311
+ ## Quick Start
312
+
313
+ \`\`\`python
314
+ from myproject import Client
315
+
316
+ client = Client(api_key="...")
317
+ result = client.process(data)
318
+ \`\`\`
319
+
320
+ ## Configuration
321
+
322
+ Document environment variables and configuration options.
323
+
324
+ ## Development
325
+
326
+ \`\`\`bash
327
+ pip install -e ".[dev]"
328
+ pytest
329
+ \`\`\`
330
+ ```
331
+
332
+ **CHANGELOG Format (Keep a Changelog):**
333
+
334
+ ```markdown
335
+ # Changelog
336
+
337
+ ## [Unreleased]
338
+
339
+ ### Added
340
+ - New feature X
341
+
342
+ ### Changed
343
+ - Modified behavior of Y
344
+
345
+ ### Fixed
346
+ - Bug in Z
347
+ ```
348
+
349
+ ## Best Practices Summary
350
+
351
+ 1. **Use ruff** - Single tool for linting and formatting
352
+ 2. **Enable strict mypy** - Catch type errors before runtime
353
+ 3. **120 character lines** - Modern standard for readability
354
+ 4. **Descriptive names** - Clarity over brevity
355
+ 5. **Absolute imports** - More maintainable than relative
356
+ 6. **Google-style docstrings** - Consistent, readable documentation
357
+ 7. **Document public APIs** - Every public function needs a docstring
358
+ 8. **Keep docs updated** - Treat documentation as code
359
+ 9. **Automate in CI** - Run linters on every commit
360
+ 10. **Target Python 3.10+** - For new projects, Python 3.12+ is recommended for modern language features
@@ -0,0 +1,345 @@
1
+ ---
2
+ name: uv-package-manager
3
+ description: Master the uv package manager for fast Python dependency management, virtual environments, and modern Python project workflows. Use when setting up Python projects, managing dependencies, or optimizing Python development workflows with uv.
4
+ ---
5
+
6
+ # UV Package Manager
7
+
8
+ Comprehensive guide to using uv, an extremely fast Python package installer and resolver written in Rust, for modern Python project management and dependency workflows.
9
+
10
+ ## When to Use This Skill
11
+
12
+ - Setting up new Python projects quickly
13
+ - Managing Python dependencies faster than pip
14
+ - Creating and managing virtual environments
15
+ - Installing Python interpreters
16
+ - Resolving dependency conflicts efficiently
17
+ - Migrating from pip/pip-tools/poetry
18
+ - Speeding up CI/CD pipelines
19
+ - Managing monorepo Python projects
20
+ - Working with lockfiles for reproducible builds
21
+ - Optimizing Docker builds with Python dependencies
22
+
23
+ ## Core Concepts
24
+
25
+ ### 1. What is uv?
26
+
27
+ - **Ultra-fast package installer**: 10-100x faster than pip
28
+ - **Written in Rust**: Leverages Rust's performance
29
+ - **Drop-in pip replacement**: Compatible with pip workflows
30
+ - **Virtual environment manager**: Create and manage venvs
31
+ - **Python installer**: Download and manage Python versions
32
+ - **Resolver**: Advanced dependency resolution
33
+ - **Lockfile support**: Reproducible installations
34
+
35
+ ### 2. Key Features
36
+
37
+ - Blazing fast installation speeds
38
+ - Disk space efficient with global cache
39
+ - Compatible with pip, pip-tools, poetry
40
+ - Comprehensive dependency resolution
41
+ - Cross-platform support (Linux, macOS, Windows)
42
+ - No Python required for installation
43
+ - Built-in virtual environment support
44
+
45
+ ### 3. UV vs Traditional Tools
46
+
47
+ - **vs pip**: 10-100x faster, better resolver
48
+ - **vs pip-tools**: Faster, simpler, better UX
49
+ - **vs poetry**: Faster, less opinionated, lighter
50
+ - **vs conda**: Faster, Python-focused
51
+
52
+ ## Installation
53
+
54
+ ### Quick Install
55
+
56
+ ```bash
57
+ # macOS/Linux
58
+ curl -LsSf https://astral.sh/uv/install.sh | sh
59
+
60
+ # Windows (PowerShell)
61
+ powershell -c "irm https://astral.sh/uv/install.ps1 | iex"
62
+
63
+ # Using pip (if you already have Python)
64
+ pip install uv
65
+
66
+ # Using Homebrew (macOS)
67
+ brew install uv
68
+
69
+ # Using cargo (if you have Rust)
70
+ cargo install --git https://github.com/astral-sh/uv uv
71
+ ```
72
+
73
+ ### Verify Installation
74
+
75
+ ```bash
76
+ uv --version
77
+ # uv 0.x.x
78
+ ```
79
+
80
+ ## Quick Start
81
+
82
+ ### Create a New Project
83
+
84
+ ```bash
85
+ # Create new project with virtual environment
86
+ uv init my-project
87
+ cd my-project
88
+
89
+ # Or create in current directory
90
+ uv init .
91
+
92
+ # Initialize creates:
93
+ # - .python-version (Python version)
94
+ # - pyproject.toml (project config)
95
+ # - README.md
96
+ # - .gitignore
97
+ ```
98
+
99
+ ### Install Dependencies
100
+
101
+ ```bash
102
+ # Install packages (creates venv if needed)
103
+ uv add requests pandas
104
+
105
+ # Install dev dependencies
106
+ uv add --dev pytest black ruff
107
+
108
+ # Install from requirements.txt
109
+ uv pip install -r requirements.txt
110
+
111
+ # Install from pyproject.toml
112
+ uv sync
113
+ ```
114
+
115
+ ## Virtual Environment Management
116
+
117
+ ### Pattern 1: Creating Virtual Environments
118
+
119
+ ```bash
120
+ # Create virtual environment with uv
121
+ uv venv
122
+
123
+ # Create with specific Python version
124
+ uv venv --python 3.12
125
+
126
+ # Create with custom name
127
+ uv venv my-env
128
+
129
+ # Create with system site packages
130
+ uv venv --system-site-packages
131
+
132
+ # Specify location
133
+ uv venv /path/to/venv
134
+ ```
135
+
136
+ ### Pattern 2: Activating Virtual Environments
137
+
138
+ ```bash
139
+ # Linux/macOS
140
+ source .venv/bin/activate
141
+
142
+ # Windows (Command Prompt)
143
+ .venv\Scripts\activate.bat
144
+
145
+ # Windows (PowerShell)
146
+ .venv\Scripts\Activate.ps1
147
+
148
+ # Or use uv run (no activation needed)
149
+ uv run python script.py
150
+ uv run pytest
151
+ ```
152
+
153
+ ### Pattern 3: Using uv run
154
+
155
+ ```bash
156
+ # Run Python script (auto-activates venv)
157
+ uv run python app.py
158
+
159
+ # Run installed CLI tool
160
+ uv run black .
161
+ uv run pytest
162
+
163
+ # Run with specific Python version
164
+ uv run --python 3.11 python script.py
165
+
166
+ # Pass arguments
167
+ uv run python script.py --arg value
168
+ ```
169
+
170
+ ## Package Management
171
+
172
+ ### Pattern 4: Adding Dependencies
173
+
174
+ ```bash
175
+ # Add package (adds to pyproject.toml)
176
+ uv add requests
177
+
178
+ # Add with version constraint
179
+ uv add "django>=4.0,<5.0"
180
+
181
+ # Add multiple packages
182
+ uv add numpy pandas matplotlib
183
+
184
+ # Add dev dependency
185
+ uv add --dev pytest pytest-cov
186
+
187
+ # Add optional dependency group
188
+ uv add --optional docs sphinx
189
+
190
+ # Add from git
191
+ uv add git+https://github.com/user/repo.git
192
+
193
+ # Add from git with specific ref
194
+ uv add git+https://github.com/user/repo.git@v1.0.0
195
+
196
+ # Add from local path
197
+ uv add ./local-package
198
+
199
+ # Add editable local package
200
+ uv add -e ./local-package
201
+ ```
202
+
203
+ ### Pattern 5: Removing Dependencies
204
+
205
+ ```bash
206
+ # Remove package
207
+ uv remove requests
208
+
209
+ # Remove dev dependency
210
+ uv remove --dev pytest
211
+
212
+ # Remove multiple packages
213
+ uv remove numpy pandas matplotlib
214
+ ```
215
+
216
+ ### Pattern 6: Upgrading Dependencies
217
+
218
+ ```bash
219
+ # Upgrade specific package
220
+ uv add --upgrade requests
221
+
222
+ # Upgrade all packages
223
+ uv sync --upgrade
224
+
225
+ # Upgrade package to latest
226
+ uv add --upgrade requests
227
+
228
+ # Show what would be upgraded
229
+ uv tree --outdated
230
+ ```
231
+
232
+ ### Pattern 7: Locking Dependencies
233
+
234
+ ```bash
235
+ # Generate uv.lock file
236
+ uv lock
237
+
238
+ # Update lock file
239
+ uv lock --upgrade
240
+
241
+ # Lock without installing
242
+ uv lock --no-install
243
+
244
+ # Lock specific package
245
+ uv lock --upgrade-package requests
246
+ ```
247
+
248
+ ## Python Version Management
249
+
250
+ ### Pattern 8: Installing Python Versions
251
+
252
+ ```bash
253
+ # Install Python version
254
+ uv python install 3.12
255
+
256
+ # Install multiple versions
257
+ uv python install 3.11 3.12 3.13
258
+
259
+ # Install latest version
260
+ uv python install
261
+
262
+ # List installed versions
263
+ uv python list
264
+
265
+ # Find available versions
266
+ uv python list --all-versions
267
+ ```
268
+
269
+ ### Pattern 9: Setting Python Version
270
+
271
+ ```bash
272
+ # Set Python version for project
273
+ uv python pin 3.12
274
+
275
+ # This creates/updates .python-version file
276
+
277
+ # Use specific Python version for command
278
+ uv --python 3.11 run python script.py
279
+
280
+ # Create venv with specific version
281
+ uv venv --python 3.12
282
+ ```
283
+
284
+ ## Project Configuration
285
+
286
+ ### Pattern 10: pyproject.toml with uv
287
+
288
+ ```toml
289
+ [project]
290
+ name = "my-project"
291
+ version = "0.1.0"
292
+ description = "My awesome project"
293
+ readme = "README.md"
294
+ requires-python = ">=3.8"
295
+ dependencies = [
296
+ "requests>=2.31.0",
297
+ "pydantic>=2.0.0",
298
+ "click>=8.1.0",
299
+ ]
300
+
301
+ [project.optional-dependencies]
302
+ dev = [
303
+ "pytest>=7.4.0",
304
+ "pytest-cov>=4.1.0",
305
+ "black>=23.0.0",
306
+ "ruff>=0.1.0",
307
+ "mypy>=1.5.0",
308
+ ]
309
+ docs = [
310
+ "sphinx>=7.0.0",
311
+ "sphinx-rtd-theme>=1.3.0",
312
+ ]
313
+
314
+ [build-system]
315
+ requires = ["hatchling"]
316
+ build-backend = "hatchling.build"
317
+
318
+ [tool.uv]
319
+ dev-dependencies = [
320
+ # Additional dev dependencies managed by uv
321
+ ]
322
+
323
+ [tool.uv.sources]
324
+ # Custom package sources
325
+ my-package = { git = "https://github.com/user/repo.git" }
326
+ ```
327
+
328
+ ### Pattern 11: Using uv with Existing Projects
329
+
330
+ ```bash
331
+ # Migrate from requirements.txt
332
+ uv add -r requirements.txt
333
+
334
+ # Migrate from poetry
335
+ # Already have pyproject.toml, just use:
336
+ uv sync
337
+
338
+ # Export to requirements.txt
339
+ uv pip freeze > requirements.txt
340
+
341
+ # Export with hashes
342
+ uv pip freeze --require-hashes > requirements.txt
343
+ ```
344
+
345
+ For advanced workflows including Docker integration, lockfile management, performance optimization, tool comparison, common workflows, tool integration, troubleshooting, best practices, migration guides, and command reference, see [references/advanced-patterns.md](references/advanced-patterns.md)