Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
9cff641
chore(tests): run tests in parallel
stainless-app[bot] Jun 13, 2025
77d44c4
fix(client): correctly parse binary response | stream
stainless-app[bot] Jun 13, 2025
6fe2d87
chore(tests): add tests for httpx client instantiation & proxies
stainless-app[bot] Jun 17, 2025
b76adac
chore(internal): update conftest.py
stainless-app[bot] Jun 17, 2025
531ccb7
chore(ci): enable for pull requests
stainless-app[bot] Jun 17, 2025
0d99a4b
chore(readme): update badges
stainless-app[bot] Jun 18, 2025
10be65e
fix(tests): fix: tests which call HTTP endpoints directly with the ex…
stainless-app[bot] Jun 18, 2025
4dca8bd
feat(api): api update
stainless-app[bot] Jun 18, 2025
b152b4a
docs(client): fix httpx.Timeout documentation reference
stainless-app[bot] Jun 19, 2025
2398bbf
feat(client): add support for aiohttp
stainless-app[bot] Jun 21, 2025
2786c5b
chore(tests): skip some failing tests on the latest python versions
stainless-app[bot] Jun 24, 2025
e3c5ecb
fix(ci): release-doctor — report correct token name
stainless-app[bot] Jun 27, 2025
61d50fc
chore(ci): only run for pushes and fork pull requests
stainless-app[bot] Jun 28, 2025
3010a52
fix(ci): correct conditional
stainless-app[bot] Jun 30, 2025
1efc212
chore(ci): change upload type
stainless-app[bot] Jul 2, 2025
c5a1fe7
chore(internal): codegen related update
stainless-app[bot] Jul 8, 2025
de167cc
chore(internal): bump pinned h11 dep
stainless-app[bot] Jul 9, 2025
a09f1e0
chore(package): mark python 3.13 as supported
stainless-app[bot] Jul 9, 2025
70df33b
fix(parsing): correctly handle nested discriminated unions
stainless-app[bot] Jul 10, 2025
6454ffc
chore(readme): fix version rendering on pypi
stainless-app[bot] Jul 11, 2025
606c91d
fix(client): don't send Content-Type header on GET requests
stainless-app[bot] Jul 12, 2025
7efa6a2
fix(parsing): ignore empty metadata
stainless-app[bot] Jul 22, 2025
a1c5d68
fix(parsing): parse extra field types
stainless-app[bot] Jul 23, 2025
eb8d03f
chore(project): add settings file for vscode
stainless-app[bot] Jul 25, 2025
24c682f
feat(client): support file upload requests
stainless-app[bot] Jul 31, 2025
15cd393
feat(api): api update
stainless-app[bot] Mar 31, 2026
de6e97a
chore(internal): codegen related update
stainless-app[bot] Apr 8, 2026
d87b0ef
chore(internal): codegen related update
stainless-app[bot] Apr 11, 2026
6a1ea3a
chore(internal): codegen related update
stainless-app[bot] Apr 18, 2026
2b06600
chore(internal): codegen related update
stainless-app[bot] Apr 23, 2026
ba75577
chore(internal): codegen related update
stainless-app[bot] Apr 28, 2026
a1dd4b7
codegen metadata
stainless-app[bot] Apr 30, 2026
005b1ed
chore(internal): codegen related update
stainless-app[bot] May 1, 2026
4e7db73
release: 1.4.0
stainless-app[bot] May 1, 2026
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
50 changes: 39 additions & 11 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
name: CI
on:
push:
branches:
- '**'
- '!integrated/**'
- '!stl-preview-head/**'
- '!stl-preview-base/**'
- '!generated'
- '!codegen/**'
- 'codegen/stl/**'
pull_request:
branches-ignore:
- 'generated'
- 'codegen/**'
- 'integrated/**'
- 'stl-preview-head/**'
- 'stl-preview-base/**'

