Metadata-Version: 2.5
Name: outerport
Version: 0.13.0
Summary: Outerport Python SDK
Project-URL: Homepage, https://outerport.com
Project-URL: Documentation, https://docs.outerport.com
Author-email: "Outerport (Genban, Inc.)" <support@outerport.com>
License: Apache Software License
License-File: LICENSE
Keywords: api,outerport,sdk
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Requires-Python: >=3.8
Requires-Dist: aiohttp>=3.10.11
Requires-Dist: pydantic>=2.10.6
Requires-Dist: requests>=2.32.3
Requires-Dist: sseclient>=0.0.27
Description-Content-Type: text/markdown

# Outerport Python SDK

## Installation

```
pip install "outerport>=0.13"
```

or 

```
uv add "outerport>=0.13"
```

Version 0.13 is the first to install the `outerport` command (see below); earlier versions hold only the client.

## Usage

```
from outerport import OuterportClient

client = OuterportClient(
    api_key="your_api_key",
    base_url="https://api.outerport.com"
)
```

## The `outerport` command

Installing version 0.13 or later installs `outerport`, which builds engineering models on Outerport from a folder
on your machine: you (or a coding agent such as Claude Code) write the model's Python files there, and Outerport compiles,
draws, reviews, simulates and tests them, then hosts the project at a link that opens in a browser.

```
outerport login --url https://api.outerport.com --key <your API key>
outerport skill                      # how to write a model: give this to your coding agent
outerport examples                   # the example models: panels and plants, boards, 3D assemblies
outerport example hpu                # writes a folder example's files under ./hpu/
outerport library                    # the modeling library, to import and type-check models against here
outerport compile panels/pump.py     # its documents, sheets and errors; an assembly's problems and motions
outerport render panels/pump.py --sheet 2 -o control.png
outerport review panels/pump.py      # the design rules a panel, plant, board or 3D assembly does not pass
outerport simulate scenarios/start.toml  # one scenario file against the project's models
outerport test                       # every scenario under scenarios/
outerport deploy --name pump-panel   # prints the project's link
```

`OUTERPORT_API_URL` and `OUTERPORT_API_KEY` take the place of `login`. A failed compile, review or scenario exits
with status 1, a refused request with 2. `outerport --help` lists every command.

A coding agent that can run shell commands runs the build loop with this command, not with the Outerport MCP
server's tools: the command reads the project's files from disk, where each tool call has to carry them.

For a 3D assembly, `compile` prints each motion (the parts it turns or slides, its travel, and the connector
whose axis it turns about or slides along) and each problem Outerport found: assembly order, mate and design
problems. These do not change its exit status, and
`compile` does not sweep motions for collisions. `review` holds a 3D assembly only to the rules that need no
geometry (every part states a process or is a bought part with a specification, and an assembly that states
mates names its ground part), and its last line names what it does not check.

`outerport example <name>` prints a single-file example, or writes it to the file `-o` names. A folder example
is a package of several files: they are written at their paths under the current folder, or under the folder
`-o` names.

`outerport library` writes the modeling library, `op_simulation` with `op_simulation.model`, under the project's
`.outerport/python` folder, or under the folder `-o` names, and prints the Python version and the `pip install`
line it needs. With that folder on `PYTHONPATH` and on your editor's extra paths, models import, complete and
type-check on your machine; they still simulate only on Outerport. The folder is hidden, so no command sends it
with the project. Running it again replaces an `op_simulation` folder it wrote, and refuses one it did not.

## Development

### Setting Up Development Environment

```bash
# Clone the repository
git clone https://github.com/outerport/outerport.git
cd outerport/outerport-python

# Install development dependencies
pip install -e ".[dev]"
```

### Running Tests

```bash
# Run all tests
pytest

# Run only unit tests
pytest tests/unit

# Run with coverage report
pytest --cov=outerport
```

Integration tests need an API key:

```bash
export OUTERPORT_API_KEY="your_api_key"
pytest tests/integration
```

See [tests/README.md](tests/README.md) for more on testing.

