# DSPy Profiles
[](https://pypi.org/project/dspy-profiles/)
[](https://pypi.org/project/dspy-profiles/)
[](https://pypi.org/project/dspy-profiles/)
[](https://nielsgl.github.io/dspy-profiles/)
[](https://github.com/nielsgl/dspy-profiles/actions/workflows/tests.yml)
[](https://codecov.io/gh/nielsgl/dspy-profiles)
[](https://opensource.org/licenses/MIT)
[](https://github.com/astral-sh/uv)
[](https://github.com/psf/black)
[](https://github.com/astral-sh/ruff)
[](https://github.com/nielsgl/dspy-profiles/pulse)
**A companion tool for the [DSPy framework](https://github.com/stanfordnlp/dspy) to manage configuration profiles, inspired by the AWS CLI.**
`dspy-profiles` allows you to define, switch between, and manage different DSPy configurations for various environments (e.g., development, staging, production) without cluttering your code.
---
## The Problem
When working with DSPy, you often need to switch between different language models, retrieval models, and settings. Managing this directly in your code can be messy, error-prone, and insecure.
## The Solution
`dspy-profiles` moves this configuration out of your code and into a simple `profiles.toml` file. It provides a powerful CLI and a clean Python API to manage and use these profiles seamlessly. The tool will automatically find your `profiles.toml` whether it's in your local project directory or in the global `~/.dspy/` folder.
---
## Key Features
- **Declarative Profiles**: Define all your environment settings in a clear, human-readable TOML file.
- **Powerful CLI**: A rich command-line interface lets you manage your profiles without ever leaving the terminal.
- **Seamless Python API**: Activate profiles in your Python code with an elegant and intuitive API.
- **Profile Inheritance**: Create base profiles and extend them for different environments to avoid repetition.
- **Environment Precedence**: A clear and predictable activation logic ensures the right profile is always used.
- **Validation & Testing**: `validate` and `test` commands to ensure your profiles are correct and your models are reachable.
---
## Installation
```bash
# With pip
pip install dspy-profiles
# With uv
uv add dspy-profiles
# Or run it directly without installation
uvx dspy-profiles --help
# Or as a tool in your cli
uv tool install dspy-profiles
dspy-profiles --help
```
## Quickstart
1. **Initialize a default profile interactively:**
```bash
dspy-profiles init
```
This will prompt you for your language model and optionally your API key and API base.
2. **Use it in your Python code:**
```python
import dspy
from dspy_profiles import profile
with profile("default"):
# Your DSPy code here, now using the settings from your 'default' profile.
predictor = dspy.Predict("question -> answer")
response = predictor(question="What is the capital of France?")
print(response.answer)
```
3. **Run any script with a profile, without changing your code:**
```bash
# The new, convenient way to run any script with a profile
dspy-run my_script.py
# Specify a different profile, or run non-python commands
dspy-run --profile production -- pytest
```
---
## Full Documentation
For a complete guide, including advanced features and the full API and CLI reference, please visit the **[official documentation site](https://nielsgl.github.io/dspy-profiles/)**.
---
## Project Status & Roadmap
The project is under active development. All core features are implemented and stable.
- **[x] Phase 1: DX, Packaging & Documentation**: Professional PyPI packaging, CI/CD, and a full documentation site.
- **[x] Phase 2: Core CLI & Env Var Enhancements**: `import`, `diff`, `run`, and robust activation precedence.
- **[x] Phase 3: Advanced Profile Features**: Profile composition (`extends`), inline overrides, and `validate`/`test` commands.
- **[x] Phase 4: Python API & Runtime Utilities**: Programmatic shortcuts like `lm()` and runtime introspection with `current_profile()`.
- **[x] Phase 5: Developer Experience Overhaul**: A major refactor of the CLI, API, and documentation for clarity, stability, and ease of use.
- **[x] Phase 6: QoL & Advanced Workflows**: An interactive `init` wizard, profile import/export, and async-friendly decorators.
See the [PROJECT.md](PROJECT.md) file for detailed specifications.
## Contributing
Contributions are welcome! Please open an issue or submit a pull request.
## Notes
Here some notes.
Raw data
{
"_id": null,
"home_page": null,
"name": "dspy-profiles",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.12",
"maintainer_email": null,
"keywords": "dspy, llm, configuration, profiles, ai",
"author": "Niels van Galen Last",
"author_email": "Niels van Galen Last <nvangalenlast@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/a2/5c/7faaa49b3656fd2ba785580c0b5ab980b78f00e2cc1de3009353155a84fa/dspy_profiles-0.2.2.tar.gz",
"platform": null,
"description": "# DSPy Profiles\n\n[](https://pypi.org/project/dspy-profiles/)\n[](https://pypi.org/project/dspy-profiles/)\n[](https://pypi.org/project/dspy-profiles/)\n[](https://nielsgl.github.io/dspy-profiles/)\n[](https://github.com/nielsgl/dspy-profiles/actions/workflows/tests.yml)\n[](https://codecov.io/gh/nielsgl/dspy-profiles)\n[](https://opensource.org/licenses/MIT)\n[](https://github.com/astral-sh/uv)\n[](https://github.com/psf/black)\n[](https://github.com/astral-sh/ruff)\n[](https://github.com/nielsgl/dspy-profiles/pulse)\n\n**A companion tool for the [DSPy framework](https://github.com/stanfordnlp/dspy) to manage configuration profiles, inspired by the AWS CLI.**\n\n`dspy-profiles` allows you to define, switch between, and manage different DSPy configurations for various environments (e.g., development, staging, production) without cluttering your code.\n\n---\n\n## The Problem\n\nWhen working with DSPy, you often need to switch between different language models, retrieval models, and settings. Managing this directly in your code can be messy, error-prone, and insecure.\n\n## The Solution\n\n`dspy-profiles` moves this configuration out of your code and into a simple `profiles.toml` file. It provides a powerful CLI and a clean Python API to manage and use these profiles seamlessly. The tool will automatically find your `profiles.toml` whether it's in your local project directory or in the global `~/.dspy/` folder.\n\n---\n\n## Key Features\n\n- **Declarative Profiles**: Define all your environment settings in a clear, human-readable TOML file.\n- **Powerful CLI**: A rich command-line interface lets you manage your profiles without ever leaving the terminal.\n- **Seamless Python API**: Activate profiles in your Python code with an elegant and intuitive API.\n- **Profile Inheritance**: Create base profiles and extend them for different environments to avoid repetition.\n- **Environment Precedence**: A clear and predictable activation logic ensures the right profile is always used.\n- **Validation & Testing**: `validate` and `test` commands to ensure your profiles are correct and your models are reachable.\n\n---\n\n## Installation\n\n```bash\n# With pip\npip install dspy-profiles\n\n# With uv\nuv add dspy-profiles\n\n# Or run it directly without installation\nuvx dspy-profiles --help\n\n# Or as a tool in your cli\nuv tool install dspy-profiles\ndspy-profiles --help\n```\n\n## Quickstart\n\n1. **Initialize a default profile interactively:**\n ```bash\n dspy-profiles init\n ```\n This will prompt you for your language model and optionally your API key and API base.\n\n2. **Use it in your Python code:**\n ```python\n import dspy\n from dspy_profiles import profile\n\n with profile(\"default\"):\n # Your DSPy code here, now using the settings from your 'default' profile.\n predictor = dspy.Predict(\"question -> answer\")\n response = predictor(question=\"What is the capital of France?\")\n print(response.answer)\n ```\n\n3. **Run any script with a profile, without changing your code:**\n ```bash\n # The new, convenient way to run any script with a profile\n dspy-run my_script.py\n\n # Specify a different profile, or run non-python commands\n dspy-run --profile production -- pytest\n ```\n\n---\n\n## Full Documentation\n\nFor a complete guide, including advanced features and the full API and CLI reference, please visit the **[official documentation site](https://nielsgl.github.io/dspy-profiles/)**.\n\n---\n\n## Project Status & Roadmap\n\nThe project is under active development. All core features are implemented and stable.\n\n- **[x] Phase 1: DX, Packaging & Documentation**: Professional PyPI packaging, CI/CD, and a full documentation site.\n- **[x] Phase 2: Core CLI & Env Var Enhancements**: `import`, `diff`, `run`, and robust activation precedence.\n- **[x] Phase 3: Advanced Profile Features**: Profile composition (`extends`), inline overrides, and `validate`/`test` commands.\n- **[x] Phase 4: Python API & Runtime Utilities**: Programmatic shortcuts like `lm()` and runtime introspection with `current_profile()`.\n- **[x] Phase 5: Developer Experience Overhaul**: A major refactor of the CLI, API, and documentation for clarity, stability, and ease of use.\n- **[x] Phase 6: QoL & Advanced Workflows**: An interactive `init` wizard, profile import/export, and async-friendly decorators.\n\nSee the [PROJECT.md](PROJECT.md) file for detailed specifications.\n\n## Contributing\n\nContributions are welcome! Please open an issue or submit a pull request.\n\n## Notes\n\nHere some notes.\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Add support for DSPy profiles",
"version": "0.2.2",
"project_urls": {
"Homepage": "https://github.com/nielsgl/dspy-profiles",
"Repository": "https://github.com/nielsgl/dspy-profiles"
},
"split_keywords": [
"dspy",
" llm",
" configuration",
" profiles",
" ai"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "604bef665d3c4c7d0d8fa0374507b6d11e86760bc1d1e5d2d7269334d269abd8",
"md5": "18275cd46012e8e34a06e6a9eaf447e4",
"sha256": "846ecb80856f2f9314f78e191fc199eadc25f18c076147f39b5d3a18b6902f14"
},
"downloads": -1,
"filename": "dspy_profiles-0.2.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "18275cd46012e8e34a06e6a9eaf447e4",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.12",
"size": 24226,
"upload_time": "2025-09-01T12:21:07",
"upload_time_iso_8601": "2025-09-01T12:21:07.442398Z",
"url": "https://files.pythonhosted.org/packages/60/4b/ef665d3c4c7d0d8fa0374507b6d11e86760bc1d1e5d2d7269334d269abd8/dspy_profiles-0.2.2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "a25c7faaa49b3656fd2ba785580c0b5ab980b78f00e2cc1de3009353155a84fa",
"md5": "b31c0b98cafb119ea882e1f7a659386b",
"sha256": "ef1efc8c5eb643d060c1e473791d9e218cb46081ee99e2bca18e40a809757605"
},
"downloads": -1,
"filename": "dspy_profiles-0.2.2.tar.gz",
"has_sig": false,
"md5_digest": "b31c0b98cafb119ea882e1f7a659386b",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.12",
"size": 16599,
"upload_time": "2025-09-01T12:21:08",
"upload_time_iso_8601": "2025-09-01T12:21:08.659745Z",
"url": "https://files.pythonhosted.org/packages/a2/5c/7faaa49b3656fd2ba785580c0b5ab980b78f00e2cc1de3009353155a84fa/dspy_profiles-0.2.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-09-01 12:21:08",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "nielsgl",
"github_project": "dspy-profiles",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "dspy-profiles"
}