Expand All @@ -13,8 +19,9 @@ jobs:
timeout-minutes: 10
name: lint
runs-on: ${{ github.repository == 'stainless-sdks/carbonaware-python' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}
if: (github.event_name == 'push' || github.event.pull_request.head.repo.fork) && (github.event_name != 'push' || github.event.head_commit.message != 'codegen metadata')
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6

- name: Install Rye
run: |
Expand All @@ -30,24 +37,44 @@ jobs:
- name: Run lints
run: ./scripts/lint

upload:
if: github.repository == 'stainless-sdks/carbonaware-python'
build:
if: (github.event_name == 'push' || github.event.pull_request.head.repo.fork) && (github.event_name != 'push' || github.event.head_commit.message != 'codegen metadata')
timeout-minutes: 10
name: upload
name: build
permissions:
contents: read
id-token: write
runs-on: depot-ubuntu-24.04
runs-on: ${{ github.repository == 'stainless-sdks/carbonaware-python' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6

- name: Install Rye
run: |
curl -sSf https://rye.astral.sh/get | bash
echo "$HOME/.rye/shims" >> $GITHUB_PATH
env:
RYE_VERSION: '0.44.0'
RYE_INSTALL_OPTION: '--yes'

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

- name: Run build
run: rye build

- name: Get GitHub OIDC Token
if: |-
github.repository == 'stainless-sdks/carbonaware-python' &&
!startsWith(github.ref, 'refs/heads/stl/')
id: github-oidc
uses: actions/github-script@v6
uses: actions/github-script@v8
with:
script: core.setOutput('github_token', await core.getIDToken());

- name: Upload tarball
if: |-
github.repository == 'stainless-sdks/carbonaware-python' &&
!startsWith(github.ref, 'refs/heads/stl/')
env:
URL: https://pkg.stainless.com/s
AUTH: ${{ steps.github-oidc.outputs.github_token }}
Expand All @@ -58,8 +85,9 @@ jobs:
timeout-minutes: 10
name: test
runs-on: ${{ github.repository == 'stainless-sdks/carbonaware-python' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}
if: github.event_name == 'push' || github.event.pull_request.head.repo.fork
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6

- name: Install Rye
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish-pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6

- name: Install Rye
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release-doctor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
if: github.repository == 'carbon-aware/scheduler-client-python' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch' || startsWith(github.head_ref, 'release-please') || github.head_ref == 'next')

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6

- name: Check release environment
run: |
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
.prism.log
.vscode
.stdy.log
_dev

__pycache__
Expand Down
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.3.0"
".": "1.4.0"
}
4 changes: 2 additions & 2 deletions .stats.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
configured_endpoints: 4
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/carbonaware%2Fcarbonaware-2dbf4d087175bcac9c2176c339e7e949347bf2857a5e61b51acc7eca28bd533f.yml
openapi_spec_hash: 6e499aa542851583bc50e7acbde2bff4
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/carbonaware/carbonaware-6dbcb9a71208f74ad130ab66790cfe3291354c5b35181dc904d514730b47df39.yml
openapi_spec_hash: 421ce663d62a9285f933f98d30878252
config_hash: 8be3b26a504eead5a14b041980ba2b53
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"python.analysis.importFormat": "relative",
}
51 changes: 51 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,56 @@
# Changelog

## 1.4.0 (2026-05-01)

Full Changelog: [v1.3.0...v1.4.0](https://github.com/carbon-aware/scheduler-client-python/compare/v1.3.0...v1.4.0)

### Features

* **api:** api update ([15cd393](https://github.com/carbon-aware/scheduler-client-python/commit/15cd393656f1a16aa890a341dad04ebd69fe190e))
* **api:** api update ([4dca8bd](https://github.com/carbon-aware/scheduler-client-python/commit/4dca8bda348585e2d5c4fe64a247b9671b62c890))
* **client:** add support for aiohttp ([2398bbf](https://github.com/carbon-aware/scheduler-client-python/commit/2398bbf4938af73e092bb9caeacfb0b64f08be91))
* **client:** support file upload requests ([24c682f](https://github.com/carbon-aware/scheduler-client-python/commit/24c682fc91e3292a42cfeccd942f1d2d1643c665))


### Bug Fixes

* **ci:** correct conditional ([3010a52](https://github.com/carbon-aware/scheduler-client-python/commit/3010a52437cce23336abc264833cafa20bcb7daa))
* **ci:** release-doctor — report correct token name ([e3c5ecb](https://github.com/carbon-aware/scheduler-client-python/commit/e3c5ecb737040fa3afdaab928fb855898b1d2f27))
* **client:** correctly parse binary response | stream ([77d44c4](https://github.com/carbon-aware/scheduler-client-python/commit/77d44c4bd4f8f5f4e5de983f024bee2aa9248ed7))
* **client:** don't send Content-Type header on GET requests ([606c91d](https://github.com/carbon-aware/scheduler-client-python/commit/606c91dc97fd9a08282cb8ae6be1dd11bfd5e6b1))
* **parsing:** correctly handle nested discriminated unions ([70df33b](https://github.com/carbon-aware/scheduler-client-python/commit/70df33b73e37b399b0f963e991169ace9d7604eb))
* **parsing:** ignore empty metadata ([7efa6a2](https://github.com/carbon-aware/scheduler-client-python/commit/7efa6a243bb22b81ebd97f7f1ab61fca99d084bb))
* **parsing:** parse extra field types ([a1c5d68](https://github.com/carbon-aware/scheduler-client-python/commit/a1c5d68804ffc872f40a888dd1da5a97d4ecf3b9))
* **tests:** fix: tests which call HTTP endpoints directly with the example parameters ([10be65e](https://github.com/carbon-aware/scheduler-client-python/commit/10be65ec85d2cf67560c2281558b7ecf05d69569))


### Chores

* **ci:** change upload type ([1efc212](https://github.com/carbon-aware/scheduler-client-python/commit/1efc21247b74df758cd101a8a6d8408792e7aa36))
* **ci:** enable for pull requests ([531ccb7](https://github.com/carbon-aware/scheduler-client-python/commit/531ccb7f4d525384903b92835c294bdda5cbd06d))
* **ci:** only run for pushes and fork pull requests ([61d50fc](https://github.com/carbon-aware/scheduler-client-python/commit/61d50fc024b7d46e63be4602dcf6d42edf5c1835))
* **internal:** bump pinned h11 dep ([de167cc](https://github.com/carbon-aware/scheduler-client-python/commit/de167cc952368579bb7f62eaa4d49258f3424f6c))
* **internal:** codegen related update ([005b1ed](https://github.com/carbon-aware/scheduler-client-python/commit/005b1ed493681c4f5bc5a0482e9bd4e40e9054a5))
* **internal:** codegen related update ([ba75577](https://github.com/carbon-aware/scheduler-client-python/commit/ba75577ca262b9d3d42a6eba8d33e81c868103a2))
* **internal:** codegen related update ([2b06600](https://github.com/carbon-aware/scheduler-client-python/commit/2b066000a2d8c50235cd7aa9cc951333b17f8ba0))
* **internal:** codegen related update ([6a1ea3a](https://github.com/carbon-aware/scheduler-client-python/commit/6a1ea3a9d7309be0dedc543ce9e502e36f5dec8a))
* **internal:** codegen related update ([d87b0ef](https://github.com/carbon-aware/scheduler-client-python/commit/d87b0ef99fc9bc07611bd0a985d5cc7c56192160))
* **internal:** codegen related update ([de6e97a](https://github.com/carbon-aware/scheduler-client-python/commit/de6e97a446eb2477332afa91883879a44a72303e))
* **internal:** codegen related update ([c5a1fe7](https://github.com/carbon-aware/scheduler-client-python/commit/c5a1fe70af6ff2e120a90c4168caed62c7411a90))
* **internal:** update conftest.py ([b76adac](https://github.com/carbon-aware/scheduler-client-python/commit/b76adac6f1e8eea60eb4349a25f0870f6fc6ac52))
* **package:** mark python 3.13 as supported ([a09f1e0](https://github.com/carbon-aware/scheduler-client-python/commit/a09f1e0e7dd69224044e1c16b4b47f3479ce1182))
* **project:** add settings file for vscode ([eb8d03f](https://github.com/carbon-aware/scheduler-client-python/commit/eb8d03f1e57f957655370290d99aa8e3f5d9260f))
* **readme:** fix version rendering on pypi ([6454ffc](https://github.com/carbon-aware/scheduler-client-python/commit/6454ffc31960ddd0971b0e7c9d67b8c1fe215f6e))
* **readme:** update badges ([0d99a4b](https://github.com/carbon-aware/scheduler-client-python/commit/0d99a4bd57bf817e11d1fcffe9e630dacabec21b))
* **tests:** add tests for httpx client instantiation & proxies ([6fe2d87](https://github.com/carbon-aware/scheduler-client-python/commit/6fe2d8768c31e6878a9db87390787de37133a42c))
* **tests:** run tests in parallel ([9cff641](https://github.com/carbon-aware/scheduler-client-python/commit/9cff6410f6bc5a1a37f2037c6868d92e46c5d8a9))
* **tests:** skip some failing tests on the latest python versions ([2786c5b](https://github.com/carbon-aware/scheduler-client-python/commit/2786c5bdd121eb1134025c075e22cf5dc4e0d4ec))


### Documentation

* **client:** fix httpx.Timeout documentation reference ([b152b4a](https://github.com/carbon-aware/scheduler-client-python/commit/b152b4ab06a534dbcb6ed936bee10150c2786d3e))

## 1.3.0 (2025-06-03)

Full Changelog: [v1.2.0...v1.3.0](https://github.com/carbon-aware/scheduler-client-python/compare/v1.2.0...v1.3.0)
Expand Down
7 changes: 0 additions & 7 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,13 +85,6 @@ $ 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.

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

```sh
$ ./scripts/test
```
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 2025 Carbonaware Scheduler
Copyright 2026 Carbonaware Scheduler

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
54 changes: 50 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
# Carbonaware Scheduler Python API library

[![PyPI version](https://img.shields.io/pypi/v/carbonaware-scheduler-client.svg)](https://pypi.org/project/carbonaware-scheduler-client/)
<!-- prettier-ignore -->
[![PyPI version](https://img.shields.io/pypi/v/carbonaware-scheduler-client.svg?label=pypi%20(stable))](https://pypi.org/project/carbonaware-scheduler-client/)

The Carbonaware Scheduler Python library provides convenient access to the Carbonaware Scheduler REST API from any Python 3.8+
The Carbonaware Scheduler Python library provides convenient access to the Carbonaware Scheduler REST API from any Python 3.9+
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 Down Expand Up @@ -83,6 +84,51 @@ asyncio.run(main())

Functionality between the synchronous and asynchronous clients is otherwise identical.

### With aiohttp

By default, the async client uses `httpx` for HTTP requests. However, for improved concurrency performance you may also use `aiohttp` as the HTTP backend.

You can enable this by installing `aiohttp`:

```sh
# install from PyPI
pip install carbonaware-scheduler-client[aiohttp]
```

Then you can enable it by instantiating the client with `http_client=DefaultAioHttpClient()`:

```python
import asyncio
from carbonaware_scheduler import DefaultAioHttpClient
from datetime import datetime
from carbonaware_scheduler import AsyncCarbonawareScheduler


async def main() -> None:
async with AsyncCarbonawareScheduler(
http_client=DefaultAioHttpClient(),
) as client:
schedule = await client.schedule.create(
duration="PT1H",
windows=[
{
"end": datetime.fromisoformat("2019-12-27T18:11:19.117"),
"start": datetime.fromisoformat("2019-12-27T18:11:19.117"),
}
],
zones=[
{
"provider": "aws",
"region": "af-south-1",
}
],
)
print(schedule.ideal)


asyncio.run(main())
```

## 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 also provide helper methods for things like:
Expand Down Expand Up @@ -189,7 +235,7 @@ client.with_options(max_retries=5).schedule.create(
### Timeouts

By default requests time out after 1 minute. You can configure this with a `timeout` option,
which accepts a float or an [`httpx.Timeout`](https://www.python-httpx.org/advanced/#fine-tuning-the-configuration) object:
which accepts a float or an [`httpx.Timeout`](https://www.python-httpx.org/advanced/timeouts/#fine-tuning-the-configuration) object:

```python
from datetime import datetime
Expand Down Expand Up @@ -419,7 +465,7 @@ print(carbonaware_scheduler.__version__)

## Requirements

Python 3.8 or higher.
Python 3.9 or higher.

## Contributing

Expand Down
2 changes: 1 addition & 1 deletion bin/check-release-environment
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
errors=()

if [ -z "${PYPI_TOKEN}" ]; then
errors+=("The CARBONAWARE_SCHEDULER_PYPI_TOKEN secret has not been set. Please set it in either this repository's secrets or your organization secrets.")
errors+=("The PYPI_TOKEN secret has not been set. Please set it in either this repository's secrets or your organization secrets.")
fi

lenErrors=${#errors[@]}
Expand Down
50 changes: 0 additions & 50 deletions mypy.ini

This file was deleted.

Loading