Installation Configuration¶
The dm CLI supports customizing how packages are installed from cloned repositories
through configuration in pyproject.toml.
Basic Configuration¶
You can configure installation settings for each repository under:
[tool.django-mongodb-cli.install.<repo-name>]
Custom Install Directory¶
If a package needs to be installed from a subdirectory (common with monorepos):
[tool.django-mongodb-cli.install.mongo-arrow]
install_dir = "bindings/python"
This will install from src/mongo-arrow/bindings/python instead of src/mongo-arrow.
Environment Variables¶
You can set environment variables for the installation process:
[tool.django-mongodb-cli.install.mongo-arrow]
install_dir = "bindings/python"
[[tool.django-mongodb-cli.install.mongo-arrow.env_vars]]
name = "LDFLAGS"
value = "-L/opt/homebrew/opt/mongo-c-driver@1/lib"
[[tool.django-mongodb-cli.install.mongo-arrow.env_vars]]
name = "CPPFLAGS"
value = "-I/opt/homebrew/opt/mongo-c-driver@1/include"
Optional Extras¶
You can install optional extras (also known as optional dependencies) defined in the
package’s [project.optional-dependencies] section:
[tool.django-mongodb-cli.install.some-package]
extras = ["security", "performance"]
This will run:
uv pip install -e src/some-package(base package)uv pip install -e src/some-package[security](security extra)uv pip install -e src/some-package[performance](performance extra)
The extras option is useful when:
The package has optional features that require additional dependencies
You need specific functionality that’s not included in the base installation
You want to install testing or development extras
Dependency Groups (PEP 735)¶
You can install dependency groups defined in the package’s pyproject.toml using
the PEP 735 standard:
[tool.django-mongodb-cli.install.langchain-mongodb]
install_dir = "libs/langchain-mongodb"
groups = ["dev", "test"]
This will run:
uv pip install -e src/langchain-mongodb/libs/langchain-mongodb(base package)pip install --group src/langchain-mongodb/libs/langchain-mongodb/pyproject.toml:dev(dev group)pip install --group src/langchain-mongodb/libs/langchain-mongodb/pyproject.toml:test(test group)
The groups option uses pip install --group (available in pip 25.3+) to install
dependency groups defined in [dependency-groups] section of the package’s pyproject.toml
according to PEP 735.
The groups option is useful when:
You need development dependencies from the package
You want to run tests that require test dependencies
The package defines multiple dependency groups for different use cases
Combining Extras and Groups¶
You can use both extras and groups together:
[tool.django-mongodb-cli.install.langchain-mongodb]
install_dir = "libs/langchain-mongodb"
extras = ["community"]
groups = ["dev", "test"]
This will install:
Base package
All specified extras (using
pip install -e path[extra])All specified dependency groups (using
pip install --group)
Example: langchain-mongodb¶
Here’s a complete example for configuring langchain-mongodb:
[tool.django-mongodb-cli.install.langchain-mongodb]
install_dir = "libs/langchain-mongodb"
extras = ["community"]
groups = ["dev", "test", "lint"]
This configuration assumes langchain-mongodb has a pyproject.toml with:
[project.optional-dependencies]
community = ["langchain-community>=0.3.0"]
[dependency-groups]
dev = ["pytest", "ruff", "mypy"]
test = ["pytest-cov", "pytest-asyncio"]
lint = ["ruff", "mypy"]
When you run:
dm repo install langchain-mongodb
The CLI will:
Install the base package from
src/langchain-mongodb/libs/langchain-mongodbInstall the
communityextra usinguv pip install -e path[community]Install the
devdependency group usingpip install --groupInstall the
testdependency group usingpip install --groupInstall the
lintdependency group usingpip install --group
Note: Dependency groups require pip 25.3 or later, which supports PEP 735.
Benefits¶
Automated setup: Install all required dependencies in one command
Reproducible environments: Ensure all team members have the same dependencies
Developer convenience: No need to manually install optional groups
CI/CD integration: Use the same command in automated pipelines