diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2dfedc0..727d806 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -5,18 +5,13 @@ on: - 'generated' - 'codegen/**' - 'integrated/**' - - 'stl-preview-head/**' - - 'stl-preview-base/**' pull_request: - branches-ignore: - - 'stl-preview-head/**' - - 'stl-preview-base/**' jobs: lint: timeout-minutes: 10 name: lint - runs-on: ${{ github.repository == 'stainless-sdks/lmnt-com-python' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }} + runs-on: ubuntu-latest if: github.event_name == 'push' || github.event.pull_request.head.repo.fork steps: - uses: actions/checkout@v4 @@ -33,13 +28,13 @@ jobs: run: ./scripts/lint build: - if: github.repository == 'stainless-sdks/lmnt-com-python' && (github.event_name == 'push' || github.event.pull_request.head.repo.fork) + if: github.event_name == 'push' || github.event.pull_request.head.repo.fork timeout-minutes: 10 name: build permissions: contents: read id-token: write - runs-on: depot-ubuntu-24.04 + runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -57,7 +52,7 @@ jobs: test: timeout-minutes: 10 name: test (py${{ matrix.python-version }}) - runs-on: ${{ github.repository == 'stainless-sdks/lmnt-com-python' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }} + runs-on: ubuntu-latest if: github.event_name == 'push' || github.event.pull_request.head.repo.fork strategy: fail-fast: false diff --git a/.github/workflows/post-merge-cleanup.yml b/.github/workflows/post-merge-cleanup.yml deleted file mode 100644 index 2958c60..0000000 --- a/.github/workflows/post-merge-cleanup.yml +++ /dev/null @@ -1,38 +0,0 @@ -name: Clean up next branch after merge - -on: - pull_request: - types: [closed] - branches: - - master - -jobs: - cleanup: - runs-on: ubuntu-latest - permissions: - contents: write - # Only run if PR was merged (not just closed) and it was from next branch - if: github.event.pull_request.merged == true && github.event.pull_request.head.ref == 'next' - steps: - - name: Checkout repository - uses: actions/checkout@v4 - with: - token: ${{ secrets.GITHUB_TOKEN }} - fetch-depth: 0 - - - name: Setup Git - run: | - git config user.name "github-actions[bot]" - git config user.email "github-actions[bot]@users.noreply.github.com" - - - name: Reset next branch to master - run: | - git checkout -B next origin/master - - - name: Push updated next branch - run: | - git push --force-with-lease origin next - - - name: Summary - run: | - echo "::notice::Post-merge cleanup completed" diff --git a/.github/workflows/prepare-release.yml b/.github/workflows/prepare-release.yml deleted file mode 100644 index bbe5590..0000000 --- a/.github/workflows/prepare-release.yml +++ /dev/null @@ -1,211 +0,0 @@ -name: Prepare release PR from next branch - -on: - workflow_dispatch: - inputs: - pr_number: - description: 'PR number to prepare release for' - required: true - type: string - version_type: - description: 'Version bump type' - required: true - type: choice - options: - - patch - - minor - - major - default: patch - -env: - REPO_B_TARGET: 'master' - REPO_B_NEXT: 'next' - -jobs: - prepare-release: - runs-on: ubuntu-latest - permissions: - contents: write - pull-requests: write - actions: read - steps: - - name: Checkout repository - uses: actions/checkout@v4 - with: - token: ${{ secrets.GITHUB_TOKEN }} - fetch-depth: 0 - - - name: Setup Git - run: | - git config user.name "github-actions[bot]" - git config user.email "github-actions[bot]@users.noreply.github.com" - - - name: Checkout next branch - run: | - git checkout -B ${{ env.REPO_B_NEXT }} origin/${{ env.REPO_B_NEXT }} - - - name: Verify PR exists and get info - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - echo "Verifying PR #${{ github.event.inputs.pr_number }} exists..." - PR_STATE=$(gh pr view ${{ github.event.inputs.pr_number }} --json state --jq '.state' 2>/dev/null || echo "NOT_FOUND") - - if [ "$PR_STATE" = "NOT_FOUND" ]; then - echo "::error::PR #${{ github.event.inputs.pr_number }} not found" - exit 1 - fi - - if [ "$PR_STATE" != "OPEN" ]; then - echo "::error::PR #${{ github.event.inputs.pr_number }} is $PR_STATE, expected OPEN" - exit 1 - fi - - echo "PR #${{ github.event.inputs.pr_number }} is open and ready for release preparation" - - - name: Determine version bump - id: version - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - echo "Fetching latest release from GitHub..." - LATEST_RELEASE=$(gh release list --limit 1 --json tagName --jq '.[0].tagName' 2>/dev/null || echo "") - - if [ -n "$LATEST_RELEASE" ]; then - CURRENT_VERSION="$LATEST_RELEASE" - echo "Found latest release: $CURRENT_VERSION" - else - echo "No releases found, starting from v0.0.0" - CURRENT_VERSION="v0.0.0" - fi - - # Parse version components (remove 'v' prefix if present) - version_number=$(echo $CURRENT_VERSION | sed 's/^v//') - major=$(echo $version_number | cut -d. -f1) - minor=$(echo $version_number | cut -d. -f2) - patch=$(echo $version_number | cut -d. -f3) - - echo "Current version components: major=$major, minor=$minor, patch=$patch" - - # Calculate new version based on input - case "${{ github.event.inputs.version_type }}" in - major) - major=$((major + 1)) - minor=0 - patch=0 - echo "Major version bump requested" - ;; - minor) - minor=$((minor + 1)) - patch=0 - echo "Minor version bump requested" - ;; - patch) - patch=$((patch + 1)) - echo "Patch version bump requested" - ;; - esac - - NEW_VERSION="v${major}.${minor}.${patch}" - echo "Version bump: $CURRENT_VERSION → $NEW_VERSION" - - echo "current_version=$CURRENT_VERSION" >> $GITHUB_OUTPUT - echo "new_version=$NEW_VERSION" >> $GITHUB_OUTPUT - - - name: Generate changelog entry - run: | - echo "Generating changelog entry for ${{ steps.version.outputs.new_version }}" - - # Get all commits in this PR (from target branch to current HEAD) - ALL_PR_COMMITS=$(git rev-list --reverse origin/${{ env.REPO_B_TARGET }}..HEAD) - - # Create changelog entry - changelog_entry="## ${{ steps.version.outputs.new_version }} ($(date +%Y-%m-%d))\n - Full Changelog: [${{ steps.version.outputs.current_version }}...${{ steps.version.outputs.new_version }}](https://github.com/${{ github.repository }}/compare/${{ steps.version.outputs.current_version }}...${{ steps.version.outputs.new_version }})\n\n" - - for commit in $ALL_PR_COMMITS; do - if [ -n "$commit" ]; then - commit_msg=$(git log --format="%s" -1 "$commit") - if ! echo "$commit_msg" | grep -q -E "^(Update sync state)"; then - short_sha=$(echo "$commit" | cut -c1-7) - changelog_entry="${changelog_entry}- ${commit_msg} ([${short_sha}](https://github.com/${{ github.repository }}/commit/${commit}))\n" - fi - fi - done - - # Save changelog entry to temp file - echo "$changelog_entry" > /tmp/changelog_entry.md - echo "Generated changelog entry:" - cat /tmp/changelog_entry.md - - - name: Update version files - run: | - # Update pyproject.toml if it exists - if [ -f pyproject.toml ]; then - echo "Updating version in pyproject.toml" - # Remove 'v' prefix for pyproject.toml - VERSION_NUMBER=$(echo "${{ steps.version.outputs.new_version }}" | sed 's/^v//') - - # Update version in pyproject.toml using sed - sed -i "s/^version = .*/version = \"$VERSION_NUMBER\"/" pyproject.toml - - echo "Updated pyproject.toml version to: $VERSION_NUMBER" - git add pyproject.toml - fi - - - name: Update CHANGELOG.md - run: | - echo "Updating CHANGELOG.md" - # Insert new entry at the top (after title if it exists) - if head -1 CHANGELOG.md | grep -q "^# "; then - # Has title, insert after first line - head -1 CHANGELOG.md > /tmp/changelog_new.md - echo "" >> /tmp/changelog_new.md - cat /tmp/changelog_entry.md >> /tmp/changelog_new.md - tail -n +2 CHANGELOG.md >> /tmp/changelog_new.md - else - # No title, insert at beginning - cat /tmp/changelog_entry.md > /tmp/changelog_new.md - cat CHANGELOG.md >> /tmp/changelog_new.md - fi - mv /tmp/changelog_new.md CHANGELOG.md - - git add CHANGELOG.md - echo "Updated CHANGELOG.md" - - - name: Create release commit - run: | - git commit -m "release: ${{ steps.version.outputs.new_version }}" - - echo "Created release commit for ${{ steps.version.outputs.new_version }}" - - git push origin ${{ env.REPO_B_NEXT }} - - - name: Update PR with release info - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - # Create updated PR body - PR_BODY="## Release ${{ steps.version.outputs.new_version }} - - ## Changelog - - $(cat /tmp/changelog_entry.md) - - --- - *Release commit added by prepare-release workflow.* - *This PR is now ready to be reviewed and merged.*" - - # Update the PR title and body - gh pr edit ${{ github.event.inputs.pr_number }} \ - --title "Release ${{ steps.version.outputs.new_version }}" \ - --body "$PR_BODY" - - echo "Updated PR #${{ github.event.inputs.pr_number }} with release information" - - - - name: Summary - run: | - echo "::notice::Release preparation completed successfully" - echo "::notice::PR #${{ github.event.inputs.pr_number }} updated with release commit for ${{ steps.version.outputs.new_version }}" - echo "::notice::Review the PR and merge when ready" diff --git a/_carbonsteel.json b/_carbonsteel.json index 88e3e60..b23992f 100644 --- a/_carbonsteel.json +++ b/_carbonsteel.json @@ -1,6 +1,6 @@ { "version": "1.1", - "generated_at": "2026-05-09T20:32:16Z", + "generated_at": "2026-05-19T21:02:05Z", "spec_sha": "4c822a78c44f68ac:cc7f4554e955f4fe", "files": [ "api.md", diff --git a/api.md b/api.md index 4ef36a1..96a6f01 100644 --- a/api.md +++ b/api.md @@ -13,6 +13,12 @@ Methods: - client.speech.generate(\*\*params) -> BinaryAPIResponse - client.speech.generate_detailed(\*\*params) -> SpeechGenerateDetailedResponse +## Sessions + +Methods: + +- client.speech.sessions.create(\*\*params) -> SpeechSession + # Voices Types: diff --git a/src/lmnt/_base_client.py b/src/lmnt/_base_client.py index 74445b0..cb75d83 100644 --- a/src/lmnt/_base_client.py +++ b/src/lmnt/_base_client.py @@ -443,14 +443,14 @@ def _build_headers(self, options: FinalRequestOptions, *, retries_taken: int = 0 # Don't set these headers if they were already set or removed by the caller. We check # `custom_headers`, which can contain `Omit()`, instead of `headers` to account for the removal case. lower_custom_headers = [header.lower() for header in custom_headers] - if "x-stainless-retry-count" not in lower_custom_headers: - headers["x-stainless-retry-count"] = str(retries_taken) - if "x-stainless-read-timeout" not in lower_custom_headers: + if "x-lmnt-retry-count" not in lower_custom_headers: + headers["x-lmnt-retry-count"] = str(retries_taken) + if "x-lmnt-read-timeout" not in lower_custom_headers: timeout = self.timeout if isinstance(options.timeout, NotGiven) else options.timeout if isinstance(timeout, Timeout): timeout = timeout.read if timeout is not None: - headers["x-stainless-read-timeout"] = str(timeout) + headers["x-lmnt-read-timeout"] = str(timeout) return headers @@ -793,7 +793,7 @@ def _should_retry(self, response: httpx.Response) -> bool: return False def _idempotency_key(self) -> str: - return f"stainless-python-retry-{uuid.uuid4()}" + return f"lmnt-python-retry-{uuid.uuid4()}" class _DefaultHttpxClient(httpx.Client): @@ -1934,12 +1934,12 @@ def get_platform() -> Platform: @lru_cache(maxsize=None) def platform_headers(version: str, *, platform: Platform | None) -> Dict[str, str]: return { - "X-Stainless-Lang": "python", - "X-Stainless-Package-Version": version, - "X-Stainless-OS": str(platform or get_platform()), - "X-Stainless-Arch": str(get_architecture()), - "X-Stainless-Runtime": get_python_runtime(), - "X-Stainless-Runtime-Version": get_python_version(), + "X-Lmnt-Lang": "python", + "X-Lmnt-Package-Version": version, + "X-Lmnt-OS": str(platform or get_platform()), + "X-Lmnt-Arch": str(get_architecture()), + "X-Lmnt-Runtime": get_python_runtime(), + "X-Lmnt-Runtime-Version": get_python_version(), } diff --git a/src/lmnt/_client.py b/src/lmnt/_client.py index f6f2b02..0726dc2 100644 --- a/src/lmnt/_client.py +++ b/src/lmnt/_client.py @@ -117,7 +117,7 @@ def auth_headers(self) -> dict[str, str]: def default_headers(self) -> dict[str, str | Omit]: return { **super().default_headers, - "X-Stainless-Async": "false", + "X-Lmnt-Async": "false", "lmnt-version": LMNT_API_VERSION, **self._custom_headers, } @@ -290,7 +290,7 @@ def auth_headers(self) -> dict[str, str]: def default_headers(self) -> dict[str, str | Omit]: return { **super().default_headers, - "X-Stainless-Async": f"async:{get_async_library()}", + "X-Lmnt-Async": f"async:{get_async_library()}", "lmnt-version": LMNT_API_VERSION, **self._custom_headers, } diff --git a/src/lmnt/_constants.py b/src/lmnt/_constants.py index 6ddf2c7..02293cc 100644 --- a/src/lmnt/_constants.py +++ b/src/lmnt/_constants.py @@ -1,9 +1,9 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +# Vendored runtime. See carbonsteel README for provenance. import httpx -RAW_RESPONSE_HEADER = "X-Stainless-Raw-Response" -OVERRIDE_CAST_TO_HEADER = "____stainless_override_cast_to" +RAW_RESPONSE_HEADER = "X-Lmnt-Raw-Response" +OVERRIDE_CAST_TO_HEADER = "____lmnt_override_cast_to" # default timeout is 1 minute DEFAULT_TIMEOUT = httpx.Timeout(timeout=60, connect=5.0) diff --git a/src/lmnt/_resource.py b/src/lmnt/_resource.py index aaf4e4c..9b7b784 100644 --- a/src/lmnt/_resource.py +++ b/src/lmnt/_resource.py @@ -1,4 +1,4 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +# Vendored runtime. See carbonsteel README for provenance. from __future__ import annotations diff --git a/src/lmnt/_utils/_utils.py b/src/lmnt/_utils/_utils.py index 50d5926..3113386 100644 --- a/src/lmnt/_utils/_utils.py +++ b/src/lmnt/_utils/_utils.py @@ -377,7 +377,7 @@ def get_required_header(headers: HeadersLike, header: str) -> str: if k.lower() == lower_header and isinstance(v, str): return v - # to deal with the case where the header looks like Stainless-Event-Id + # to deal with the case where the header looks like Lmnt-Event-Id intercaps_header = re.sub(r"([^\w])(\w)", lambda pat: pat.group(1) + pat.group(2).upper(), header.capitalize()) for normalized_header in [header, lower_header, header.upper(), intercaps_header]: diff --git a/tests/__init__.py b/tests/__init__.py index fd8019a..a0b6a50 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -1 +1 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +# Vendored runtime. See carbonsteel README for provenance. diff --git a/tests/api_resources/__init__.py b/tests/api_resources/__init__.py index fd8019a..a0b6a50 100644 --- a/tests/api_resources/__init__.py +++ b/tests/api_resources/__init__.py @@ -1 +1 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +# Vendored runtime. See carbonsteel README for provenance. diff --git a/tests/api_resources/test_accounts.py b/tests/api_resources/test_accounts.py index a556f54..89d7d29 100644 --- a/tests/api_resources/test_accounts.py +++ b/tests/api_resources/test_accounts.py @@ -27,7 +27,7 @@ def test_raw_response_retrieve(self, client: Lmnt) -> None: response = client.accounts.with_raw_response.retrieve() assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get("X-Lmnt-Lang") == "python" account = response.parse() assert_matches_type(AccountRetrieveResponse, account, path=["response"]) @@ -35,7 +35,7 @@ def test_raw_response_retrieve(self, client: Lmnt) -> None: def test_streaming_response_retrieve(self, client: Lmnt) -> None: with client.accounts.with_streaming_response.retrieve() as response: assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get("X-Lmnt-Lang") == "python" account = response.parse() assert_matches_type(AccountRetrieveResponse, account, path=["response"]) @@ -58,7 +58,7 @@ async def test_raw_response_retrieve(self, async_client: AsyncLmnt) -> None: response = await async_client.accounts.with_raw_response.retrieve() assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get("X-Lmnt-Lang") == "python" account = await response.parse() assert_matches_type(AccountRetrieveResponse, account, path=["response"]) @@ -66,7 +66,7 @@ async def test_raw_response_retrieve(self, async_client: AsyncLmnt) -> None: async def test_streaming_response_retrieve(self, async_client: AsyncLmnt) -> None: async with async_client.accounts.with_streaming_response.retrieve() as response: assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get("X-Lmnt-Lang") == "python" account = await response.parse() assert_matches_type(AccountRetrieveResponse, account, path=["response"]) diff --git a/tests/api_resources/test_speech.py b/tests/api_resources/test_speech.py index be66405..d77c70e 100644 --- a/tests/api_resources/test_speech.py +++ b/tests/api_resources/test_speech.py @@ -71,7 +71,7 @@ def test_raw_response_generate(self, client: Lmnt, respx_mock: MockRouter) -> No ) assert speech.is_closed is True - assert speech.http_request.headers.get("X-Stainless-Lang") == "python" + assert speech.http_request.headers.get("X-Lmnt-Lang") == "python" assert speech.json() == {"foo": "bar"} assert isinstance(speech, BinaryAPIResponse) @@ -84,7 +84,7 @@ def test_streaming_response_generate(self, client: Lmnt, respx_mock: MockRouter) voice="leah", ) as speech: assert not speech.is_closed - assert speech.http_request.headers.get("X-Stainless-Lang") == "python" + assert speech.http_request.headers.get("X-Lmnt-Lang") == "python" assert speech.json() == {"foo": "bar"} assert cast(Any, speech.is_closed) is True @@ -124,7 +124,7 @@ def test_raw_response_generate_detailed(self, client: Lmnt) -> None: ) assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get("X-Lmnt-Lang") == "python" speech = response.parse() assert_matches_type(SpeechGenerateDetailedResponse, speech, path=["response"]) @@ -135,7 +135,7 @@ def test_streaming_response_generate_detailed(self, client: Lmnt) -> None: voice="leah", ) as response: assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get("X-Lmnt-Lang") == "python" speech = response.parse() assert_matches_type(SpeechGenerateDetailedResponse, speech, path=["response"]) @@ -192,7 +192,7 @@ async def test_raw_response_generate(self, async_client: AsyncLmnt, respx_mock: ) assert speech.is_closed is True - assert speech.http_request.headers.get("X-Stainless-Lang") == "python" + assert speech.http_request.headers.get("X-Lmnt-Lang") == "python" assert await speech.json() == {"foo": "bar"} assert isinstance(speech, AsyncBinaryAPIResponse) @@ -205,7 +205,7 @@ async def test_streaming_response_generate(self, async_client: AsyncLmnt, respx_ voice="leah", ) as speech: assert not speech.is_closed - assert speech.http_request.headers.get("X-Stainless-Lang") == "python" + assert speech.http_request.headers.get("X-Lmnt-Lang") == "python" assert await speech.json() == {"foo": "bar"} assert cast(Any, speech.is_closed) is True @@ -245,7 +245,7 @@ async def test_raw_response_generate_detailed(self, async_client: AsyncLmnt) -> ) assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get("X-Lmnt-Lang") == "python" speech = await response.parse() assert_matches_type(SpeechGenerateDetailedResponse, speech, path=["response"]) @@ -256,7 +256,7 @@ async def test_streaming_response_generate_detailed(self, async_client: AsyncLmn voice="leah", ) as response: assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get("X-Lmnt-Lang") == "python" speech = await response.parse() assert_matches_type(SpeechGenerateDetailedResponse, speech, path=["response"]) diff --git a/tests/api_resources/test_voices.py b/tests/api_resources/test_voices.py index 134a78d..fbc7741 100644 --- a/tests/api_resources/test_voices.py +++ b/tests/api_resources/test_voices.py @@ -52,7 +52,7 @@ def test_raw_response_create(self, client: Lmnt) -> None: ) assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get("X-Lmnt-Lang") == "python" voice = response.parse() assert_matches_type(Voice, voice, path=["response"]) @@ -64,7 +64,7 @@ def test_streaming_response_create(self, client: Lmnt) -> None: name="new-voice", ) as response: assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get("X-Lmnt-Lang") == "python" voice = response.parse() assert_matches_type(Voice, voice, path=["response"]) @@ -85,7 +85,7 @@ def test_raw_response_retrieve(self, client: Lmnt) -> None: ) assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get("X-Lmnt-Lang") == "python" voice = response.parse() assert_matches_type(Voice, voice, path=["response"]) @@ -95,7 +95,7 @@ def test_streaming_response_retrieve(self, client: Lmnt) -> None: "9c4a8f2b3e1d7c40", ) as response: assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get("X-Lmnt-Lang") == "python" voice = response.parse() assert_matches_type(Voice, voice, path=["response"]) @@ -135,7 +135,7 @@ def test_raw_response_update(self, client: Lmnt) -> None: ) assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get("X-Lmnt-Lang") == "python" voice = response.parse() assert_matches_type(VoiceUpdateResponse, voice, path=["response"]) @@ -145,7 +145,7 @@ def test_streaming_response_update(self, client: Lmnt) -> None: id="9c4a8f2b3e1d7c40", ) as response: assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get("X-Lmnt-Lang") == "python" voice = response.parse() assert_matches_type(VoiceUpdateResponse, voice, path=["response"]) @@ -173,7 +173,7 @@ def test_raw_response_delete(self, client: Lmnt) -> None: ) assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get("X-Lmnt-Lang") == "python" voice = response.parse() assert_matches_type(VoiceDeleteResponse, voice, path=["response"]) @@ -183,7 +183,7 @@ def test_streaming_response_delete(self, client: Lmnt) -> None: "9c4a8f2b3e1d7c40", ) as response: assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get("X-Lmnt-Lang") == "python" voice = response.parse() assert_matches_type(VoiceDeleteResponse, voice, path=["response"]) @@ -215,7 +215,7 @@ def test_raw_response_list(self, client: Lmnt) -> None: response = client.voices.with_raw_response.list() assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get("X-Lmnt-Lang") == "python" voice = response.parse() assert_matches_type(VoiceListResponse, voice, path=["response"]) @@ -223,7 +223,7 @@ def test_raw_response_list(self, client: Lmnt) -> None: def test_streaming_response_list(self, client: Lmnt) -> None: with client.voices.with_streaming_response.list() as response: assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get("X-Lmnt-Lang") == "python" voice = response.parse() assert_matches_type(VoiceListResponse, voice, path=["response"]) @@ -266,7 +266,7 @@ async def test_raw_response_create(self, async_client: AsyncLmnt) -> None: ) assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get("X-Lmnt-Lang") == "python" voice = await response.parse() assert_matches_type(Voice, voice, path=["response"]) @@ -278,7 +278,7 @@ async def test_streaming_response_create(self, async_client: AsyncLmnt) -> None: name="new-voice", ) as response: assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get("X-Lmnt-Lang") == "python" voice = await response.parse() assert_matches_type(Voice, voice, path=["response"]) @@ -299,7 +299,7 @@ async def test_raw_response_retrieve(self, async_client: AsyncLmnt) -> None: ) assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get("X-Lmnt-Lang") == "python" voice = await response.parse() assert_matches_type(Voice, voice, path=["response"]) @@ -309,7 +309,7 @@ async def test_streaming_response_retrieve(self, async_client: AsyncLmnt) -> Non "9c4a8f2b3e1d7c40", ) as response: assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get("X-Lmnt-Lang") == "python" voice = await response.parse() assert_matches_type(Voice, voice, path=["response"]) @@ -349,7 +349,7 @@ async def test_raw_response_update(self, async_client: AsyncLmnt) -> None: ) assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get("X-Lmnt-Lang") == "python" voice = await response.parse() assert_matches_type(VoiceUpdateResponse, voice, path=["response"]) @@ -359,7 +359,7 @@ async def test_streaming_response_update(self, async_client: AsyncLmnt) -> None: id="9c4a8f2b3e1d7c40", ) as response: assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get("X-Lmnt-Lang") == "python" voice = await response.parse() assert_matches_type(VoiceUpdateResponse, voice, path=["response"]) @@ -387,7 +387,7 @@ async def test_raw_response_delete(self, async_client: AsyncLmnt) -> None: ) assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get("X-Lmnt-Lang") == "python" voice = await response.parse() assert_matches_type(VoiceDeleteResponse, voice, path=["response"]) @@ -397,7 +397,7 @@ async def test_streaming_response_delete(self, async_client: AsyncLmnt) -> None: "9c4a8f2b3e1d7c40", ) as response: assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get("X-Lmnt-Lang") == "python" voice = await response.parse() assert_matches_type(VoiceDeleteResponse, voice, path=["response"]) @@ -429,7 +429,7 @@ async def test_raw_response_list(self, async_client: AsyncLmnt) -> None: response = await async_client.voices.with_raw_response.list() assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get("X-Lmnt-Lang") == "python" voice = await response.parse() assert_matches_type(VoiceListResponse, voice, path=["response"]) @@ -437,7 +437,7 @@ async def test_raw_response_list(self, async_client: AsyncLmnt) -> None: async def test_streaming_response_list(self, async_client: AsyncLmnt) -> None: async with async_client.voices.with_streaming_response.list() as response: assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get("X-Lmnt-Lang") == "python" voice = await response.parse() assert_matches_type(VoiceListResponse, voice, path=["response"]) diff --git a/tests/conftest.py b/tests/conftest.py index 9917845..25e5d23 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1,4 +1,4 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +# Vendored runtime. See carbonsteel README for provenance. from __future__ import annotations diff --git a/tests/test_client.py b/tests/test_client.py index 0c7ce38..72c2b04 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -1,4 +1,4 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +# Vendored runtime. See carbonsteel README for provenance. from __future__ import annotations @@ -116,13 +116,13 @@ def test_copy_default_headers(self) -> None: assert copied.default_headers["X-Foo"] == "bar" # merges already given headers - copied = client.copy(default_headers={"X-Bar": "stainless"}) + copied = client.copy(default_headers={"X-Bar": "lmnt"}) assert copied.default_headers["X-Foo"] == "bar" - assert copied.default_headers["X-Bar"] == "stainless" + assert copied.default_headers["X-Bar"] == "lmnt" # uses new values for any already given headers - copied = client.copy(default_headers={"X-Foo": "stainless"}) - assert copied.default_headers["X-Foo"] == "stainless" + copied = client.copy(default_headers={"X-Foo": "lmnt"}) + assert copied.default_headers["X-Foo"] == "lmnt" # set_default_headers @@ -150,14 +150,14 @@ def test_copy_default_query(self) -> None: assert _get_params(copied)["foo"] == "bar" # merges already given params - copied = client.copy(default_query={"bar": "stainless"}) + copied = client.copy(default_query={"bar": "lmnt"}) params = _get_params(copied) assert params["foo"] == "bar" - assert params["bar"] == "stainless" + assert params["bar"] == "lmnt" # uses new values for any already given headers - copied = client.copy(default_query={"foo": "stainless"}) - assert _get_params(copied)["foo"] == "stainless" + copied = client.copy(default_query={"foo": "lmnt"}) + assert _get_params(copied)["foo"] == "lmnt" # set_default_query @@ -313,20 +313,20 @@ def test_default_headers_option(self) -> None: ) request = client._build_request(FinalRequestOptions(method="get", url="/foo")) assert request.headers.get("x-foo") == "bar" - assert request.headers.get("x-stainless-lang") == "python" + assert request.headers.get("x-lmnt-lang") == "python" client2 = Lmnt( base_url=base_url, api_key=api_key, _strict_response_validation=True, default_headers={ - "X-Foo": "stainless", - "X-Stainless-Lang": "my-overriding-header", + "X-Foo": "lmnt", + "X-Lmnt-Lang": "my-overriding-header", }, ) request = client2._build_request(FinalRequestOptions(method="get", url="/foo")) - assert request.headers.get("x-foo") == "stainless" - assert request.headers.get("x-stainless-lang") == "my-overriding-header" + assert request.headers.get("x-foo") == "lmnt" + assert request.headers.get("x-lmnt-lang") == "my-overriding-header" def test_default_query_option(self) -> None: client = Lmnt( @@ -741,7 +741,7 @@ def retry_handler(_request: httpx.Request) -> httpx.Response: response = client.speech.with_raw_response.generate(text="hello world.", voice="leah") assert response.retries_taken == failures_before_success - assert int(response.http_request.headers.get("x-stainless-retry-count")) == failures_before_success + assert int(response.http_request.headers.get("x-lmnt-retry-count")) == failures_before_success @pytest.mark.parametrize("failures_before_success", [0, 2, 4]) @mock.patch("lmnt._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout) @@ -761,10 +761,10 @@ def retry_handler(_request: httpx.Request) -> httpx.Response: respx_mock.post("/v1/ai/speech/bytes").mock(side_effect=retry_handler) response = client.speech.with_raw_response.generate( - text="hello world.", voice="leah", extra_headers={"x-stainless-retry-count": Omit()} + text="hello world.", voice="leah", extra_headers={"x-lmnt-retry-count": Omit()} ) - assert len(response.http_request.headers.get_list("x-stainless-retry-count")) == 0 + assert len(response.http_request.headers.get_list("x-lmnt-retry-count")) == 0 @pytest.mark.parametrize("failures_before_success", [0, 2, 4]) @mock.patch("lmnt._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout) @@ -786,10 +786,10 @@ def retry_handler(_request: httpx.Request) -> httpx.Response: respx_mock.post("/v1/ai/speech/bytes").mock(side_effect=retry_handler) response = client.speech.with_raw_response.generate( - text="hello world.", voice="leah", extra_headers={"x-stainless-retry-count": "42"} + text="hello world.", voice="leah", extra_headers={"x-lmnt-retry-count": "42"} ) - assert response.http_request.headers.get("x-stainless-retry-count") == "42" + assert response.http_request.headers.get("x-lmnt-retry-count") == "42" def test_proxy_environment_variables(self, monkeypatch: pytest.MonkeyPatch) -> None: # Test that the proxy environment variables are set correctly @@ -901,13 +901,13 @@ def test_copy_default_headers(self) -> None: assert copied.default_headers["X-Foo"] == "bar" # merges already given headers - copied = client.copy(default_headers={"X-Bar": "stainless"}) + copied = client.copy(default_headers={"X-Bar": "lmnt"}) assert copied.default_headers["X-Foo"] == "bar" - assert copied.default_headers["X-Bar"] == "stainless" + assert copied.default_headers["X-Bar"] == "lmnt" # uses new values for any already given headers - copied = client.copy(default_headers={"X-Foo": "stainless"}) - assert copied.default_headers["X-Foo"] == "stainless" + copied = client.copy(default_headers={"X-Foo": "lmnt"}) + assert copied.default_headers["X-Foo"] == "lmnt" # set_default_headers @@ -935,14 +935,14 @@ def test_copy_default_query(self) -> None: assert _get_params(copied)["foo"] == "bar" # merges already given params - copied = client.copy(default_query={"bar": "stainless"}) + copied = client.copy(default_query={"bar": "lmnt"}) params = _get_params(copied) assert params["foo"] == "bar" - assert params["bar"] == "stainless" + assert params["bar"] == "lmnt" # uses new values for any already given headers - copied = client.copy(default_query={"foo": "stainless"}) - assert _get_params(copied)["foo"] == "stainless" + copied = client.copy(default_query={"foo": "lmnt"}) + assert _get_params(copied)["foo"] == "lmnt" # set_default_query @@ -1106,20 +1106,20 @@ def test_default_headers_option(self) -> None: ) request = client._build_request(FinalRequestOptions(method="get", url="/foo")) assert request.headers.get("x-foo") == "bar" - assert request.headers.get("x-stainless-lang") == "python" + assert request.headers.get("x-lmnt-lang") == "python" client2 = AsyncLmnt( base_url=base_url, api_key=api_key, _strict_response_validation=True, default_headers={ - "X-Foo": "stainless", - "X-Stainless-Lang": "my-overriding-header", + "X-Foo": "lmnt", + "X-Lmnt-Lang": "my-overriding-header", }, ) request = client2._build_request(FinalRequestOptions(method="get", url="/foo")) - assert request.headers.get("x-foo") == "stainless" - assert request.headers.get("x-stainless-lang") == "my-overriding-header" + assert request.headers.get("x-foo") == "lmnt" + assert request.headers.get("x-lmnt-lang") == "my-overriding-header" def test_default_query_option(self) -> None: client = AsyncLmnt( @@ -1539,7 +1539,7 @@ def retry_handler(_request: httpx.Request) -> httpx.Response: response = await client.speech.with_raw_response.generate(text="hello world.", voice="leah") assert response.retries_taken == failures_before_success - assert int(response.http_request.headers.get("x-stainless-retry-count")) == failures_before_success + assert int(response.http_request.headers.get("x-lmnt-retry-count")) == failures_before_success @pytest.mark.parametrize("failures_before_success", [0, 2, 4]) @mock.patch("lmnt._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout) @@ -1562,10 +1562,10 @@ def retry_handler(_request: httpx.Request) -> httpx.Response: respx_mock.post("/v1/ai/speech/bytes").mock(side_effect=retry_handler) response = await client.speech.with_raw_response.generate( - text="hello world.", voice="leah", extra_headers={"x-stainless-retry-count": Omit()} + text="hello world.", voice="leah", extra_headers={"x-lmnt-retry-count": Omit()} ) - assert len(response.http_request.headers.get_list("x-stainless-retry-count")) == 0 + assert len(response.http_request.headers.get_list("x-lmnt-retry-count")) == 0 @pytest.mark.parametrize("failures_before_success", [0, 2, 4]) @mock.patch("lmnt._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout) @@ -1588,10 +1588,10 @@ def retry_handler(_request: httpx.Request) -> httpx.Response: respx_mock.post("/v1/ai/speech/bytes").mock(side_effect=retry_handler) response = await client.speech.with_raw_response.generate( - text="hello world.", voice="leah", extra_headers={"x-stainless-retry-count": "42"} + text="hello world.", voice="leah", extra_headers={"x-lmnt-retry-count": "42"} ) - assert response.http_request.headers.get("x-stainless-retry-count") == "42" + assert response.http_request.headers.get("x-lmnt-retry-count") == "42" async def test_get_platform(self) -> None: platform = await asyncify(get_platform)() diff --git a/tests/test_transform.py b/tests/test_transform.py index 941a7e5..d376427 100644 --- a/tests/test_transform.py +++ b/tests/test_transform.py @@ -324,9 +324,9 @@ class ModelNestedObjects(BaseModel): @parametrize @pytest.mark.asyncio async def test_pydantic_nested_objects(use_async: bool) -> None: - model = ModelNestedObjects.construct(nested={"foo": "stainless"}) + model = ModelNestedObjects.construct(nested={"foo": "lmnt"}) assert isinstance(model.nested, MyModel) - assert cast(Any, await transform(model, Any, use_async)) == {"nested": {"foo": "stainless"}} + assert cast(Any, await transform(model, Any, use_async)) == {"nested": {"foo": "lmnt"}} class ModelWithDefaultField(BaseModel):