Skip to content
Open
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
7487832
chore(internal): remove mock server code
stainless-app[bot] Feb 20, 2026
f0c9141
chore: update mock server docs
stainless-app[bot] Feb 20, 2026
77a8a4f
chore(internal): add request options to SSE classes
stainless-app[bot] Feb 24, 2026
548c10c
chore(internal): make `test_proxy_environment_variables` more resilient
stainless-app[bot] Feb 24, 2026
12600f1
chore(internal): make `test_proxy_environment_variables` more resilie…
stainless-app[bot] Feb 25, 2026
e2553be
chore(ci): bump uv version
stainless-app[bot] Feb 27, 2026
48125d3
chore(internal): refactor authentication internals
stainless-app[bot] Mar 3, 2026
15bab4f
chore(ci): skip uploading artifacts on stainless-internal branches
stainless-app[bot] Mar 7, 2026
46606d7
fix(pydantic): do not pass `by_alias` unless set
stainless-app[bot] Mar 17, 2026
248d6e1
fix(deps): bump minimum typing-extensions version
stainless-app[bot] Mar 17, 2026
de75be7
chore(internal): tweak CI branches
stainless-app[bot] Mar 17, 2026
4cac545
fix: sanitize endpoint path params
stainless-app[bot] Mar 20, 2026
9aca850
chore(internal): update gitignore
stainless-app[bot] Mar 24, 2026
5de7de3
chore(ci): skip lint on metadata-only changes
stainless-app[bot] Mar 25, 2026
5132e59
feat(internal): implement indices array format for query and form ser…
stainless-app[bot] Mar 27, 2026
2db1259
fix(client): preserve hardcoded query params when merging with user p…
stainless-app[bot] Apr 8, 2026
c0cfd97
fix: ensure file data are only sent as 1 parameter
stainless-app[bot] Apr 11, 2026
78f42c3
perf(client): optimize file structure copying in multipart requests
stainless-app[bot] Apr 18, 2026
cedeacb
release: 0.1.0
stainless-app[bot] Apr 18, 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
32 changes: 19 additions & 13 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
name: CI
on:
push:
branches-ignore:
- 'generated'
- 'codegen/**'
- 'integrated/**'
- 'stl-preview-head/**'
- 'stl-preview-base/**'
branches:
- '**'
- '!integrated/**'
- '!stl-preview-head/**'
- '!stl-preview-base/**'
- '!generated'
- '!codegen/**'
- 'codegen/stl/**'
pull_request:
branches-ignore:
- 'stl-preview-head/**'
Expand All @@ -17,14 +19,14 @@ jobs:
timeout-minutes: 10
name: lint
runs-on: ${{ github.repository == 'stainless-sdks/rollin-python' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}
if: github.event_name == 'push' || github.event.pull_request.head.repo.fork
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@v6

- name: Install uv
uses: astral-sh/setup-uv@v5
with:
version: '0.9.13'
version: '0.10.2'

- name: Install dependencies
run: uv sync --all-extras
Expand All @@ -33,7 +35,7 @@ jobs:
run: ./scripts/lint

build:
if: github.event_name == 'push' || github.event.pull_request.head.repo.fork
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: build
permissions:
Expand All @@ -46,7 +48,7 @@ jobs:
- name: Install uv
uses: astral-sh/setup-uv@v5
with:
version: '0.9.13'
version: '0.10.2'

- name: Install dependencies
run: uv sync --all-extras
Expand All @@ -55,14 +57,18 @@ jobs:
run: uv build

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

- name: Upload tarball
if: github.repository == 'stainless-sdks/rollin-python'
if: |-
github.repository == 'stainless-sdks/rollin-python' &&
!startsWith(github.ref, 'refs/heads/stl/')
env:
URL: https://pkg.stainless.com/s
AUTH: ${{ steps.github-oidc.outputs.github_token }}
Expand All @@ -80,7 +86,7 @@ jobs:
- name: Install uv
uses: astral-sh/setup-uv@v5
with:
version: '0.9.13'
version: '0.10.2'

- name: Bootstrap
run: ./scripts/bootstrap
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
.prism.log
.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 @@
{
".": "0.0.2"
".": "0.1.0"
}
37 changes: 37 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,42 @@
# Changelog

## 0.1.0 (2026-04-18)

Full Changelog: [v0.0.2...v0.1.0](https://github.com/stainless-commons/rollin-python/compare/v0.0.2...v0.1.0)

### Features

* **internal:** implement indices array format for query and form serialization ([5132e59](https://github.com/stainless-commons/rollin-python/commit/5132e597c589409785472b639bbffd1866c29234))


### Bug Fixes

* **client:** preserve hardcoded query params when merging with user params ([2db1259](https://github.com/stainless-commons/rollin-python/commit/2db1259652670d03d353c982a5fcb88ff97948eb))
* **deps:** bump minimum typing-extensions version ([248d6e1](https://github.com/stainless-commons/rollin-python/commit/248d6e1ec3187b8f0ab1354546f438b028206539))
* ensure file data are only sent as 1 parameter ([c0cfd97](https://github.com/stainless-commons/rollin-python/commit/c0cfd9728ca956c2a3b803d49039e815696aa2b8))
* **pydantic:** do not pass `by_alias` unless set ([46606d7](https://github.com/stainless-commons/rollin-python/commit/46606d71ab95ee25148a1f3d328cb99b071e5985))
* sanitize endpoint path params ([4cac545](https://github.com/stainless-commons/rollin-python/commit/4cac545783e2a3d350953f3b630ad4184c9a2142))


### Performance Improvements

* **client:** optimize file structure copying in multipart requests ([78f42c3](https://github.com/stainless-commons/rollin-python/commit/78f42c3ee397ab5d7e54ca2257b3a00577e55b7d))


### Chores

* **ci:** bump uv version ([e2553be](https://github.com/stainless-commons/rollin-python/commit/e2553be28eaf15c6dba43a69bf18ef21da13c2c2))
* **ci:** skip lint on metadata-only changes ([5de7de3](https://github.com/stainless-commons/rollin-python/commit/5de7de3d905ee01b56ca1510c1bd2ae54c14b320))
* **ci:** skip uploading artifacts on stainless-internal branches ([15bab4f](https://github.com/stainless-commons/rollin-python/commit/15bab4f9dd2202e7c59db7eb989357a66add5c99))
* **internal:** add request options to SSE classes ([77a8a4f](https://github.com/stainless-commons/rollin-python/commit/77a8a4f9e5e163723ec76f0e5ec36cc31d95de8d))
* **internal:** make `test_proxy_environment_variables` more resilient ([548c10c](https://github.com/stainless-commons/rollin-python/commit/548c10c5c391e4a6af20894be87877a7f155b152))
* **internal:** make `test_proxy_environment_variables` more resilient to env ([12600f1](https://github.com/stainless-commons/rollin-python/commit/12600f143df64f57dafcc0d6b09786d6307ddbe5))
* **internal:** refactor authentication internals ([48125d3](https://github.com/stainless-commons/rollin-python/commit/48125d30130615b923c515aed42b0a42b1a57776))
* **internal:** remove mock server code ([7487832](https://github.com/stainless-commons/rollin-python/commit/748783209dbc1f1157a739d2020da3bf32946b8e))
* **internal:** tweak CI branches ([de75be7](https://github.com/stainless-commons/rollin-python/commit/de75be7056967b0037326c66135e542322cea8cd))
* **internal:** update gitignore ([9aca850](https://github.com/stainless-commons/rollin-python/commit/9aca85013a1c6977ba12ce4c3d4f9a796c970d19))
* update mock server docs ([f0c9141](https://github.com/stainless-commons/rollin-python/commit/f0c914149e0b63378b1e61939d99ea69065715e6))

## 0.0.2 (2026-02-16)

Full Changelog: [v0.0.1...v0.0.2](https://github.com/stainless-commons/rollin-python/compare/v0.0.1...v0.0.2)
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
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "rollin"
version = "0.0.2"
version = "0.1.0"
description = "The official Python library for the rollin API"
dynamic = ["readme"]
license = "Apache-2.0"
Expand All @@ -11,7 +11,7 @@ authors = [
dependencies = [
"httpx>=0.23.0, <1",
"pydantic>=1.9.0, <3",
"typing-extensions>=4.10, <5",
"typing-extensions>=4.14, <5",
"anyio>=3.5.0, <5",
"distro>=1.7.0, <2",
"sniffio",
Expand Down
41 changes: 0 additions & 41 deletions scripts/mock

This file was deleted.

46 changes: 0 additions & 46 deletions scripts/test
Original file line number Diff line number Diff line change
Expand Up @@ -4,53 +4,7 @@ set -e

cd "$(dirname "$0")/.."

RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[0;33m'
NC='\033[0m' # No Color

function prism_is_running() {
curl --silent "http://localhost:4010" >/dev/null 2>&1
}

kill_server_on_port() {
pids=$(lsof -t -i tcp:"$1" || echo "")
if [ "$pids" != "" ]; then
kill "$pids"
echo "Stopped $pids."
fi
}

function is_overriding_api_base_url() {
[ -n "$TEST_API_BASE_URL" ]
}

if ! is_overriding_api_base_url && ! prism_is_running ; then
# When we exit this script, make sure to kill the background mock server process
trap 'kill_server_on_port 4010' EXIT

# Start the dev server
./scripts/mock --daemon
fi

if is_overriding_api_base_url ; then
echo -e "${GREEN}✔ Running tests against ${TEST_API_BASE_URL}${NC}"
echo
elif ! prism_is_running ; then
echo -e "${RED}ERROR:${NC} The test suite will not run without a mock Prism server"
echo -e "running against your OpenAPI spec."
echo
echo -e "To run the server, pass in the path or url of your OpenAPI"
echo -e "spec to the prism command:"
echo
echo -e " \$ ${YELLOW}npm exec --package=@stainless-api/prism-cli@5.15.0 -- prism mock path/to/your.openapi.yml${NC}"
echo

exit 1
else
echo -e "${GREEN}✔ Mock prism server is running with your OpenAPI spec${NC}"
echo
fi

export DEFER_PYDANTIC_BUILD=false

Expand Down
38 changes: 32 additions & 6 deletions src/rollin/_base_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
)
from ._utils import is_dict, is_list, asyncify, is_given, lru_cache, is_mapping
from ._compat import PYDANTIC_V1, model_copy, model_dump
from ._models import GenericModel, FinalRequestOptions, validate_type, construct_type
from ._models import GenericModel, SecurityOptions, FinalRequestOptions, validate_type, construct_type
from ._response import (
APIResponse,
BaseAPIResponse,
Expand Down Expand Up @@ -432,9 +432,27 @@ def _make_status_error(
) -> _exceptions.APIStatusError:
raise NotImplementedError()

def _auth_headers(
self,
security: SecurityOptions, # noqa: ARG002
) -> dict[str, str]:
return {}

def _auth_query(
self,
security: SecurityOptions, # noqa: ARG002
) -> dict[str, str]:
return {}

def _custom_auth(
self,
security: SecurityOptions, # noqa: ARG002
) -> httpx.Auth | None:
return None

def _build_headers(self, options: FinalRequestOptions, *, retries_taken: int = 0) -> httpx.Headers:
custom_headers = options.headers or {}
headers_dict = _merge_mappings(self.default_headers, custom_headers)
headers_dict = _merge_mappings({**self._auth_headers(options.security), **self.default_headers}, custom_headers)
self._validate_headers(headers_dict, custom_headers)

# headers are case-insensitive while dictionaries are not.
Expand Down Expand Up @@ -506,7 +524,7 @@ def _build_request(
raise RuntimeError(f"Unexpected JSON data type, {type(json_data)}, cannot merge with `extra_body`")

headers = self._build_headers(options, retries_taken=retries_taken)
params = _merge_mappings(self.default_query, options.params)
params = _merge_mappings({**self._auth_query(options.security), **self.default_query}, options.params)
content_type = headers.get("Content-Type")
files = options.files

Expand Down Expand Up @@ -540,6 +558,10 @@ def _build_request(
files = cast(HttpxRequestFiles, ForceMultipartDict())

prepared_url = self._prepare_url(options.url)
# preserve hard-coded query params from the url
if params and prepared_url.query:
params = {**dict(prepared_url.params.items()), **params}
prepared_url = prepared_url.copy_with(raw_path=prepared_url.raw_path.split(b"?", 1)[0])
if "_" in prepared_url.host:
# work around https://github.com/encode/httpx/discussions/2880
kwargs["extensions"] = {"sni_hostname": prepared_url.host.replace("_", "-")}
Expand Down Expand Up @@ -671,7 +693,6 @@ def default_headers(self) -> dict[str, str | Omit]:
"Content-Type": "application/json",
"User-Agent": self.user_agent,
**self.platform_headers(),
**self.auth_headers,
**self._custom_headers,
}

Expand Down Expand Up @@ -990,8 +1011,9 @@ def request(
self._prepare_request(request)

kwargs: HttpxSendArgs = {}
if self.custom_auth is not None:
kwargs["auth"] = self.custom_auth
custom_auth = self._custom_auth(options.security)
if custom_auth is not None:
kwargs["auth"] = custom_auth

if options.follow_redirects is not None:
kwargs["follow_redirects"] = options.follow_redirects
Expand Down Expand Up @@ -1952,6 +1974,7 @@ def make_request_options(
idempotency_key: str | None = None,
timeout: float | httpx.Timeout | None | NotGiven = not_given,
post_parser: PostParser | NotGiven = not_given,
security: SecurityOptions | None = None,
) -> RequestOptions:
"""Create a dict of type RequestOptions without keys of NotGiven values."""
options: RequestOptions = {}
Expand All @@ -1977,6 +2000,9 @@ def make_request_options(
# internal
options["post_parser"] = post_parser # type: ignore

if security is not None:
options["security"] = security

return options


Expand Down
Loading
Loading