Metadata-Version: 2.1
Name: architect-py
Version: 2.0.0b2
Summary: Client library for the Architect trading platform.
Author: Architect Financial Technologies, Inc.
Author-email: hello@architect.xyz
Requires-Python: >=3.8,<4
Classifier: Development Status :: 3 - Alpha
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Operating System :: OS Independent
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
Classifier: Programming Language :: Python :: 3.12
Requires-Dist: asyncio (>=3,<4)
Requires-Dist: dnspython (>=2,<3)
Requires-Dist: gql[all] (>=3.5.0,<4.0.0)
Requires-Dist: grpcio (>=1.66.1,<2.0.0)
Requires-Dist: httpx (>=0.27.0,<0.28.0)
Requires-Dist: msgspec (>=0.18.6,<0.19.0)
Requires-Dist: orjson (>=3,<4)
Requires-Dist: pydantic (>=2.6.4,<3.0.0)
Requires-Dist: websockets (>=11,<12)
Description-Content-Type: text/markdown

# architect_py

## Example usage

```python
import asyncio
from architect_py.async_client import AsyncClient


async def main():
    c = AsyncClient(
        host="<your installation domain>",
        api_key="<api key>",
        api_secret="<api secret>"
    )
    print(await c.execute("query { me { userId email } }"))
    s = c.subscribe_trades("BTC Crypto/USD*COINBASE/DIRECT")
    async for trade in s:
        print(trade)


asyncio.run(main())
```

## Running additional examples from this package

Clone this repository to run examples in the `examples` directory.  This package
uses poetry for dependency management.  To enter a poetry virtual environment, make
sure you have [poetry](https://python-poetry.org/docs/) installed and run the 
following from the repository root.

```bash
poetry shell
poetry install --sync 

export ARCHITECT_HOST="<your installation domain>"
export ARCHITECT_API_KEY="<api key>"
export ARCHITECT_API_SECRET="<api secret>"

python -m examples.trades
```

You can exit the poetry shell by running `exit`.  Environment variables set
within the shell are not persisted.

## Maintainers

Python type conversions for scalars should be added to the codegen toml files, if needed.

Important files:
- `schema.graphql`: autogenerated from `architect-gql schema`
- `queries.graphql`: add any new queries/mutations
- `generate_protocol.py`: autogenerates the `architect_py/protocol/client_protocol.py`
- `architect_py/protocol/client_protocol.py`: autogenerated from `generate_protocol.py`, contains the class that the sync client inherits from
- `architect_py/async_client.py`: inherits from the ariadne generated base client
- `architect_py/client.py`: contains the sync client, delegates functions calls to a composed AsyncClient in the innards, inherits from the client_protocl to give the correct type hinting from Pylance
- `tests` and `examples`: self-explanatory

On any update, please run `update.sh`

In addition, any new function should have a test included in test.py

To run tests:
`export $(cat pytest.env | xargs)`
`pytest tests/*`


### What does `update.sh` do?

1. Uses ariadne-codegen to generate the async client
2. Autogenerates the protocol that the sync client inherits from
3. Runs the tests


