Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(release): v2.8.0 #3226

Merged
merged 19 commits into from
Apr 5, 2024
Merged

chore(release): v2.8.0 #3226

merged 19 commits into from
Apr 5, 2024

Conversation

provinzkraut
Copy link
Member

Standing PR for the 2.8.0 release

Important

  • Use rebasing to bring the latest changes from main into this branch as it makes the process of merging it back into main with a merge commit when the release is due easier
  • Use a merge commit without squashing when merging this branch into main to keep the history of the feature commits intact

Copy link

codecov bot commented Mar 18, 2024

Codecov Report

Attention: Patch coverage is 98.84393% with 4 lines in your changes are missing coverage. Please review.

Project coverage is 98.26%. Comparing base (23ec590) to head (6197137).

Files Patch % Lines
litestar/cli/_utils.py 87.50% 1 Missing and 1 partial ⚠️
litestar/_openapi/plugin.py 98.24% 0 Missing and 1 partial ⚠️
litestar/openapi/plugins.py 98.97% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3226      +/-   ##
==========================================
+ Coverage   98.23%   98.26%   +0.02%     
==========================================
  Files         320      322       +2     
  Lines       14463    14715     +252     
  Branches     2299     2342      +43     
==========================================
+ Hits        14208    14459     +251     
- Misses        114      117       +3     
+ Partials      141      139       -2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@JacobCoffee JacobCoffee added this to the 2.8.0 milestone Mar 27, 2024
@provinzkraut provinzkraut force-pushed the develop branch 3 times, most recently from 039700c to f86920d Compare March 30, 2024 17:19
cofin and others added 18 commits April 5, 2024 11:26
In some cases, I've wanted to change the name of the "Application" to show something else instead of "Litestar".  This is usually to make a CLI feel more cohesive and part of a larger application.  In the same vein, I've found cases where I wanted to complete suppress the initial `from_env` or the Rich info table at startup.
---------

Co-authored-by: Janek Nouvertné <[email protected]>
Co-authored-by: Jacob Coffee <[email protected]>
* refactor: openapi router

This PR refactors the way that we support multiple UIs for OpenAPI.

We add `litestar.openapi.plugins` where `OpenAPIRenderPlugin` is defined, and implementations of that plugin for the frameworks we currently support.

We add `OpenAPIConfig.render_plugins` config option, where a user can explicitly declare a set of plugins for UIs they wish to support.

If a user declares a sub-class of `OpenAPIController` at `OpenAPIConfig.openapi_controller`, then existing behavior is preserved exactly.

However, if no controller is explicitly declared, we invoke the new router-based approach, which should behave identically to the controller based approach (i.e., respect `enabled_endpoints` and `root_schema_site`).

Closes #2541

* docs: start of documentation re-write.

- creates an indexed directory for openapi
- removes the controller docs
- start of docs for plugins

* refactor: move JsonRenderPlugin into private ns

We add the json plugin, and have hardcoded refs to the path that it serves, so best not to make this public API just yet.

* docs: reference docs for plugins

* Revert "refactor: move JsonRenderPlugin into private ns"

This reverts commit 60719aa.

* docs: JsonRenderPlugin undocumented.

* docs: continue plugin docs

* test: run tests for both plugin and controller

Modifies tests where appropriate to run on both the plugin-based approach and the controller based approach.

* Implement default endpoint selection logic.

* Deprecation of OpenAPIController configs

* docs: swagger oauth examples

* Update docs/usage/openapi/ui_plugins.rst

* Update docs/usage/openapi/ui_plugins.rst

* fix: linting

* refactor: don't rely on DI for openapi schema in plugin handler.

* fix(test): there's an extra schema route to serve 404s.

* fix(docs): docstring indent

* fix(lint): remove redundant return

* refactor: plugins receive style tag instead of tag content.

* feat: allow openapi router to be handed to openapi config.

Allows for customization, such as adding guards, middleware, other routes, etc.

