Skip to content

Commit

Permalink
fix deps
Browse files Browse the repository at this point in the history
  • Loading branch information
jsbroks committed Nov 13, 2024
1 parent 4407ade commit 64fe80c
Show file tree
Hide file tree
Showing 116 changed files with 36 additions and 9,564 deletions.
39 changes: 27 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
# ctrlplane-api-client

A client library for accessing Ctrlplane API

## Usage

First, create a client:

```python
Expand Down Expand Up @@ -47,7 +49,7 @@ By default, when you're calling an HTTPS API it will attempt to verify that SSL

```python
client = AuthenticatedClient(
base_url="https://internal_api.example.com",
base_url="https://internal_api.example.com",
token="SuperSecretToken",
verify_ssl="/path/to/certificate_bundle.pem",
)
Expand All @@ -57,18 +59,20 @@ You can also disable certificate validation altogether, but beware that **this i

```python
client = AuthenticatedClient(
base_url="https://internal_api.example.com",
token="SuperSecretToken",
base_url="https://internal_api.example.com",
token="SuperSecretToken",
verify_ssl=False
)
```

Things to know:

1. Every path/method combo becomes a Python module with four functions:
1. `sync`: Blocking request that returns parsed data (if successful) or `None`
1. `sync_detailed`: Blocking request that always returns a `Request`, optionally with `parsed` set if the request was successful.
1. `asyncio`: Like `sync` but async instead of blocking
1. `asyncio_detailed`: Like `sync_detailed` but async instead of blocking

1. `sync`: Blocking request that returns parsed data (if successful) or `None`
1. `sync_detailed`: Blocking request that always returns a `Request`, optionally with `parsed` set if the request was successful.
1. `asyncio`: Like `sync` but async instead of blocking
1. `asyncio_detailed`: Like `sync_detailed` but async instead of blocking

1. All path/query params, and bodies become method arguments.
1. If your endpoint had any tags on it, the first tag will be used as a module name for the function (my_tag above)
Expand Down Expand Up @@ -110,15 +114,26 @@ client.set_httpx_client(httpx.Client(base_url="https://api.example.com", proxies
```

## Building / publishing this package
This project uses [Poetry](https://python-poetry.org/) to manage dependencies and packaging. Here are the basics:

This project uses [Poetry](https://python-poetry.org/) to manage dependencies and packaging. Here are the basics:

1. Update the metadata in pyproject.toml (e.g. authors, version)
1. If you're using a private repository, configure it with Poetry
1. `poetry config repositories.<your-repository-name> <url-to-your-repository>`
1. `poetry config http-basic.<your-repository-name> <username> <password>`
1. `poetry config repositories.<your-repository-name> <url-to-your-repository>`
1. `poetry config http-basic.<your-repository-name> <username> <password>`
1. Publish the client with `poetry publish --build -r <your-repository-name>` or, if for public PyPI, just `poetry publish --build`

If you want to install this client into another project without publishing it (e.g. for development) then:

1. If that project **is using Poetry**, you can simply do `poetry add <path-to-this-client>` from that project
1. If that project is not using Poetry:
1. Build a wheel with `poetry build -f wheel`
1. Install that wheel from the other project `pip install <path-to-wheel>`
1. Build a wheel with `poetry build -f wheel`
1. Install that wheel from the other project `pip install <path-to-wheel>`

# Generate the client from the OpenAPI spec

```bash
openapi-python-client generate \
--output-path . \
--url https://raw.githubusercontent.com/ctrlplanedev/ctrlplane/refs/heads/main/openapi.v1.json
```
23 changes: 0 additions & 23 deletions ctrlplane-api-client/.gitignore

This file was deleted.

124 changes: 0 additions & 124 deletions ctrlplane-api-client/README.md

This file was deleted.

8 changes: 0 additions & 8 deletions ctrlplane-api-client/ctrlplane_api_client/__init__.py

This file was deleted.

1 change: 0 additions & 1 deletion ctrlplane-api-client/ctrlplane_api_client/api/__init__.py

This file was deleted.

Empty file.
Loading

0 comments on commit 64fe80c

Please sign in to comment.