Metadata-Version: 2.5
Name: yertle
Version: 0.4.0
Summary: Python ecosystem for Yertle — CLI, SDK, and tooling for the Yertle architecture-graph platform.
Project-URL: Homepage, https://github.com/model-context/yertle-python
Project-URL: Repository, https://github.com/model-context/yertle-python
Project-URL: Issues, https://github.com/model-context/yertle-python/issues
Author: Yertle
License: MIT License
        
        Copyright (c) 2026 model-context
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
License-File: LICENSE
Keywords: architecture,cli,graph,yertle
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: MacOS
Classifier: Operating System :: POSIX :: Linux
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Requires-Python: >=3.11
Requires-Dist: rich>=13.7
Requires-Dist: typer>=0.12
Requires-Dist: yertle-client<0.4.0,>=0.3.1
Provides-Extra: dev
Requires-Dist: diff-cover>=9.0; extra == 'dev'
Requires-Dist: pre-commit>=3.7; extra == 'dev'
Requires-Dist: pyright>=1.1.380; extra == 'dev'
Requires-Dist: pytest-asyncio>=0.23; extra == 'dev'
Requires-Dist: pytest-cov>=5.0; extra == 'dev'
Requires-Dist: pytest>=8.0; extra == 'dev'
Requires-Dist: ruff==0.15.13; extra == 'dev'
Requires-Dist: vulture>=2.11; extra == 'dev'
Provides-Extra: mcp
Requires-Dist: fastmcp>=2.0; extra == 'mcp'
Requires-Dist: httpx>=0.27; extra == 'mcp'
Provides-Extra: sre
Requires-Dist: langchain-anthropic>=0.3.0; extra == 'sre'
Requires-Dist: langchain-core>=0.3.0; extra == 'sre'
Requires-Dist: langchain>=1.0; extra == 'sre'
Requires-Dist: langgraph>=1.0; extra == 'sre'
Requires-Dist: pydantic-settings>=2.4; extra == 'sre'
Requires-Dist: pydantic>=2.7; extra == 'sre'
Requires-Dist: python-dotenv>=1.0; extra == 'sre'
Description-Content-Type: text/markdown

# yertle-python

Python ecosystem for [Yertle](https://yertle.com) — CLI, SDK, and tooling for
working with Yertle architecture graphs from Python.

## Install

The CLI is distributed on PyPI and installed with
[`uv`](https://docs.astral.sh/uv/):

```bash
uv tool install yertle
```

That puts `yertle` on your PATH:

| | |
|---|---|
| Find your way around | `orgs list`, `orgs show`, `orgs use`, `nodes list`, `nodes tree` |
| Inspect | `nodes show`, `nodes search`, `branches list` |
| Change things | `nodes create`, `nodes apply`, `branches create`, `branches delete` |
| Everything else | `about`, `version`, `login`, `auth status` |

Editing a node is a read-edit-write round trip, like `git`:

```bash
yertle nodes show <id> --format json > node.json
# ...edit node.json...
yertle nodes apply -f node.json -m "what changed"
```

A push replaces the node's whole state, so `apply` prints a diff every time,
refuses a change that removes anything unless you pass `--allow-deletes`, and
will not accept a document that was not produced by a read.

Two optional extras ship alongside it, neither needed for the CLI:

| Extra | What it adds |
|---|---|
| `yertle[sre]` | `yertle-sre`, a natural-language SRE agent (~37MB more) |
| `yertle[mcp]` | the MCP server — launched by MCP hosts, not installed by you |

The MCP server is deliberately **not** part of a tool install. MCP hosts launch
it themselves, so it never needs to sit on your PATH — point your host at
`uvx`, which resolves and runs it on demand:

```json
{
  "mcpServers": {
    "yertle": {
      "command": "uvx",
      "args": ["--from", "yertle[mcp]", "yertle-mcp"],
      "env": { "YERTLE_TOKEN": "yrt_..." }
    }
  }
}
```

Every command lands on your PATH regardless of which extras you pick — Python
entry points are not conditional on extras. So a plain `uv tool install yertle`
still creates `yertle-sre` and `yertle-mcp`. Running one tells you which extra
it needs rather than failing obscurely:

```
$ yertle-sre
yertle-sre requires the [sre] extra. Install with: pip install 'yertle[sre]'
```

So install the extras you want to *use*, not the ones you want to see.
`pipx install yertle` works too.

To upgrade later, `uv tool upgrade yertle`. That only works if you installed
without pinning a version — `uv tool install "yertle==0.3.0"` records
the pin as the requirement, and upgrades then have nothing to move to.
Reinstall with `uv tool install --force yertle` to unpin.

Verify:

```bash
yertle version
yertle auth status     # shows which API URL and token are in effect
```

### Using it as a library

`uv tool install` gives you the **command**, not the library. It puts the
package in an isolated environment and links only the entry points onto your
PATH, so `import yertle` in a script will not find it:

```console
$ uv tool install yertle && yertle version
0.3.0
$ python -c "import yertle"
ModuleNotFoundError: No module named 'yertle'
```

That is how `uv tool` is meant to work, not a packaging mistake. To use the
SDK, install into the project that imports it:

```bash
uv add yertle               # or: pip install yertle
```

That direction gives you both — `import yertle` in your code, and the CLI via
`uv run yertle`. Installing as a tool as well is only worth it if you want
`yertle` available outside the project.

```python
import yertle

yertle.configure(token="yrt_...")
for org in yertle.orgs.list():
    print(org.name)
```

Credentials resolve from `$YERTLE_TOKEN` then `~/.yertle/config.json`; the API
URL from `$YERTLE_API_URL`, then the config file, then `https://api.yertle.com`.
`yertle auth status` reports which source won for each.

## Development

Requires [`uv`](https://docs.astral.sh/uv/) and Python 3.11+.

```bash
make install        # uv sync --extra sre --extra mcp --extra dev
make check          # lint + format-check + typecheck + test
```

See `make help` for the full target list.

## License

MIT. See [LICENSE](./LICENSE).
