Skip to content

Commit

Permalink
release: 0.1.0-beta.4 (#99)
Browse files Browse the repository at this point in the history
Automated Release PR
---


## 0.1.0-beta.4 (2025-01-23)

Full Changelog:
[v0.1.0-beta.3...v0.1.0-beta.4](v0.1.0-beta.3...v0.1.0-beta.4)

### Breaking Changes

* All positional arguments have been converted to non-positional
arguments to ensure consistency between APIs.

### Features

* **api:** api update
([#108](#108))
([a58c149](a58c149))
* **api:** api update
([#109](#109))
([9e781b0](9e781b0))
* **api:** api update
([#111](#111))
([008bd54](008bd54))
* **api:** api update
([#113](#113))
([0973898](0973898))
* **api:** api update
([#117](#117))
([28ed14a](28ed14a))
* **api:** api update
([#118](#118))
([35b2858](35b2858))
* **api:** api update
([#119](#119))
([2977ea1](2977ea1))
* **api:** api update
([#120](#120))
([6d70b65](6d70b65))
* **api:** api update
([#123](#123))
([6e879af](6e879af))
* **api:** api update
([#124](#124))
([6b92d9c](6b92d9c))
* **api:** api update
([#128](#128))
([c6a4123](c6a4123))
* **api:** api update
([#131](#131))
([bf0c16e](bf0c16e))
* **api:** api update
([#136](#136))
([30f51ae](30f51ae))
* **api:** api update
([#139](#139))
([6fcda79](6fcda79))
* **api:** api update
([#144](#144))
([63abf5d](63abf5d))
* **api:** api update
([#147](#147))
([3690360](3690360))
* **api:** api update
([#148](#148))
([0e22565](0e22565))
* **api:** api update
([#150](#150))
([d027800](d027800))
* **api:** api update
([#156](#156))
([06e842b](06e842b))
* **api:** api update
([#157](#157))
([c185997](c185997))
* **api:** api update
([#158](#158))
([45e89f1](45e89f1))
* **api:** api update
([#160](#160))
([368fd85](368fd85))
* **api:** api update
([#161](#161))
([109129d](109129d))
* **api:** api update
([#163](#163))
([f8eb0ab](f8eb0ab))
* **api:** api update
([#165](#165))
([3a868c4](3a868c4))
* **api:** api update
([#166](#166))
([e7ca427](e7ca427))
* **api:** api update
([#171](#171))
([4389567](4389567))
* **api:** OpenAPI spec update via Stainless API
([#100](#100))
([23e4233](23e4233))
* **api:** OpenAPI spec update via Stainless API
([#105](#105))
([d53b0c0](d53b0c0))
* **api:** OpenAPI spec update via Stainless API
([#97](#97))
([1b9edd9](1b9edd9))


### Bug Fixes

* **client:** avoid OverflowError with very large retry counts
([#106](#106))
([465d868](465d868))
* **client:** compat with new httpx 0.28.0 release
([#133](#133))
([5d8b9cc](5d8b9cc))
* **client:** only call .close() when needed
([#153](#153))
([f8f67e6](f8f67e6))
* correctly handle deserialising `cls` fields
([#159](#159))
([b26b63b](b26b63b))
* **tests:** make test_get_platform less flaky
([#168](#168))
([db126f2](db126f2))


### Chores

* add missing isclass check
([#151](#151))
([e5fde7c](e5fde7c))
* add repr to PageInfo class
([#107](#107))
([8306ee7](8306ee7))
* **internal:** add support for parsing bool response content
([#104](#104))
([2253e61](2253e61))
* **internal:** add support for TypeAliasType
([#141](#141))
([17c7ae6](17c7ae6))
* **internal:** avoid pytest-asyncio deprecation warning
([#169](#169))
([3136426](3136426))
* **internal:** bump httpx dependency
([#152](#152))
([337146f](337146f))
* **internal:** bump pydantic dependency
([#137](#137))
([a3d6204](a3d6204))
* **internal:** bump pyright
([#134](#134))
([e313f0a](e313f0a))
* **internal:** bump pyright
([#140](#140))
([24f5bf0](24f5bf0))
* **internal:** bump pyright dependency
([#164](#164))
([6a2460f](6a2460f))
* **internal:** codegen related update
([#101](#101))
([b946911](b946911))
* **internal:** codegen related update
([#102](#102))
([9cbc145](9cbc145))
* **internal:** codegen related update
([#103](#103))
([2ed9f53](2ed9f53))
* **internal:** codegen related update
([#149](#149))
([c30e9bf](c30e9bf))
* **internal:** codegen related update
([#155](#155))
([bdfb2d0](bdfb2d0))
* **internal:** codegen related update
([#98](#98))
([b4b48c0](b4b48c0))
* **internal:** exclude mypy from running on tests
([#132](#132))
([2917f6e](2917f6e))
* **internal:** fix compat model_dump method when warnings are passed
([#127](#127))
([288a77f](288a77f))
* **internal:** fix some typos
([#146](#146))
([7a35c26](7a35c26))
* **internal:** minor formatting changes
([#172](#172))
([986fa49](986fa49))
* **internal:** minor style changes
([#170](#170))
([20e89dc](20e89dc))
* **internal:** remove some duplicated imports
([#142](#142))
([3cf4086](3cf4086))
* **internal:** update deps
([#162](#162))
([db5dc45](db5dc45))
* **internal:** updated imports
([#143](#143))
([29abf00](29abf00))
* make the `Omit` type public
([#135](#135))
([85f1025](85f1025))
* rebuild project due to codegen change
([#110](#110))
([5cb0771](5cb0771))
* rebuild project due to codegen change
([#112](#112))
([086bed0](086bed0))
* rebuild project due to codegen change
([#114](#114))
([d142e14](d142e14))
* rebuild project due to codegen change
([#115](#115))
([7b5ba26](7b5ba26))
* rebuild project due to codegen change
([#116](#116))
([c01f739](c01f739))
* rebuild project due to codegen change
([#121](#121))
([f5da454](f5da454))
* rebuild project due to codegen change
([#122](#122))
([1e76c7d](1e76c7d))
* rebuild project due to codegen change
([#125](#125))
([8ad959f](8ad959f))
* rebuild project due to codegen change
([#126](#126))
([a864791](a864791))
* remove now unused `cached-property` dep
([#130](#130))
([9a3f84b](9a3f84b))


### Documentation

* add info log level to readme
([#129](#129))
([670d5ab](670d5ab))
* fix typos
([#154](#154))
([2fd0635](2fd0635))
* **raw responses:** fix duplicate `the`
([#167](#167))
([5afb7a8](5afb7a8))
* **readme:** example snippet for client context manager
([#145](#145))
([373b0bc](373b0bc))
* **readme:** fix http client proxies example
([#138](#138))
([f9c9290](f9c9290))

---
This pull request is managed by Stainless's [GitHub
App](https://github.com/apps/stainless-app).

The [semver version
number](https://semver.org/#semantic-versioning-specification-semver) is
based on included [commit
messages](https://www.conventionalcommits.org/en/v1.0.0/).
Alternatively, you can manually set the version number in the title of
this pull request.

For a better experience, it is recommended to use either rebase-merge or
squash-merge when merging this pull request.

🔗 Stainless [website](https://www.stainlessapi.com)
📚 Read the [docs](https://app.stainlessapi.com/docs)
🙋 [Reach out](mailto:[email protected]) for help or questions

---------

Co-authored-by: stainless-app[bot] <142633134+stainless-app[bot]@users.noreply.github.com>
Co-authored-by: stainless-bot <[email protected]>
Co-authored-by: Jay Kim <[email protected]>
  • Loading branch information
3 people authored Jan 25, 2025
1 parent eaf8cc3 commit d0bc548
Show file tree
Hide file tree
Showing 187 changed files with 3,553 additions and 5,472 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ jobs:
lint:
name: lint
runs-on: ubuntu-latest


steps:
- uses: actions/checkout@v4
Expand All @@ -30,6 +29,7 @@ jobs:

- name: Run lints
run: ./scripts/lint

test:
name: test
runs-on: ubuntu-latest
Expand All @@ -50,4 +50,3 @@ jobs:

- name: Run tests
run: ./scripts/test

2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "0.1.0-beta.3"
".": "0.1.0-beta.4"
}
2 changes: 1 addition & 1 deletion .stats.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
configured_endpoints: 91
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/metronome%2Fmetronome-c4ec65355a30c07306ddff2c4a97411c2eb631a878583ce8bdd876a4fe2a5c96.yml
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/metronome%2Fmetronome-d45fa7bea4d4904432df31863500afbad8207834d9857d1d4b37549ed4621e10.yml
94 changes: 94 additions & 0 deletions CHANGELOG.md

Large diffs are not rendered by default.

44 changes: 24 additions & 20 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,13 @@

### With Rye

We use [Rye](https://rye.astral.sh/) to manage dependencies so we highly recommend [installing it](https://rye.astral.sh/guide/installation/) as it will automatically provision a Python environment with the expected Python version.
We use [Rye](https://rye.astral.sh/) to manage dependencies because it will automatically provision a Python environment with the expected Python version. To set it up, run:

After installing Rye, you'll just have to run this command:
```sh
$ ./scripts/bootstrap
```

Or [install Rye manually](https://rye.astral.sh/guide/installation/) and run:

```sh
$ rye sync --all-features
Expand Down Expand Up @@ -39,17 +43,17 @@ modify the contents of the `src/metronome/lib/` and `examples/` directories.

All files in the `examples/` directory are not modified by the generator and can be freely edited or added to.

```bash
```py
# add an example to examples/<your-example>.py

#!/usr/bin/env -S rye run python
```

```
chmod +x examples/<your-example>.py
```sh
$ chmod +x examples/<your-example>.py
# run the example against your api
./examples/<your-example>.py
$ ./examples/<your-example>.py
```

## Using the repository from source
Expand All @@ -58,8 +62,8 @@ If you’d like to use the repository from source, you can either install from g

To install via git:

```bash
pip install git+ssh://[email protected]/Metronome-Industries/metronome-python.git
```sh
$ pip install git+ssh://[email protected]/Metronome-Industries/metronome-python.git
```

Alternatively, you can build from source and install the wheel file:
Expand All @@ -68,29 +72,29 @@ Building this package will create two files in the `dist/` directory, a `.tar.gz

To create a distributable version of the library, all you have to do is run this command:

```bash
rye build
```sh
$ rye build
# or
python -m build
$ python -m build
```

Then to install:

```sh
pip install ./path-to-wheel-file.whl
$ pip install ./path-to-wheel-file.whl
```

## Running tests

Most tests require you to [set up a mock server](https://github.com/stoplightio/prism) against the OpenAPI spec to run the tests.

```bash
```sh
# you will need npm installed
npx prism mock path/to/your/openapi.yml
$ npx prism mock path/to/your/openapi.yml
```

```bash
rye run pytest
```sh
$ ./scripts/test
```

## Linting and formatting
Expand All @@ -100,14 +104,14 @@ This repository uses [ruff](https://github.com/astral-sh/ruff) and

To lint:

```bash
rye run lint
```sh
$ ./scripts/lint
```

To format and fix all ruff issues automatically:

```bash
rye run format
```sh
$ ./scripts/format
```

## Publishing and releases
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@
same "printed page" as the copyright notice for easier
identification within third-party archives.

Copyright 2024 Metronome
Copyright 2025 Metronome

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
44 changes: 29 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
[![PyPI version](https://img.shields.io/pypi/v/metronome-sdk.svg)](https://pypi.org/project/metronome-sdk/)

The Metronome Python library provides convenient access to the Metronome REST API from any Python 3.7+
The Metronome Python library provides convenient access to the Metronome REST API from any Python 3.8+
application. The library includes type definitions for all request params and response fields,
and offers both synchronous and asynchronous clients powered by [httpx](https://github.com/encode/httpx).

Expand All @@ -30,8 +30,7 @@ import os
from metronome import Metronome

client = Metronome(
# This is the default and can be omitted
bearer_token=os.environ.get("METRONOME_BEARER_TOKEN"),
bearer_token=os.environ.get("METRONOME_BEARER_TOKEN"), # This is the default and can be omitted
)

client.usage.ingest(
Expand Down Expand Up @@ -61,8 +60,7 @@ import asyncio
from metronome import AsyncMetronome

client = AsyncMetronome(
# This is the default and can be omitted
bearer_token=os.environ.get("METRONOME_BEARER_TOKEN"),
bearer_token=os.environ.get("METRONOME_BEARER_TOKEN"), # This is the default and can be omitted
)


Expand Down Expand Up @@ -189,7 +187,7 @@ except metronome.APIStatusError as e:
print(e.response)
```

Error codes are as followed:
Error codes are as follows:

| Status Code | Error Type |
| ----------- | -------------------------- |
Expand Down Expand Up @@ -266,12 +264,14 @@ Note that requests that time out are [retried twice by default](#retries).

We use the standard library [`logging`](https://docs.python.org/3/library/logging.html) module.

You can enable logging by setting the environment variable `METRONOME_LOG` to `debug`.
You can enable logging by setting the environment variable `METRONOME_LOG` to `info`.

```shell
$ export METRONOME_LOG=debug
$ export METRONOME_LOG=info
```

Or to `debug` for more verbose logging.

### How to tell whether `None` means `null` or missing

In an API response, a field may be explicitly `null`, or missing entirely; in either case, its value is `None` in this library. You can differentiate the two cases with `.model_fields_set`:
Expand Down Expand Up @@ -334,8 +334,7 @@ If you need to access undocumented endpoints, params, or response properties, th
#### Undocumented endpoints

To make requests to undocumented endpoints, you can make requests using `client.get`, `client.post`, and other
http verbs. Options on the client will be respected (such as retries) will be respected when making this
request.
http verbs. Options on the client will be respected (such as retries) when making this request.

```py
import httpx
Expand Down Expand Up @@ -364,18 +363,19 @@ can also get all the extra fields on the Pydantic model as a dict with

You can directly override the [httpx client](https://www.python-httpx.org/api/#client) to customize it for your use case, including:

- Support for proxies
- Custom transports
- Support for [proxies](https://www.python-httpx.org/advanced/proxies/)
- Custom [transports](https://www.python-httpx.org/advanced/transports/)
- Additional [advanced](https://www.python-httpx.org/advanced/clients/) functionality

```python
import httpx
from metronome import Metronome, DefaultHttpxClient

client = Metronome(
# Or use the `METRONOME_BASE_URL` env var
base_url="http://my.test.server.example.com:8083",
http_client=DefaultHttpxClient(
proxies="http://my.test.proxy.example.com",
proxy="http://my.test.proxy.example.com",
transport=httpx.HTTPTransport(local_address="0.0.0.0"),
),
)
Expand All @@ -391,12 +391,22 @@ client.with_options(http_client=DefaultHttpxClient(...))

By default the library closes underlying HTTP connections whenever the client is [garbage collected](https://docs.python.org/3/reference/datamodel.html#object.__del__). You can manually close the client using the `.close()` method if desired, or with a context manager that closes when exiting.

```py
from metronome import Metronome

with Metronome() as client:
# make requests here
...

# HTTP client is now closed
```

## Versioning

This package generally follows [SemVer](https://semver.org/spec/v2.0.0.html) conventions, though certain backwards-incompatible changes may be released as minor versions:

1. Changes that only affect static types, without breaking runtime behavior.
2. Changes to library internals which are technically public but not intended or documented for external use. _(Please open a GitHub issue to let us know if you are relying on such internals)_.
2. Changes to library internals which are technically public but not intended or documented for external use. _(Please open a GitHub issue to let us know if you are relying on such internals.)_
3. Changes that we do not expect to impact the vast majority of users in practice.

We take backwards-compatibility seriously and work hard to ensure you can rely on a smooth upgrade experience.
Expand All @@ -416,4 +426,8 @@ print(metronome.__version__)

## Requirements

Python 3.7 or higher.
Python 3.8 or higher.

## Contributing

See [the contributing documentation](./CONTRIBUTING.md).
Loading

0 comments on commit d0bc548

Please sign in to comment.