Because broken docs leave a bitter taste.
Dolce is a tool designed to help you maintain high-quality docstrings/documentation in your Python code. In addition, it leverages Large Language Models (LLMs) to ensure that your docstrings are semantically consistent with your code.
Note
Dolce is still in early development. While it is functional, some features are yet to be implemented and improvements are ongoing. Your feedback and contributions are highly appreciated!
Check docstrings issues with static and LLM-powered rules:
Suggest missing docstrings by leveraging LLMs:
Restyle your entire codebase docstrings to a consistent format:
-
Comprensive Rule Set: Comes with a variety of built-in rules to check for common docstring issues, including: Static rules:
- Missing docstrings
- Incomplete parameter documentation
- Signature mismatches .. etc
and LLM-powered rules:
- Consistency between code and docstring
- Detection of undocumented critical behaviors ... etc
-
Generation docstrings: Generate missing docstrings across your codebase (with the help of LLMs) by running a single command.
-
Restyling: Automatically restyle your existing docstrings to a consistent format (Google, NumPy, ReST, Epy, etc.).
-
Cache system: Avoid re-checking unchanged code.
-
Customizable: Easily configure which rules to apply, LLMs config (model, provider, url, etc.), and other settings via a
pyproject.tomlfile.
... more features coming soon!
You can install dolce globally via pip:
pip install pydolceHowever, the recommended use is to install it as a dev dependency in your project environment. If you are using uv for managing your Python projects, you can add it to your pyproject.toml like this:
uv add pydolce --group devDon't forget to sync:
uv sync --all-groups
Then you can use it by running:
uv run dolce [COMMAND]dolce check [PATH] # If no PATH is provided it will check the current directorydolce suggest [PATH] # If no PATH is provided it will run in the current directorydolce rulesDolce can be configured via pyproject.toml file. You can specify which rules to check and which to ignore. By default it will check all rules.
[tool.dolce]
target = [
# Set of rules to check
"DCE101",
]
disable = [
# Set of rules to ignore
"DCE102",
]By default dolce does not make use of LLM features (like smart check rules or doccstring suggestions). To enable them you need to configure the LLM options in the pyproject.toml file like this:
[tool.dolce]
url = "http://localhost:11434"
model = "qwen3:8b"
provider = "ollama"
api_key = "YOUR_API_KEY_ENVIROMENT_VAR" # Optional, needed for non local providersTip
qwen3:8b has relatively good performance while fitting in an RTX 4060 GPU (8GB VRAM)
You can visit the Ollama to check how to install and run models locally.
- Support for ignoring specific code segments, files, directories, etc
- Support parallel requests ... much more!
Make sure you have the following tools installed before working with the project:
Install dependencies into a local virtual environment:
uv sync --all-groupsThis will create a .venv folder and install everything declared in pyproject.toml.
Then, you can activate the environment manually depending on your shell/OS:
-
Linux / macOS (bash/zsh):
source .venv/bin/activate -
Windows (PowerShell):
.venv\Scripts\Activate.ps1
-
Windows (cmd.exe):
.venv\Scripts\activate.bat
uv run dolce check path/to/your/codemake qaRuns Ruff for linting and formatting, and Mypy for type checking.
Before running tests, override any required environment variables in the .env.test file.
make testExecutes the test suite using Pytest.
make buildGenerates a distribution package inside the dist/ directory.
make cleanRemoves build artifacts, caches, and temporary files to keep your project directory clean.
make docsGenerates the project documentation inside the dist/docs folder.
When building the project (make build) the docs will also be generated automatically and
included in the distribution package.
Contributions are welcome! Please ensure all QA checks and tests pass before opening a pull request.
🚀 Project starter provided by Cookie Pyrate