can-they-merge (ctm)
Can these Python dependency sets merge into one environment? And if not, into how few?
Researchers constantly stitch together frameworks, benchmarks, and baselines —
each with its own requirements.txt, pyproject.toml, or conda
environment.yaml. ctm answers two questions using real resolvers for
ground truth:
ctm merge— do all these inputs co-resolve into a single environment?ctm partition— when they don't, what is the minimum number of environments needed to cover a set of components/entrypoints?
ctm is a small, pure-Python tool (3.9+) that brings its own resolvers: it
fetches pinned uv (PyPI) and
micromamba (conda) binaries on first use, so
you don't have to install or manage them.
Install
pip install can-they-merge # or: uv tool install can-they-merge
ctm setup # fetch the bundled uv + micromamba resolvers
ctm setup is optional — the resolvers are also fetched automatically on first
use. For air-gapped clusters, run ctm setup on a connected machine and
copy the cache dir, or pre-stage the binaries and install from them:
ctm setup --from-dir /path/to/prestaged/bin
# or point at an existing location:
export CTM_BIN_DIR=/shared/tools/ctm-bin
Usage
Can they merge?
ctm merge requirements.txt pyproject.toml environment.yaml
NOT MERGEABLE ✗ (target: pypi)
- numpy: <1.20 & >=1.24
resolver said:
× No solution found... Because you require numpy<1.20 and numpy>=1.24...
- Mix formats freely (auto-detected by extension).
--target pypi(default, usesuv) or--target conda(usesmicromamba).--jsonfor a machine-readable report. Exit codes:0mergeable,1not mergeable,3resolver unavailable.
Minimum number of environments
Pass one dependency file per component:
ctm partition reqs-train.txt reqs-deploy.txt reqs-util.txt --exact
2 environment(s) needed [minimum]:
env 1: reqs-deploy, reqs-util
env 2: reqs-train
--exactproves the count is the true minimum (branch-and-bound; ≤8 components). Without it, a sound greedy partition is returned and labeled as not-proven-minimal.
How it works
- Ground truth from real resolvers.
ctm mergeresolves the union withuv/micromamba; a pure-Python specifier pre-check supplies readable conflict explanations and catches obvious cases without a resolver call. - Partitioning builds a conflict graph (no resolver calls), then a greedy-with-validation pass (every emitted environment is resolver-checked, so it's sound), with an optional exact branch-and-bound that memoizes every resolution to prove minimality.
- Over-approximate reachability (library:
can_they_merge.reachability) statically maps entrypoints to the distributions they need, erring toward including a package rather than dropping it.
Configuration
| Env var | Purpose |
|---|---|
CTM_BIN_DIR |
Where bundled binaries live (default: per-user cache) |
CTM_NO_FETCH=1 |
Never auto-download; require ctm setup / PATH |
CTM_UV_VERSION, CTM_MICROMAMBA_VERSION |
Pin resolver versions |
CTM_UV_BASE_URL, CTM_MICROMAMBA_BASE_URL |
Mirror / offline sources |
Development
uv sync
uv run pytest -q # unit tests, no network
uv run pytest -q -m integration # drives real uv against verified fixtures
uv run ruff check src tests
Design spec: docs/superpowers/specs/2026-06-11-can-it-merge-design.md.
License
MIT © Daniel Hou
Metadata
Release files for can-they-merge 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| can_they_merge-0.1.0.tar.gz | 22.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| can_they_merge-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 50.2 kB
Release files / can_they_merge-0.1.0.tar.gz
| Download URL | can_they_merge-0.1.0.tar.gz |
|---|---|
| Size | 22.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
224f5504001d472ba554b70c71be32617ee88b7e2775c6ee2c4ec49ee46deb1f
|
|
BLAKE2b-256 checksum How to use checksums |
72050d3c19805b9844ad3218c7ee72e4005b6d673d4867538f68f9f76f34d53d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.8
|
Release files / can_they_merge-0.1.0-py3-none-any.whl
| Download URL | can_they_merge-0.1.0-py3-none-any.whl |
|---|---|
| Size | 28.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4c276d5ddd2938d655f9cff0527acddfa82c65c1a7ebe269e983c7d95fa1d2f6
|
|
BLAKE2b-256 checksum How to use checksums |
409da7d227da489c1e94670e82927f8dd522c078bf25f51b1b9ce1f774c82681
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.8
|