* feat: add `scalar` schema ui (#2906)

* Update litestar/openapi/plugins.py

Co-authored-by: Jacob Coffee <[email protected]>

* Update litestar/openapi/plugins.py

Co-authored-by: Jacob Coffee <[email protected]>

* Update litestar/openapi/plugins.py

Co-authored-by: Jacob Coffee <[email protected]>

* Update litestar/openapi/config.py

Co-authored-by: Jacob Coffee <[email protected]>

* Update litestar/openapi/config.py

Co-authored-by: Jacob Coffee <[email protected]>

* fix: update deprecation version

* fix: use GH repo for scalar links

* fix: update default scalar version

* fix: scalar plugin style attribute render.

Plugins expect that the style value is already wrapped in `<style>` tags.

* fix: serve default static files via jsdeliver

* fix: docstring syntax

* fix: removes custom repr

Can always add if there's a need for it, but we aren't using it.

* docs: another pass

* fix: style

* fix: test for updated build openapi plugin example

* fix: absolute paths for openapi.json

Resolves #3047 for the openapi router case.

* refactor: simplify scalar plugin.

* fix: linting

* Update litestar/_openapi/plugin.py

* refactor: test app to use scalar ui plugin

* fix: plugin customization example

Version arg is ignored if `js_url` is provided.

* fix: remove unnecessary kwargs

Removes passing default values to plugin kwargs in examples.

* fix: grammar error

* feat: make OpenAPIRenderPlugin an ABC

Abstract on `render()` method.

* fix: correct referenced lines

Referenced LoC in example had drifted.

* fix: more small docs corrections

* chore: remove dup spec of enabled endpoints.

* fix: simplify test.

---------

Co-authored-by: Jacob Coffee <[email protected]>
* Enable DTO codegen backend by default
* Update docs
* feat: Added precedence of CLI parameters over envs

* Update docs/usage/cli.rst

Co-authored-by: Peter Schutt <[email protected]>

* Remove redundant LitestarEnv fields and fix tests

* Update docs/usage/cli.rst

* Update litestar/cli/commands/core.py

* Update docs/usage/cli.rst

* Update docs/usage/cli.rst

* Update litestar/cli/commands/core.py

---------

Co-authored-by: kedod <kedod>
Co-authored-by: Peter Schutt <[email protected]>
Co-authored-by: Jacob Coffee <[email protected]>
* feat: Support `schema_extra` in `Parameter` and `Body` (#3022)

This adds sort of a backdoor for modifying the generated OpenAPI spec.

The value is given as `dict[str, Any]` where the key must match with the
keyword parameter name in `Schema`. The values are used to override items in
the generated `Schema` object, so they must be in correct types (ie. not in
dictionary/json format).

The values are added at main level, without recursive merging (because we're
adjusting `Schema` object and not a dictionary). Recursive merge would be much
more work.

Chose not to implement the same for `ResponseSpec` because response models are
generated as schema components, while `ResponseSpec` can be locally different.
Handling the logic of creating new components when `schema_extra` is passed in
`ResponseSpec` would be extra effort, and isn't probably as important as being
able to adjust the inbound parameters, which are actually validated (and for
which the documentation is even more important, than for the response).

* Update litestar/params.py

Co-authored-by: Jacob Coffee <[email protected]>

* Update litestar/params.py

Co-authored-by: Jacob Coffee <[email protected]>

* Update litestar/params.py

Co-authored-by: Jacob Coffee <[email protected]>

---------

Co-authored-by: Jacob Coffee <[email protected]>
Adds deprecated directives for the deprecated parameters of the config.

Adds some cross-references.
* feat: add typevar expansion #3240

* chore: resolve all PR suggestion #3242

* chore: resolve import formatting

* chore: resolve import formatting
* adding draft for security exclusion docs

* adding section to security toctree

* Update docs/usage/security/excluding-and-including-endpoints.rst

* Update docs/usage/security/excluding-and-including-endpoints.rst

* Update docs/usage/security/excluding-and-including-endpoints.rst

---------

Co-authored-by: Jacob Coffee <[email protected]>
* feat: Add LITESTAR_ prefix for web concurrency env option

* Replace depacrated with versionchanged directive

* Change wc option description

* Remove depracation warning

---------

Co-authored-by: kedod <kedod>
Add "TRACE" to HttpMethod enum
feat: pydantic DTO with non-instantiable types.

This PR simplifies the type that we apply to transfer models for pydantic field types in specific circumstances.

- `JsonValue`: this field type is an instance of `TypeAliasType` at runtime, and contains recursive type definitions. Pydantic allow `list`, `dict`, `str`, `bool`, `int`, `float` and `None`, and the value types of `list` and `dict` are allowed to be the same. We type this as `Any` on the transfer models as this is pretty much the same thing for msgspec ([ref][1]).
- `EmailStr`. These are typed as `EmailStr` which is a class at runtime which is not a `str`, however they are a string and `if TYPE_CHECKING` is used to get type checkers to play along. If we return a `str` from a msgspec decode hook for the type, it msgspec won't validate the input. So we must tell msgspec its a string. This also works well with encoding because it is one.
- IP/Network/Interface types. These are represented by types such as `IPvAnyAddress`, but they are actually parsed into instances of stdlib types such as `IPv4Address` and others from the `ipaddress` module. Given that an instance of `IPvAnyAddress` cannot be meaningfully returned from a decoding hook, we have to tell msgspec that these are strings on the transfer models. Encoding the stdlib ip types to str is natively handled by msgspec.

Closes #2334

1: https://jcristharif.com/msgspec/supported-types.html#any
* docs: update usage/routing/*

* ci: add ``sphinx-paramlinks``

ci: add ``sphinx-paramlinks``

* Update docs/usage/routing/handlers.rst

Co-authored-by: Peter Schutt <[email protected]>

* Update docs/usage/routing/handlers.rst

Co-authored-by: Peter Schutt <[email protected]>

* Update docs/usage/routing/handlers.rst

Co-authored-by: Peter Schutt <[email protected]>

* Update docs/usage/routing/handlers.rst

Co-authored-by: Peter Schutt <[email protected]>

* Update docs/usage/routing/handlers.rst

Co-authored-by: Peter Schutt <[email protected]>

* Update docs/usage/routing/handlers.rst

Co-authored-by: Peter Schutt <[email protected]>

* Update docs/usage/routing/overview.rst

* Update docs/usage/routing/parameters.rst

* docs(review): apply code review

* docs(review): apply code review

* docs(review): apply code review

* docs(review): apply code review

* docs(review): apply code review

* docs(review): apply code review

---------

Co-authored-by: Peter Schutt <[email protected]>
@JacobCoffee JacobCoffee marked this pull request as ready for review April 5, 2024 16:38
@JacobCoffee JacobCoffee requested review from JacobCoffee and a team as code owners April 5, 2024 16:38
@JacobCoffee JacobCoffee changed the title chore: Release 2.8 chore(release): v2.8.0 Apr 5, 2024
chore(ci): bump deps
@JacobCoffee JacobCoffee self-assigned this Apr 5, 2024
Copy link

sonarqubecloud bot commented Apr 5, 2024

@JacobCoffee JacobCoffee merged commit 60c7e05 into main Apr 5, 2024
23 checks passed
Copy link

github-actions bot commented Apr 5, 2024

Documentation preview will be available shortly at https://litestar-org.github.io/litestar-docs-preview/3226

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.

9 participants