mirror of
https://github.com/Comfy-Org/comfy-python-sdk.git
synced 2026-11-04 23:37:47 +00:00
[PR #43] [MERGED] feat!: configure the base URL via COMFY_BASE_URL instead of a constructor argument #50
Labels
No labels
audit:ai-readiness
audit:community
audit:github
audit:health-scoring
audit:policy
audit:release
audit:supply-chain
effort:medium
effort:small
effort:small
effort:trivial
priority:nice-to-have
priority:nice-to-have
priority:recommended
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Comfy-Org/comfy-python-sdk#50
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/Comfy-Org/comfy-python-sdk/pull/43
Author: @wei-hai
Created: 8/11/2026
Status: ✅ Merged
Merged: 8/11/2026
Merged by: @wei-hai
Base:
main← Head:wei/be-6958-sdk-base-url-env-var📝 Commits (4)
95bd1fffeat!: configure the base URL via COMFY_BASE_URL, not a constructor argument6f4b204fix: address review — reject malformed ports, document the migrationb8a2fcbfix: reject a base URL carrying a query or fragment3a8f21etest: stop mutating os.environ in the gateway fixture📊 Changes
17 files changed (+284 additions, -128 deletions)
View changed files
📝
README.md(+35 -17)📝
src/comfy_sdk/__init__.py(+7 -4)📝
src/comfy_sdk/client.py(+56 -9)📝
tests/conftest.py(+21 -3)📝
tests/integration/test_gateway_e2e.py(+3 -3)📝
tests/test_assets.py(+4 -4)📝
tests/test_async.py(+13 -13)📝
tests/test_auth_headers.py(+2 -2)➕
tests/test_base_url_env.py(+103 -0)📝
tests/test_content_redirect_security.py(+2 -2)➖
tests/test_default_base_url.py(+0 -33)📝
tests/test_download_and_workflows.py(+4 -4)📝
tests/test_events.py(+5 -5)📝
tests/test_get_download_url.py(+5 -5)📝
tests/test_jobs.py(+18 -18)📝
tests/test_sse_idle.py(+3 -3)📝
tests/test_user_agent.py(+3 -3)📄 Description
Comfy()/AsyncComfy()target Comfy Cloud; another deployment is selected with theCOMFY_BASE_URLenvironment variable. The base-URL constructor parameter is removed, so an arbitrary endpoint is no longer part of the call surface.Breaking:
Comfy(base_url, api_key)→Comfy(api_key=...)+COMFY_BASE_URL.api_keyis keyword-only now, so the old positional form raisesTypeErrorinstead of quietly reading a URL as a key.The variable is read per construction (not at import), must be an
http(s)URL, and unset-or-blank means Comfy Cloud.Test suite: the
serverfixture points the SDK at the stub by setting the variable, so tests construct a bareComfy(); an autouse fixture scrubs an ambient value so a developer's own shell can't aim the suite at a real deployment. That is most of the diff.Scope: the public clients only.
comfy_low(the documented escape hatch) still takes a base URL — it is what the clients build on.Verified:
ruff check,ruff format --check,mypy src,pytest(120 pass, 4 skipped).Matching change in
comfy-typescript-sdkkeeps the two SDKs in lockstep.Summary by CodeRabbit
New Features
COMFY_BASE_URLenvironment variable.Documentation
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.