Skip to content

release: 1.28.0 #18

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 19 commits into from
Nov 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
91b3d5c
feat(client): improve file upload types (#3)
stainless-bot Oct 24, 2023
62c25f6
feat(client): adjust retry behavior to be exponential backoff (#4)
stainless-bot Oct 24, 2023
810f4b0
ci: add lint workflow (#5)
stainless-bot Oct 24, 2023
04d94d2
feat(client): improve retry behaviour (#6)
stainless-bot Oct 24, 2023
3dac2fd
docs: improve to dictionary example (#7)
stainless-bot Oct 24, 2023
c9c4a66
feat(api): updates (#8)
stainless-bot Oct 26, 2023
bd8dbe9
fix: rename customer.credits.ledger.create_entry_by_exteral_id and Re…
stainless-bot Oct 26, 2023
0c651c3
ci(lint): run ruff too (#10)
stainless-bot Oct 26, 2023
4dab0a6
chore(internal): require explicit overrides (#11)
stainless-bot Oct 26, 2023
7b64c85
fix(client): include more detail in error messages (#12)
stainless-bot Oct 26, 2023
4256067
feat(api): updates (#13)
stainless-bot Oct 27, 2023
3721667
test(qs): add an additional test case for array brackets (#14)
stainless-bot Oct 27, 2023
550d18c
chore(internal): minor restructuring of base client (#15)
stainless-bot Oct 27, 2023
fa652f3
feat(package): add classifiers (#16)
stainless-bot Oct 27, 2023
fc96155
feat(github): include a devcontainer setup (#25)
stainless-bot Oct 31, 2023
9a25d2f
feat(client): allow binary returns (#26)
stainless-bot Nov 3, 2023
e8d0844
feat(client): support passing BaseModels to request params at runtime…
stainless-bot Nov 3, 2023
ad6ebef
fix(binaries): don't synchronously block in astream_to_file (#28)
stainless-bot Nov 3, 2023
f1bc6b2
release: 1.28.0
stainless-bot Nov 3, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# syntax=docker/dockerfile:1
FROM debian:bookworm-slim

RUN apt-get update && apt-get install -y \
libxkbcommon0 \
ca-certificates \
make \
curl \
git \
unzip \
libc++1 \
vim \
termcap \
&& apt-get clean autoclean

RUN curl -sSf https://rye-up.com/get | RYE_VERSION="0.15.2" RYE_INSTALL_OPTION="--yes" bash
ENV PATH=/root/.rye/shims:$PATH

WORKDIR /workspace

COPY README.md .python-version pyproject.toml requirements.lock requirements-dev.lock /workspace/

RUN rye sync --all-features

COPY . /workspace

CMD ["rye", "shell"]
20 changes: 20 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/debian
{
"name": "Debian",
"build": {
"dockerfile": "Dockerfile"
}

// Features to add to the dev container. More info: https://containers.dev/features.
// "features": {},

// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],

// Configure tool-specific properties.
// "customizations": {},

// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
// "remoteUser": "root"
}
41 changes: 41 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: CI
on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
lint:
name: lint
runs-on: ubuntu-latest
if: github.repository == 'orbcorp/orb-python'

steps:
- uses: actions/checkout@v3

- name: Install Rye
run: |
curl -sSf https://rye-up.com/get | bash
echo "$HOME/.rye/shims" >> $GITHUB_PATH
env:
RYE_VERSION: 0.15.2
RYE_INSTALL_OPTION: "--yes"

- name: Install dependencies
run: |
rye sync --all-features

- name: Run ruff
run: |
rye run check:ruff

- name: Run type checking
run: |
rye run typecheck

- name: Ensure importable
run: |
rye run python -c 'import orb'
1 change: 1 addition & 0 deletions .python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.9.18
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "1.27.0"
".": "1.28.0"
}
2 changes: 1 addition & 1 deletion .stats.yml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
configured_endpoints: 73
configured_endpoints: 74
34 changes: 34 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,39 @@
# Changelog

## 1.28.0 (2023-11-03)

Full Changelog: [v1.27.0...v1.28.0](https://github.com/orbcorp/orb-python/compare/v1.27.0...v1.28.0)

### Features

* **api:** updates ([#13](https://github.com/orbcorp/orb-python/issues/13)) ([4256067](https://github.com/orbcorp/orb-python/commit/42560678cd0b5bdfeafb5f3940aa06e6266fc193))
* **api:** updates ([#8](https://github.com/orbcorp/orb-python/issues/8)) ([c9c4a66](https://github.com/orbcorp/orb-python/commit/c9c4a664b617f2e6749ccecdd83580adf3ff8a33))
* **client:** adjust retry behavior to be exponential backoff ([#4](https://github.com/orbcorp/orb-python/issues/4)) ([62c25f6](https://github.com/orbcorp/orb-python/commit/62c25f6cf9456cb3ea26a79272417e79b366603c))
* **client:** allow binary returns ([#26](https://github.com/orbcorp/orb-python/issues/26)) ([9a25d2f](https://github.com/orbcorp/orb-python/commit/9a25d2f07d4fd5b18ab2702240a4c470c680715d))
* **client:** improve file upload types ([#3](https://github.com/orbcorp/orb-python/issues/3)) ([91b3d5c](https://github.com/orbcorp/orb-python/commit/91b3d5c4b383f2ccc1fad7209ad834aeeecaf96e))
* **client:** improve retry behaviour ([#6](https://github.com/orbcorp/orb-python/issues/6)) ([04d94d2](https://github.com/orbcorp/orb-python/commit/04d94d22b7ad214ba748f0a1722b67d5b756e5c8))
* **client:** support passing BaseModels to request params at runtime ([#27](https://github.com/orbcorp/orb-python/issues/27)) ([e8d0844](https://github.com/orbcorp/orb-python/commit/e8d08448ab25e34955f3ae5ca2501565cbe2d192))
* **github:** include a devcontainer setup ([#25](https://github.com/orbcorp/orb-python/issues/25)) ([fc96155](https://github.com/orbcorp/orb-python/commit/fc961559403ad78cb144c348635afbf00410640d))
* **package:** add classifiers ([#16](https://github.com/orbcorp/orb-python/issues/16)) ([fa652f3](https://github.com/orbcorp/orb-python/commit/fa652f3a4b68afb1204c4f6c0f74b00b39f1b9af))


### Bug Fixes

* **binaries:** don't synchronously block in astream_to_file ([#28](https://github.com/orbcorp/orb-python/issues/28)) ([ad6ebef](https://github.com/orbcorp/orb-python/commit/ad6ebefccc8e1cb178b0cc394103ff646a130d72))
* **client:** include more detail in error messages ([#12](https://github.com/orbcorp/orb-python/issues/12)) ([7b64c85](https://github.com/orbcorp/orb-python/commit/7b64c851f6825ec8d2e2f8fcc6174f88f3676d59))
* rename customer.credits.ledger.create_entry_by_exteral_id and RequestValidationErrors ([#9](https://github.com/orbcorp/orb-python/issues/9)) ([bd8dbe9](https://github.com/orbcorp/orb-python/commit/bd8dbe9335a24ff0830d7dad90676fa1d55202d0))


### Chores

* **internal:** minor restructuring of base client ([#15](https://github.com/orbcorp/orb-python/issues/15)) ([550d18c](https://github.com/orbcorp/orb-python/commit/550d18c72e0eb2c06dc83329f07d207a6cf2b0de))
* **internal:** require explicit overrides ([#11](https://github.com/orbcorp/orb-python/issues/11)) ([4dab0a6](https://github.com/orbcorp/orb-python/commit/4dab0a6da2d4992046c6a125b460bd21fb26cd10))


### Documentation

* improve to dictionary example ([#7](https://github.com/orbcorp/orb-python/issues/7)) ([3dac2fd](https://github.com/orbcorp/orb-python/commit/3dac2fd2595e1e2b62f85f284daa4c519998942d))

## 1.27.0 (2023-10-20)

Full Changelog: [v1.26.0...v1.27.0](https://github.com/orbcorp/orb-python/compare/v1.26.0...v1.27.0)
Expand Down
23 changes: 22 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ Functionality between the synchronous and asynchronous clients is otherwise iden

## Using types

Nested request parameters are [TypedDicts](https://docs.python.org/3/library/typing.html#typing.TypedDict). Responses are [Pydantic models](https://docs.pydantic.dev), which provide helper methods for things like serializing back into JSON ([v1](https://docs.pydantic.dev/1.10/usage/models/), [v2](https://docs.pydantic.dev/latest/usage/serialization/)). To get a dictionary, call `dict(model)`.
Nested request parameters are [TypedDicts](https://docs.python.org/3/library/typing.html#typing.TypedDict). Responses are [Pydantic models](https://docs.pydantic.dev), which provide helper methods for things like serializing back into JSON ([v1](https://docs.pydantic.dev/1.10/usage/models/), [v2](https://docs.pydantic.dev/latest/usage/serialization/)). To get a dictionary, call `model.model_dump()`.

Typed requests and responses provide autocomplete and documentation within your editor. If you would like to see type errors in VS Code to help catch bugs earlier, set `python.analysis.typeCheckingMode` to `basic`.

Expand Down Expand Up @@ -278,6 +278,27 @@ if response.my_field is None:
print('Got json like {"my_field": null}.')
```

### Accessing raw response data (e.g. headers)

The "raw" Response object can be accessed by prefixing `.with_raw_response.` to any HTTP method call.

```py
from orb import Orb

client = Orb()
response = client.customers.with_raw_response.create(
email="string",
name="string",
)

print(response.headers.get('X-My-Header'))

customer = response.parse() # get the object that `customers.create()` would have returned
print(customer.id)
```

These methods return an [`APIResponse`](https://github.com/orbcorp/orb-python/src/orb/_response.py) object.

### Configuring the HTTP client

You can directly override the [httpx client](https://www.python-httpx.org/api/#client) to customize it for your use case, including:
Expand Down
23 changes: 15 additions & 8 deletions api.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# Shared Types

```python
from orb.types import Discount
```

# TopLevel

Types:
Expand Down Expand Up @@ -109,7 +115,7 @@ Types:
from orb.types.customers.credits import (
LedgerListResponse,
LedgerCreateEntryResponse,
LedgerCreateEntryByExteralIDResponse,
LedgerCreateEntryByExternalIDResponse,
LedgerListByExternalIDResponse,
)
```
Expand All @@ -118,7 +124,7 @@ Methods:

- <code title="get /customers/{customer_id}/credits/ledger">client.customers.credits.ledger.<a href="./src/orb/resources/customers/credits/ledger.py">list</a>(customer_id, \*\*<a href="src/orb/types/customers/credits/ledger_list_params.py">params</a>) -> <a href="./src/orb/types/customers/credits/ledger_list_response.py">SyncPage[LedgerListResponse]</a></code>
- <code title="post /customers/{customer_id}/credits/ledger_entry">client.customers.credits.ledger.<a href="./src/orb/resources/customers/credits/ledger.py">create_entry</a>(customer_id, \*\*<a href="src/orb/types/customers/credits/ledger_create_entry_params.py">params</a>) -> <a href="./src/orb/types/customers/credits/ledger_create_entry_response.py">LedgerCreateEntryResponse</a></code>
- <code title="post /customers/external_customer_id/{external_customer_id}/credits/ledger_entry">client.customers.credits.ledger.<a href="./src/orb/resources/customers/credits/ledger.py">create_entry_by_exteral_id</a>(external_customer_id, \*\*<a href="src/orb/types/customers/credits/ledger_create_entry_by_exteral_id_params.py">params</a>) -> <a href="./src/orb/types/customers/credits/ledger_create_entry_by_exteral_id_response.py">LedgerCreateEntryByExteralIDResponse</a></code>
- <code title="post /customers/external_customer_id/{external_customer_id}/credits/ledger_entry">client.customers.credits.ledger.<a href="./src/orb/resources/customers/credits/ledger.py">create_entry_by_external_id</a>(external_customer_id, \*\*<a href="src/orb/types/customers/credits/ledger_create_entry_by_external_id_params.py">params</a>) -> <a href="./src/orb/types/customers/credits/ledger_create_entry_by_external_id_response.py">LedgerCreateEntryByExternalIDResponse</a></code>
- <code title="get /customers/external_customer_id/{external_customer_id}/credits/ledger">client.customers.credits.ledger.<a href="./src/orb/resources/customers/credits/ledger.py">list_by_external_id</a>(external_customer_id, \*\*<a href="src/orb/types/customers/credits/ledger_list_by_external_id_params.py">params</a>) -> <a href="./src/orb/types/customers/credits/ledger_list_by_external_id_response.py">SyncPage[LedgerListByExternalIDResponse]</a></code>

## BalanceTransactions
Expand Down Expand Up @@ -196,7 +202,7 @@ Methods:
Types:

```python
from orb.types import Invoice, InvoiceDiscount, InvoiceFetchUpcomingResponse
from orb.types import Invoice, InvoiceFetchUpcomingResponse
```

Methods:
Expand All @@ -214,13 +220,14 @@ Methods:
Types:

```python
from orb.types import ItemListResponse, ItemFetchResponse
from orb.types import Item
```

Methods:

- <code title="get /items">client.items.<a href="./src/orb/resources/items.py">list</a>(\*\*<a href="src/orb/types/item_list_params.py">params</a>) -> <a href="./src/orb/types/item_list_response.py">SyncPage[ItemListResponse]</a></code>
- <code title="get /items/{item_id}">client.items.<a href="./src/orb/resources/items.py">fetch</a>(item_id) -> <a href="./src/orb/types/item_fetch_response.py">ItemFetchResponse</a></code>
- <code title="post /items">client.items.<a href="./src/orb/resources/items.py">create</a>(\*\*<a href="src/orb/types/item_create_params.py">params</a>) -> <a href="./src/orb/types/item.py">Item</a></code>
- <code title="get /items">client.items.<a href="./src/orb/resources/items.py">list</a>(\*\*<a href="src/orb/types/item_list_params.py">params</a>) -> <a href="./src/orb/types/item.py">SyncPage[Item]</a></code>
- <code title="get /items/{item_id}">client.items.<a href="./src/orb/resources/items.py">fetch</a>(item_id) -> <a href="./src/orb/types/item.py">Item</a></code>

# Metrics

Expand Down Expand Up @@ -263,7 +270,7 @@ Methods:
Types:

```python
from orb.types import Discount, Price
from orb.types import Price
```

Methods:
Expand All @@ -285,8 +292,8 @@ Types:
```python
from orb.types import (
Subscription,
Subscriptions,
SubscriptionUsage,
Subscriptions,
SubscriptionFetchCostsResponse,
SubscriptionFetchScheduleResponse,
)
Expand Down
6 changes: 5 additions & 1 deletion mypy.ini
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
[mypy]
pretty = True
show_error_codes = True
exclude = _dev

# Exclude _files.py because mypy isn't smart enough to apply
# the correct type narrowing and as this is an internal module
# it's fine to just use Pyright.
exclude = ^(src/orb/_files\.py|_dev/.*\.py)$

strict_equality = True
implicit_reexport = True
Expand Down
36 changes: 33 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "orb-billing"
version = "1.27.0"
version = "1.28.0"
description = "Client library for the orb API"
readme = "README.md"
license = "Apache-2.0"
Expand All @@ -13,9 +13,25 @@ dependencies = [
"typing-extensions>=4.5, <5",
"anyio>=3.5.0, <4",
"distro>=1.7.0, <2",

]
requires-python = ">= 3.7"
classifiers = [
"Typing :: Typed",
"Intended Audience :: Developers",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Operating System :: OS Independent",
"Operating System :: POSIX",
"Operating System :: MacOS",
"Operating System :: POSIX :: Linux",
"Operating System :: Microsoft :: Windows",
"Topic :: Software Development :: Libraries :: Python Modules",
]



Expand All @@ -38,7 +54,8 @@ dev-dependencies = [
"isort==5.10.1",
"time-machine==2.9.0",
"nox==2023.4.22",

"dirty-equals>=0.6.0",

]

[tool.rye.scripts]
Expand All @@ -53,6 +70,16 @@ format = { chain = [
"format:ruff" = "ruff --fix ."
"format:isort" = "isort ."

"check:ruff" = "ruff ."

typecheck = { chain = [
"typecheck:pyright",
"typecheck:mypy"
]}
"typecheck:pyright" = "pyright"
"typecheck:verify-types" = "pyright --verifytypes orb --ignoreexternal"
"typecheck:mypy" = "mypy --enable-incomplete-feature=Unpack ."

[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"
Expand Down Expand Up @@ -90,6 +117,9 @@ exclude = [
".venv",
".nox",
]

reportImplicitOverride = true

reportImportCycles = false
reportPrivateUsage = false

Expand Down
1 change: 1 addition & 0 deletions requirements-dev.lock
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ black==23.3.0
certifi==2023.7.22
click==8.1.7
colorlog==6.7.0
dirty-equals==0.6.0
distlib==0.3.7
distro==1.8.0
exceptiongroup==1.1.3
Expand Down
6 changes: 4 additions & 2 deletions src/orb/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,13 @@
ResourceTooLarge,
APIConnectionError,
AuthenticationError,
ConstraintViolation,
FeatureNotAvailable,
InternalServerError,
PermissionDeniedError,
OrbAuthenticationError,
OrbInternalServerError,
RequestValidationErrors,
RequestValidationError,
UnprocessableEntityError,
DuplicateResourceCreation,
APIResponseValidationError,
Expand Down Expand Up @@ -65,8 +66,9 @@
"UnprocessableEntityError",
"RateLimitError",
"InternalServerError",
"ConstraintViolation",
"DuplicateResourceCreation",
"RequestValidationErrors",
"RequestValidationError",
"OrbAuthenticationError",
"FeatureNotAvailable",
"ResourceNotFound",
Expand Down
Loading