Skip to content

Commit

Permalink
Merge branch 'main' into docs-channels
Browse files Browse the repository at this point in the history
  • Loading branch information
cofin authored Jan 10, 2025
2 parents 6cb7981 + 7982793 commit 683a836
Show file tree
Hide file tree
Showing 26 changed files with 1,275 additions and 99 deletions.
24 changes: 17 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ jobs:
strategy:
fail-fast: true
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]
uses: ./.github/workflows/test.yml
with:
coverage: ${{ (matrix.python-version == '3.12' || matrix.python-version == '3.8') }}
Expand All @@ -123,6 +123,9 @@ jobs:
version: "0.5.4"
enable-cache: true

- name: Install Build Dependencies
run: sudo apt-get install build-essential libpq-dev python3-dev -y

- name: Install dependencies
run: |
uv sync
Expand All @@ -142,7 +145,7 @@ jobs:
os: ["macos-latest", "windows-latest"]
uses: ./.github/workflows/test.yml
with:
python-version: "3.12"
python-version: "3.13"
os: ${{ matrix.os }}
timeout: 30

Expand Down Expand Up @@ -190,6 +193,9 @@ jobs:
- name: Check out repository
uses: actions/checkout@v4

- name: Install Build Dependencies
run: sudo apt-get install build-essential libpq-dev python3-dev -y

- name: Set up Python
uses: actions/setup-python@v5
with:
Expand All @@ -215,7 +221,7 @@ jobs:
echo "${{ github.event.number }}" > .pr_number
- name: Upload artifact
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: docs-preview
path: |
Expand Down Expand Up @@ -260,6 +266,9 @@ jobs:
- name: Check out repository
uses: actions/checkout@v4

- name: Install Build Dependencies
run: sudo apt-get install build-essential libpq-dev python3-dev -y

- name: Set up Python
uses: actions/setup-python@v5
with:
Expand All @@ -285,9 +294,9 @@ jobs:
- name: Rename coverage file
run: mv .coverage* .coverage.pydantic_v1

- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
name: coverage-data
name: coverage-data-pydantic_v1-${{ inputs.python-version }}
path: .coverage.pydantic_v1
include-hidden-files: true

Expand All @@ -303,9 +312,10 @@ jobs:
python-version: "3.12"

- name: Download Artifacts
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: coverage-data
pattern: coverage-data*
merge-multiple: true

- name: Combine coverage files
run: |
Expand Down
19 changes: 17 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,21 @@ jobs:
with:
python-version: ${{ inputs.python-version }}

# Linux Source
- name: Install Build Dependencies
run: sudo apt-get install build-essential libpq-dev python3-dev -y
if: startsWith(inputs.os, 'ubuntu')

# MacOS Source
- name: Install Build Dependencies
run: brew install libpq && brew link --force libpq
if: startsWith(inputs.os, 'macos')

# Windows Source
- name: Install Build Dependencies
uses: ikalnytskyi/action-setup-postgres@v7
if: startsWith(inputs.os, 'windows')

- name: Install uv
uses: astral-sh/setup-uv@v5
with:
Expand All @@ -62,9 +77,9 @@ jobs:
if: inputs.coverage
run: mv .coverage .coverage.${{ inputs.python-version }}

- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
if: inputs.coverage
with:
name: coverage-data
name: coverage-data-${{ inputs.python-version }}
path: .coverage.${{ inputs.python-version }}
include-hidden-files: true
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
default_language_version:
python: "3"
python: "3.12"
repos:
- repo: https://github.com/compilerla/conventional-pre-commit
rev: v3.6.0
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2021, 2022, 2023, 2024 Litestar Org.
Copyright (c) 2021, 2022, 2023, 2024, 2025 Litestar Org.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ upgrade: ## Upgrade all dependencies to the latest stable versio

.PHONY: install
install:
@uv sync
@uv sync --all-extras --dev --python 3.12

.PHONY: clean
clean: ## Cleanup temporary build artifacts
Expand Down
7 changes: 6 additions & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
PY_FUNC = "py:func"

project = "Litestar"
copyright = "2024, Litestar-Org"
copyright = "2025, Litestar-Org"
author = "Litestar-Org"
release = os.getenv("_LITESTAR_DOCS_BUILD_VERSION", importlib.metadata.version("litestar").rsplit(".")[0])

