Skip to content

refactor: implement Uvicorn factory pattern and clean up test suite - #405

Merged
jonhealy1 merged 2 commits into
stac-utils:mainfrom
jonhealy1:use-factory
Jul 24, 2026
Merged

refactor: implement Uvicorn factory pattern and clean up test suite#405
jonhealy1 merged 2 commits into
stac-utils:mainfrom
jonhealy1:use-factory

Conversation

@jonhealy1

@jonhealy1 jonhealy1 commented Jul 24, 2026

Copy link
Copy Markdown
Collaborator

Related Issue(s):

Description:

  • Refactored application initialization to completely eliminate global state and natively support the Uvicorn --factory pattern. Replaced the global app variable with a create_app() factory wrapper in app.py, ensuring pristine memory isolation per worker and preventing unintended import side-effects. Additionally, updated the test suite to use the new factory pattern (eliminating shadow implementations) and fixed httpx async client compatibility.

PR Checklist:

  • pre-commit hooks pass locally
  • Tests pass (run make test)
  • Documentation has been updated to reflect changes, if applicable, and docs build successfully (run make docs)
  • Changes are added to the CHANGELOG.

@jonhealy1 jonhealy1 changed the title use factory refactor: implement Uvicorn factory pattern and clean up test suite Jul 24, 2026
@jonhealy1
jonhealy1 requested a review from vincentsarago July 24, 2026 16:40
@vincentsarago
vincentsarago self-requested a review July 24, 2026 16:43
@jonhealy1
jonhealy1 merged commit 63a5c3e into stac-utils:main Jul 24, 2026
6 checks passed
@jonhealy1
jonhealy1 deleted the use-factory branch July 24, 2026 16:44
@vincentsarago

Copy link
Copy Markdown
Member

thanks @jonhealy1

can you also change the Dockerfile

CMD ["uvicorn", "stac_fastapi.pgstac.app:app", "--host", "0.0.0.0", "--port", "8080"]

oops too fast 😅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants