Skip to content

Commit

Permalink
merge v3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
provinzkraut committed Jun 15, 2024
2 parents 5c13610 + 69dee52 commit 1882376
Show file tree
Hide file tree
Showing 146 changed files with 3,737 additions and 2,973 deletions.
69 changes: 68 additions & 1 deletion .all-contributorsrc
Original file line number Diff line number Diff line change
Expand Up @@ -626,7 +626,8 @@
"contributions": [
"doc",
"code",
"test"
"test",
"infra"
]
},
{
Expand Down Expand Up @@ -1724,6 +1725,72 @@
"contributions": [
"bug"
]
},
{
"login": "tibor-reiss",
"name": "Tibor Reiss",
"avatar_url": "https://avatars.githubusercontent.com/u/75096465?v=4",
"profile": "https://github.com/tibor-reiss",
"contributions": [
"test",
"doc",
"code"
]
},
{
"login": "0xE111",
"name": "Alex",
"avatar_url": "https://avatars.githubusercontent.com/u/11032969?v=4",
"profile": "https://pogrom.dev",
"contributions": [
"bug",
"code"
]
},
{
"login": "JorenSix",
"name": "Joren Six",
"avatar_url": "https://avatars.githubusercontent.com/u/60453?v=4",
"profile": "http://0110.be",
"contributions": [
"doc"
]
},
{
"login": "jderrien",
"name": "jderrien",
"avatar_url": "https://avatars.githubusercontent.com/u/145396?v=4",
"profile": "https://github.com/jderrien",
"contributions": [
"doc"
]
},
{
"login": "PossiblePanda",
"name": "PossiblePanda",
"avatar_url": "https://avatars.githubusercontent.com/u/85448494?v=4",
"profile": "https://possiblepanda.me",
"contributions": [
"doc"
]
},
{
"login": "evstratbg",
"name": "evstrat",
"avatar_url": "https://avatars.githubusercontent.com/u/10176401?v=4",
"profile": "https://github.com/evstratbg",
"contributions": [
"infra"
]
},
{
"login": "eltociear",
"name": "Ikko Eltociear Ashimine",
"avatar_url": "https://avatars.githubusercontent.com/u/22633385?v=4",
"profile": "https://speakerdeck.com/eltociear",
"contributions": [
"doc"
]
}
],
"contributorsPerLine": 7,
Expand Down
2 changes: 1 addition & 1 deletion .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ FROM python:${VARIANT}
RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
&& apt-get purge -y fish

RUN python3 -m pip install --upgrade setuptools cython pip poetry
RUN python3 -m pip install --upgrade setuptools cython pip pdm
36 changes: 16 additions & 20 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,27 @@
"name": "litestar-org/litestar",
"build": {
"dockerfile": "./Dockerfile",
"context": ".",
"context": "."
},
"features": {
"ghcr.io/devcontainers/features/common-utils:2": {
"installZsh": "true",
"username": "vscode",
"userUid": "1000",
"userGid": "1000",
"upgradePackages": "true",
"upgradePackages": "true"
},
"ghcr.io/devcontainers/features/github-cli:1": {},
"ghcr.io/devcontainers-contrib/features/pre-commit:2": {},
"ghcr.io/devcontainers/features/python:1": "none",
"ghcr.io/devcontainers/features/git:1": {
"version": "latest",
"ppa": "false",
},
"ppa": "false"
}
},
"customizations": {
"codespaces": {
"openFiles": ["CONTRIBUTING.rst"],
"openFiles": ["CONTRIBUTING.rst"]
},
"vscode": {
"extensions": [
Expand All @@ -31,7 +31,7 @@
"github.vscode-github-actions",
"ms-python.black-formatter",
"ms-python.mypy-type-checker",
"charliermarsh.ruff",
"charliermarsh.ruff"
],
"settings": {
"python.editor.defaultFormatter": "charliermarsh.ruff",
Expand All @@ -45,26 +45,22 @@
"terminal.integrated.profiles.linux": {
"bash": {
"path": "bash",
"icon": "terminal-bash",
"icon": "terminal-bash"
},
"zsh": {
"path": "zsh",
"path": "zsh"
},
"fish": {
"path": "fish",
},
},
},
},
"path": "fish"
}
}
}
}
},
"forwardPorts": [8000],
"postCreateCommand": [
"poetry",
"install",
"--extras",
"full",
"--with",
"docs,lint",
"pdm",
"install"
],
"remoteUser": "vscode",
"remoteUser": "vscode"
}
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
blank_lines_enabled: true
blank_issues_enabled: false
contact_links:
- name: Litestar Documentation
url: https://docs.litestar.dev/
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/docs-preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
uses: actions/checkout@v4

- name: Download artifact
uses: dawidd6/action-download-artifact@v3
uses: dawidd6/action-download-artifact@v6
with:
workflow_conclusion: success
run_id: ${{ github.event.workflow_run.id }}
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/pr-labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ name: "Pull Request Labeler"

on:
pull_request_target:
pull_request:

jobs:
apply-labels:
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ repos:
- id: unasyncd
additional_dependencies: ["ruff"]
- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: "v0.3.5"
rev: "v0.4.4"
hooks:
- id: ruff
args: ["--fix"]
Expand Down
12 changes: 6 additions & 6 deletions CITATION.cff
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ title: Litestar
message: 'If you use this software, please cite it as below.'
type: software
authors:
- Janek Nouvertné
- Peter Schutt
- Cody Fincher
- Visakh Unnikrishnan
- Jacob Coffee
- Na'aman Hirschfeld
- given-names: Janek Nouvertné
- given-names: Peter Schutt
- given-names: Cody Fincher
- given-names: Visakh Unnikrishnan
- given-names: Jacob Coffee
- given-names: Na'aman Hirschfeld
repository-code: 'https://github.com/litestar-org/litestar'
url: 'https://docs.litestar.dev/latest/'
abstract: >-
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 Litestar Org.
Copyright (c) 2021, 2022, 2023, 2024 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
11 changes: 10 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@ see [the contribution guide](CONTRIBUTING.rst).
<td align="center" valign="top" width="14.28%"><a href="https://github.com/ste-pool"><img src="https://avatars.githubusercontent.com/u/17198460?v=4?s=100" width="100px;" alt="ste-pool"/><br /><sub><b>ste-pool</b></sub></a><br /><a href="https://github.com/litestar-org/litestar/commits?author=ste-pool" title="Code">💻</a> <a href="#infra-ste-pool" title="Infrastructure (Hosting, Build-Tools, etc)">🚇</a></td>
</tr>
<tr>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/Alc-Alc"><img src="https://avatars.githubusercontent.com/u/45509143?v=4?s=100" width="100px;" alt="Alc-Alc"/><br /><sub><b>Alc-Alc</b></sub></a><br /><a href="https://github.com/litestar-org/litestar/commits?author=Alc-Alc" title="Documentation">📖</a> <a href="https://github.com/litestar-org/litestar/commits?author=Alc-Alc" title="Code">💻</a> <a href="https://github.com/litestar-org/litestar/commits?author=Alc-Alc" title="Tests">⚠️</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/Alc-Alc"><img src="https://avatars.githubusercontent.com/u/45509143?v=4?s=100" width="100px;" alt="Alc-Alc"/><br /><sub><b>Alc-Alc</b></sub></a><br /><a href="https://github.com/litestar-org/litestar/commits?author=Alc-Alc" title="Documentation">📖</a> <a href="https://github.com/litestar-org/litestar/commits?author=Alc-Alc" title="Code">💻</a> <a href="https://github.com/litestar-org/litestar/commits?author=Alc-Alc" title="Tests">⚠️</a> <a href="#infra-Alc-Alc" title="Infrastructure (Hosting, Build-Tools, etc)">🚇</a></td>
<td align="center" valign="top" width="14.28%"><a href="http://asomethings.com"><img src="https://avatars.githubusercontent.com/u/16171942?v=4?s=100" width="100px;" alt="asomethings"/><br /><sub><b>asomethings</b></sub></a><br /><a href="https://github.com/litestar-org/litestar/commits?author=asomethings" title="Code">💻</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/garburator"><img src="https://avatars.githubusercontent.com/u/14207857?v=4?s=100" width="100px;" alt="Garry Bullock"/><br /><sub><b>Garry Bullock</b></sub></a><br /><a href="https://github.com/litestar-org/litestar/commits?author=garburator" title="Documentation">📖</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/NiclasHaderer"><img src="https://avatars.githubusercontent.com/u/109728711?v=4?s=100" width="100px;" alt="Niclas Haderer"/><br /><sub><b>Niclas Haderer</b></sub></a><br /><a href="https://github.com/litestar-org/litestar/commits?author=NiclasHaderer" title="Code">💻</a></td>
Expand Down Expand Up @@ -558,6 +558,15 @@ see [the contribution guide](CONTRIBUTING.rst).
<td align="center" valign="top" width="14.28%"><a href="https://github.com/carlsmedstad"><img src="https://avatars.githubusercontent.com/u/6952324?v=4?s=100" width="100px;" alt="Carl Smedstad"/><br /><sub><b>Carl Smedstad</b></sub></a><br /><a href="https://github.com/litestar-org/litestar/commits?author=carlsmedstad" title="Tests">⚠️</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/maintain0404"><img src="https://avatars.githubusercontent.com/u/50428534?v=4?s=100" width="100px;" alt="Taein Min"/><br /><sub><b>Taein Min</b></sub></a><br /><a href="https://github.com/litestar-org/litestar/commits?author=maintain0404" title="Documentation">📖</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/wallseat"><img src="https://avatars.githubusercontent.com/u/26143672?v=4?s=100" width="100px;" alt="Stanislav Lyu."/><br /><sub><b>Stanislav Lyu.</b></sub></a><br /><a href="https://github.com/litestar-org/litestar/issues?q=author%3Awallseat" title="Bug reports">🐛</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/tibor-reiss"><img src="https://avatars.githubusercontent.com/u/75096465?v=4?s=100" width="100px;" alt="Tibor Reiss"/><br /><sub><b>Tibor Reiss</b></sub></a><br /><a href="https://github.com/litestar-org/litestar/commits?author=tibor-reiss" title="Tests">⚠️</a> <a href="https://github.com/litestar-org/litestar/commits?author=tibor-reiss" title="Documentation">📖</a> <a href="https://github.com/litestar-org/litestar/commits?author=tibor-reiss" title="Code">💻</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://pogrom.dev"><img src="https://avatars.githubusercontent.com/u/11032969?v=4?s=100" width="100px;" alt="Alex"/><br /><sub><b>Alex</b></sub></a><br /><a href="https://github.com/litestar-org/litestar/issues?q=author%3A0xE111" title="Bug reports">🐛</a> <a href="https://github.com/litestar-org/litestar/commits?author=0xE111" title="Code">💻</a></td>
</tr>
<tr>
<td align="center" valign="top" width="14.28%"><a href="http://0110.be"><img src="https://avatars.githubusercontent.com/u/60453?v=4?s=100" width="100px;" alt="Joren Six"/><br /><sub><b>Joren Six</b></sub></a><br /><a href="https://github.com/litestar-org/litestar/commits?author=JorenSix" title="Documentation">📖</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/jderrien"><img src="https://avatars.githubusercontent.com/u/145396?v=4?s=100" width="100px;" alt="jderrien"/><br /><sub><b>jderrien</b></sub></a><br /><a href="https://github.com/litestar-org/litestar/commits?author=jderrien" title="Documentation">📖</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://possiblepanda.me"><img src="https://avatars.githubusercontent.com/u/85448494?v=4?s=100" width="100px;" alt="PossiblePanda"/><br /><sub><b>PossiblePanda</b></sub></a><br /><a href="https://github.com/litestar-org/litestar/commits?author=PossiblePanda" title="Documentation">📖</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/evstratbg"><img src="https://avatars.githubusercontent.com/u/10176401?v=4?s=100" width="100px;" alt="evstrat"/><br /><sub><b>evstrat</b></sub></a><br /><a href="#infra-evstratbg" title="Infrastructure (Hosting, Build-Tools, etc)">🚇</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://speakerdeck.com/eltociear"><img src="https://avatars.githubusercontent.com/u/22633385?v=4?s=100" width="100px;" alt="Ikko Eltociear Ashimine"/><br /><sub><b>Ikko Eltociear Ashimine</b></sub></a><br /><a href="https://github.com/litestar-org/litestar/commits?author=eltociear" title="Documentation">📖</a></td>
</tr>
</tbody>
</table>
Expand Down
2 changes: 2 additions & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@
(PY_CLASS, "advanced_alchemy.extensions.litestar.config.SQLAlchemySyncConfig"),
(PY_CLASS, "advanced_alchemy.extensions.litestar.config.SQLAlchemyAsyncConfig"),
(PY_METH, "advanced_alchemy.extensions.litestar.plugins.SQLAlchemySerializationPlugin.create_dto_for_type"),
(PY_CLASS, "advanced_alchemy.base.BasicAttributes"),
(PY_CLASS, "advanced_alchemy.config.AsyncSessionConfig"),
(PY_CLASS, "advanced_alchemy.config.SyncSessionConfig"),
(PY_CLASS, "advanced_alchemy.types.JsonB"),
Expand All @@ -192,6 +193,7 @@
(PY_CLASS, "litestar.middleware.compression.gzip_facade.GzipCompression"),
(PY_CLASS, "litestar.openapi.OpenAPIController"),
(PY_CLASS, "openapi.controller.OpenAPIController"),
(PY_CLASS, "litestar.handlers.http_handlers.decorators._SubclassWarningMixin"),
]

