Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
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
26 changes: 16 additions & 10 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,7 +19,7 @@ jobs:
timeout-minutes: 10
name: lint
runs-on: ${{ github.repository == 'stainless-sdks/unlayer-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

Expand All @@ -36,7 +38,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 @@ -61,14 +63,18 @@ jobs:
run: rye build

- name: Get GitHub OIDC Token
if: github.repository == 'stainless-sdks/unlayer-python'
if: |-
github.repository == 'stainless-sdks/unlayer-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/unlayer-python'
if: |-
github.repository == 'stainless-sdks/unlayer-python' &&
!startsWith(github.ref, 'refs/heads/stl/')
env:
URL: https://pkg.stainless.com/s
AUTH: ${{ steps.github-oidc.outputs.github_token }}
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.1.0"
".": "0.1.1"
}
2 changes: 1 addition & 1 deletion .stats.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
configured_endpoints: 7
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/unlayer%2Funlayer-48f00d1c04c23fb4d1cb7cf4af4f56b0c920d758c1f06e06e5373e5b15e9c27d.yml
openapi_spec_hash: 6ee2a94bb9840aceb4a6161c724ce46c
config_hash: 249869757b6eb98ae3d58f2a47ce21e2
config_hash: c8d97d58d67dad9eeb65eb58fc781724
31 changes: 31 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,36 @@
# Changelog

## 0.1.1 (2026-03-25)

Full Changelog: [v0.1.0...v0.1.1](https://github.com/unlayer/unlayer-python/compare/v0.1.0...v0.1.1)

### Bug Fixes

* **deps:** bump minimum typing-extensions version ([b7baa1e](https://github.com/unlayer/unlayer-python/commit/b7baa1e5d138b5a33b63bed9dae37bfabb6d968d))
* **pydantic:** do not pass `by_alias` unless set ([d31637b](https://github.com/unlayer/unlayer-python/commit/d31637bd182be359df4af936cb715cc554d9a14b))
* sanitize endpoint path params ([bc0d6b6](https://github.com/unlayer/unlayer-python/commit/bc0d6b6b147d33cd2f65855284e7f435bdee09f9))


### Chores

* **ci:** skip lint on metadata-only changes ([3343492](https://github.com/unlayer/unlayer-python/commit/33434927ad6ab7c508d758335944cdc4123a5e17))
* **ci:** skip uploading artifacts on stainless-internal branches ([907041a](https://github.com/unlayer/unlayer-python/commit/907041a9070f3c4a86605a21c9ab9a004a9bf553))
* **internal:** codegen related update ([d58e1b8](https://github.com/unlayer/unlayer-python/commit/d58e1b80f026a3fbb93c51e57af8afedcdb866e9))
* **internal:** make `test_proxy_environment_variables` more resilient to env ([caea803](https://github.com/unlayer/unlayer-python/commit/caea803e4fc873ade6fbc9b9b66ff67938780f65))
* **internal:** tweak CI branches ([4e152dc](https://github.com/unlayer/unlayer-python/commit/4e152dccd0191c2dd4d321e8ca7b6550dc6bc3f0))
* **internal:** update gitignore ([5a510e6](https://github.com/unlayer/unlayer-python/commit/5a510e6edf2e26d612be067b6c95e70780d01d57))
* **test:** do not count install time for mock server timeout ([3ad7bbb](https://github.com/unlayer/unlayer-python/commit/3ad7bbb203d27a7b7f69fda2d0f3aebea329c49e))
* **tests:** bump steady to v0.19.4 ([775fe46](https://github.com/unlayer/unlayer-python/commit/775fe461f02f96ebc4b7cd6ff2d8cab4c52d291d))
* **tests:** bump steady to v0.19.5 ([9ef3615](https://github.com/unlayer/unlayer-python/commit/9ef3615041ea171a462a29f8cfd268133df0c6fc))
* **tests:** bump steady to v0.19.6 ([33d721e](https://github.com/unlayer/unlayer-python/commit/33d721e46826c23bf5b1ce78477d003cb9cd83da))
* **tests:** bump steady to v0.19.7 ([3d09621](https://github.com/unlayer/unlayer-python/commit/3d09621f6d61c74d431b9af1336c6c51d8396d4f))


### Refactors

* **tests:** switch from prism to steady ([d2618bd](https://github.com/unlayer/unlayer-python/commit/d2618bd109fcd053b5845009bc8221090930a369))
* **types:** use `extra_items` from PEP 728 ([19677f4](https://github.com/unlayer/unlayer-python/commit/19677f4a04cd989500eecce93cbb0506cf1ebf32))

## 0.1.0 (2026-02-24)

Full Changelog: [v0.0.1...v0.1.0](https://github.com/unlayer/unlayer-python/compare/v0.0.1...v0.1.0)
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ $ 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.
Most tests require you to [set up a mock server](https://github.com/dgellow/steady) against the OpenAPI spec to run the tests.

```sh
$ ./scripts/mock
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 = "unlayer"
version = "0.1.0"
version = "0.1.1"
description = "The official Python library for the unlayer 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
31 changes: 21 additions & 10 deletions scripts/mock
Original file line number Diff line number Diff line change
Expand Up @@ -19,23 +19,34 @@ fi

echo "==> Starting mock server with URL ${URL}"

# Run prism mock on the given spec
# Run steady mock on the given spec
if [ "$1" == "--daemon" ]; then
npm exec --package=@stainless-api/prism-cli@5.15.0 -- prism mock "$URL" &> .prism.log &
# Pre-install the package so the download doesn't eat into the startup timeout
npm exec --package=@stdy/cli@0.19.7 -- steady --version

# Wait for server to come online
npm exec --package=@stdy/cli@0.19.7 -- steady --host 127.0.0.1 -p 4010 --validator-form-array-format=comma --validator-query-array-format=comma --validator-form-object-format=brackets --validator-query-object-format=brackets "$URL" &> .stdy.log &

# Wait for server to come online via health endpoint (max 30s)
echo -n "Waiting for server"
while ! grep -q "✖ fatal\|Prism is listening" ".prism.log" ; do
attempts=0
while ! curl --silent --fail "http://127.0.0.1:4010/_x-steady/health" >/dev/null 2>&1; do
if ! kill -0 $! 2>/dev/null; then
echo
cat .stdy.log
exit 1
fi
attempts=$((attempts + 1))
if [ "$attempts" -ge 300 ]; then
echo
echo "Timed out waiting for Steady server to start"
cat .stdy.log
exit 1
fi
echo -n "."
sleep 0.1
done

if grep -q "✖ fatal" ".prism.log"; then
cat .prism.log
exit 1
fi

echo
else
npm exec --package=@stainless-api/prism-cli@5.15.0 -- prism mock "$URL"
npm exec --package=@stdy/cli@0.19.7 -- steady --host 127.0.0.1 -p 4010 --validator-form-array-format=comma --validator-query-array-format=comma --validator-form-object-format=brackets --validator-query-object-format=brackets "$URL"
fi
16 changes: 8 additions & 8 deletions scripts/test
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ 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
function steady_is_running() {
curl --silent "http://127.0.0.1:4010/_x-steady/health" >/dev/null 2>&1
}

kill_server_on_port() {
Expand All @@ -25,7 +25,7 @@ function is_overriding_api_base_url() {
[ -n "$TEST_API_BASE_URL" ]
}

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

Expand All @@ -36,19 +36,19 @@ 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"
elif ! steady_is_running ; then
echo -e "${RED}ERROR:${NC} The test suite will not run without a mock Steady 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 -e "spec to the steady command:"
echo
echo -e " \$ ${YELLOW}npm exec --package=@stainless-api/prism-cli@5.15.0 -- prism mock path/to/your.openapi.yml${NC}"
echo -e " \$ ${YELLOW}npm exec --package=@stdy/cli@0.19.7 -- steady path/to/your.openapi.yml --host 127.0.0.1 -p 4010 --validator-form-array-format=comma --validator-query-array-format=comma --validator-form-object-format=brackets --validator-query-object-format=brackets${NC}"
echo

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

Expand Down
18 changes: 18 additions & 0 deletions src/unlayer/_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,18 +115,21 @@ def convert(self) -> ConvertResource:

@cached_property
def projects(self) -> ProjectsResource:
"""Project details and configuration."""
from .resources.projects import ProjectsResource

return ProjectsResource(self)

@cached_property
def templates(self) -> TemplatesResource:
"""Template management and retrieval."""
from .resources.templates import TemplatesResource

return TemplatesResource(self)

@cached_property
def workspaces(self) -> WorkspacesResource:
"""Workspace access and management."""
from .resources.workspaces import WorkspacesResource

return WorkspacesResource(self)
Expand Down Expand Up @@ -345,18 +348,21 @@ def convert(self) -> AsyncConvertResource:

@cached_property
def projects(self) -> AsyncProjectsResource:
"""Project details and configuration."""
from .resources.projects import AsyncProjectsResource

return AsyncProjectsResource(self)

@cached_property
def templates(self) -> AsyncTemplatesResource:
"""Template management and retrieval."""
from .resources.templates import AsyncTemplatesResource

return AsyncTemplatesResource(self)

@cached_property
def workspaces(self) -> AsyncWorkspacesResource:
"""Workspace access and management."""
from .resources.workspaces import AsyncWorkspacesResource

return AsyncWorkspacesResource(self)
Expand Down Expand Up @@ -515,18 +521,21 @@ def convert(self) -> convert.ConvertResourceWithRawResponse:

@cached_property
def projects(self) -> projects.ProjectsResourceWithRawResponse:
"""Project details and configuration."""
from .resources.projects import ProjectsResourceWithRawResponse

return ProjectsResourceWithRawResponse(self._client.projects)

@cached_property
def templates(self) -> templates.TemplatesResourceWithRawResponse:
"""Template management and retrieval."""
from .resources.templates import TemplatesResourceWithRawResponse

return TemplatesResourceWithRawResponse(self._client.templates)

@cached_property
def workspaces(self) -> workspaces.WorkspacesResourceWithRawResponse:
"""Workspace access and management."""
from .resources.workspaces import WorkspacesResourceWithRawResponse

return WorkspacesResourceWithRawResponse(self._client.workspaces)
Expand All @@ -546,18 +555,21 @@ def convert(self) -> convert.AsyncConvertResourceWithRawResponse:

@cached_property
def projects(self) -> projects.AsyncProjectsResourceWithRawResponse:
"""Project details and configuration."""
from .resources.projects import AsyncProjectsResourceWithRawResponse

return AsyncProjectsResourceWithRawResponse(self._client.projects)

@cached_property
def templates(self) -> templates.AsyncTemplatesResourceWithRawResponse:
"""Template management and retrieval."""
from .resources.templates import AsyncTemplatesResourceWithRawResponse

return AsyncTemplatesResourceWithRawResponse(self._client.templates)

@cached_property
def workspaces(self) -> workspaces.AsyncWorkspacesResourceWithRawResponse:
"""Workspace access and management."""
from .resources.workspaces import AsyncWorkspacesResourceWithRawResponse

return AsyncWorkspacesResourceWithRawResponse(self._client.workspaces)
Expand All @@ -577,18 +589,21 @@ def convert(self) -> convert.ConvertResourceWithStreamingResponse:

@cached_property
def projects(self) -> projects.ProjectsResourceWithStreamingResponse:
"""Project details and configuration."""
from .resources.projects import ProjectsResourceWithStreamingResponse

return ProjectsResourceWithStreamingResponse(self._client.projects)

@cached_property
def templates(self) -> templates.TemplatesResourceWithStreamingResponse:
"""Template management and retrieval."""
from .resources.templates import TemplatesResourceWithStreamingResponse

return TemplatesResourceWithStreamingResponse(self._client.templates)

@cached_property
def workspaces(self) -> workspaces.WorkspacesResourceWithStreamingResponse:
"""Workspace access and management."""
from .resources.workspaces import WorkspacesResourceWithStreamingResponse

return WorkspacesResourceWithStreamingResponse(self._client.workspaces)
Expand All @@ -608,18 +623,21 @@ def convert(self) -> convert.AsyncConvertResourceWithStreamingResponse:

@cached_property
def projects(self) -> projects.AsyncProjectsResourceWithStreamingResponse:
"""Project details and configuration."""
from .resources.projects import AsyncProjectsResourceWithStreamingResponse

return AsyncProjectsResourceWithStreamingResponse(self._client.projects)

@cached_property
def templates(self) -> templates.AsyncTemplatesResourceWithStreamingResponse:
"""Template management and retrieval."""
from .resources.templates import AsyncTemplatesResourceWithStreamingResponse

return AsyncTemplatesResourceWithStreamingResponse(self._client.templates)

@cached_property
def workspaces(self) -> workspaces.AsyncWorkspacesResourceWithStreamingResponse:
"""Workspace access and management."""
from .resources.workspaces import AsyncWorkspacesResourceWithStreamingResponse

return AsyncWorkspacesResourceWithStreamingResponse(self._client.workspaces)
Expand Down
Loading