Expand Down Expand Up @@ -193,6 +193,11 @@
(PY_CLASS, "advanced_alchemy.types.BigIntIdentity"),
(PY_CLASS, "advanced_alchemy.types.JsonB"),
(PY_CLASS, "advanced_alchemy.repository.SQLAlchemyAsyncRepository"),
# docs in flux as we prepare for `advanced_alchemy` 1.0 release. re-enable when finished
(PY_CLASS, "advanced_alchemy.base.UUIDBase"),
(PY_CLASS, "advanced_alchemy.base.UUIDAuditBase"),
(PY_CLASS, "advanced_alchemy.base.BigIntBase"),
(PY_CLASS, "advanced_alchemy.base.BigIntAuditBase"),
]

nitpick_ignore_regex = [
Expand Down
5 changes: 5 additions & 0 deletions docs/examples/data_transfer_objects/factory/marking_fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@


class User(Base):
# `Base` defines `id` field as:
# id: Mapped[UUID] = mapped_column(default=uuid4, primary_key=True)
name: Mapped[str]
password: Mapped[str] = mapped_column(info=dto_field("private"))
created_at: Mapped[datetime] = mapped_column(info=dto_field("read-only"))
Expand All @@ -20,6 +22,9 @@ class User(Base):

@post("/users", dto=UserDTO, sync_to_thread=False)
def create_user(data: User) -> User:
# even though the client did not send the id field,
# since it is a primary key it is autogenerated
assert "id" in vars(data)
# even though the client sent the password and created_at field, it is not in the data object
assert "password" not in vars(data)
assert "created_at" not in vars(data)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@


class User(Base):
# `Base` defines `id` field as:
# id: Mapped[UUID] = mapped_column(default=uuid4, primary_key=True)
name: Mapped[str]
password: Mapped[str]
created_at: Mapped[datetime]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ async def provide_str() -> str:

@get("/", dependencies={"injected": Provide(provide_str)}, sync_to_thread=False)
def hello_world(injected: int) -> Dict[str, Any]:
"""Handler expects and `int`, but we've provided a `str`."""
"""Handler expects an `int`, but we've provided a `str`."""
return {"hello": injected}


Expand Down
9 changes: 1 addition & 8 deletions docs/examples/testing/test_subprocess_sse.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,11 @@
if sys.platform == "win32":
asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())

pytestmark = pytest.mark.anyio


@pytest.fixture(scope="session")
def anyio_backend() -> str:
return "asyncio"


ROOT = pathlib.Path(__file__).parent


@pytest.fixture(name="async_client", scope="session")
@pytest.fixture(name="async_client")
async def fx_async_client() -> AsyncIterator[httpx.AsyncClient]:
async with subprocess_async_client(workdir=ROOT, app="subprocess_sse_app:app") as client:
yield client
Expand Down
16 changes: 8 additions & 8 deletions docs/migration/flask.rst
Original file line number Diff line number Diff line change
Expand Up @@ -202,11 +202,11 @@ Request methods
+---------------------------------+-------------------------------------------------------------------------------------------------------+
| ``request.environ`` | ``request.scope`` |
+---------------------------------+-------------------------------------------------------------------------------------------------------+
| ``request.files`` | Use ```UploadFile`` <usage/requests/file-uploads>`__ |
| ``request.files`` | Use ``UploadFile`` see in :doc:`/usage/requests` |
+---------------------------------+-------------------------------------------------------------------------------------------------------+
| ``request.form`` | ``request.form()``, prefer ```Body`` <usage/requests/content-type>`__ |
| ``request.form`` | ``request.form()``, prefer ``Body`` see in :doc:`/usage/requests` |
+---------------------------------+-------------------------------------------------------------------------------------------------------+
| ``request.get_json`` | ``request.json()``, prefer the ```data keyword argument`` <usage/requests/request-body>`__ |
| ``request.get_json`` | ``request.json()``, prefer the ``data`` keyword argument, see in :doc:`/usage/requests` |
+---------------------------------+-------------------------------------------------------------------------------------------------------+
| ``request.headers`` | ``request.headers`` |
+---------------------------------+-------------------------------------------------------------------------------------------------------+
Expand Down Expand Up @@ -276,11 +276,11 @@ in Litestar.
.. code-block:: python
from litestar import Litestar
from litestar.static_files import StaticFilesConfig
from litestar.static_files import create_static_files_router
app = Litestar(
[], static_files_config=[StaticFilesConfig(path="/static", directories=["static"])]
)
app = Litestar route_handlers=[
create_static_files_router(path="/static", directories=["assets"]),
])
.. seealso::

Expand Down Expand Up @@ -447,7 +447,7 @@ For redirects, instead of ``redirect`` use ``Redirect``:
@get("/hello")
def hello() -> Redirect:
return Redirect(path="index")
return Redirect(path="/")
app = Litestar([index, hello])
Expand Down
Loading

0 comments on commit 683a836

Please sign in to comment.