nitpick_ignore_regex = [
Expand Down
Empty file.
22 changes: 22 additions & 0 deletions docs/examples/caching/cache.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
from litestar import Litestar, get
from litestar.config.response_cache import CACHE_FOREVER


@get("/cached", cache=True)
async def my_cached_handler() -> str:
return "cached"


@get("/cached-seconds", cache=120) # seconds
async def my_cached_handler_seconds() -> str:
return "cached for 120 seconds"


@get("/cached-forever", cache=CACHE_FOREVER)
async def my_cached_handler_forever() -> str:
return "cached forever"


app = Litestar(
[my_cached_handler, my_cached_handler_seconds, my_cached_handler_forever],
)
9 changes: 9 additions & 0 deletions docs/examples/caching/key_builder.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
from litestar import Litestar, Request
from litestar.config.response_cache import ResponseCacheConfig


def key_builder(request: Request) -> str:
return request.url.path + request.headers.get("my-header", "")


app = Litestar([], response_cache_config=ResponseCacheConfig(key_builder=key_builder))
13 changes: 13 additions & 0 deletions docs/examples/caching/key_builder_for_route_handler.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
from litestar import Litestar, Request, get


def key_builder(request: Request) -> str:
return request.url.path + request.headers.get("my-header", "")


@get("/cached-path", cache=True, cache_key_builder=key_builder)
async def cached_handler() -> str:
return "cached"


app = Litestar([cached_handler])
20 changes: 20 additions & 0 deletions docs/examples/caching/redis_store.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import asyncio

from litestar import Litestar, get
from litestar.config.response_cache import ResponseCacheConfig
from litestar.stores.redis import RedisStore


@get(cache=10)
async def something() -> str:
await asyncio.sleep(1)
return "something"


redis_store = RedisStore.with_client(url="redis://localhost/", port=6379, db=0)
cache_config = ResponseCacheConfig(store="redis_backed_store")
app = Litestar(
[something],
stores={"redis_backed_store": redis_store},
response_cache_config=cache_config,
)
13 changes: 7 additions & 6 deletions docs/examples/contrib/prometheus/using_prometheus_exporter.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
from litestar import Litestar
from litestar.contrib.prometheus import PrometheusConfig, PrometheusController

# Default app name and prefix is litestar.
prometheus_config = PrometheusConfig()

def create_app(group_path: bool = False):
# Default app name and prefix is litestar.
prometheus_config = PrometheusConfig(group_path=group_path)

# By default the metrics are available in prometheus format and the path is set to '/metrics'.
# If you want to change the path and format you can do it by subclassing the PrometheusController class.
# By default the metrics are available in prometheus format and the path is set to '/metrics'.
# If you want to change the path and format you can do it by subclassing the PrometheusController class.

# Creating the litestar app instance with our custom PrometheusConfig and PrometheusController.
app = Litestar(route_handlers=[PrometheusController], middleware=[prometheus_config.middleware])
# Creating the litestar app instance with our custom PrometheusConfig and PrometheusController.
return Litestar(route_handlers=[PrometheusController], middleware=[prometheus_config.middleware])
Loading

0 comments on commit 1882376

Please sign in to comment.