internlm/SWE-Fixer-Train-110K huggingface dataset:
Repository: litestar-org/litestar

Issue:
StaticFilesConfig and virtual directories
I'm trying to write a ``FileSystemProtocol`` to load files from the package data using [importlib_resources](https://importlib-resources.readthedocs.io/en/latest/using.html#). But because ``directories`` is defined as ``DirectoryPath``, pydantic checks if the given directories exist in the local filesystem. 

This is not generally true, especially in any kind of virtual filesystem (e.g. a zipped package). I think this condition should be relaxed to support virtual filesystems.

https://github.com/starlite-api/starlite/blob/9bb6dcd57c10a591377cf8e3a537e9292566d5b9/starlite/config/static_files.py#L32


Discussion:
I agree. Do you want to submit a PR?

Resolving patch:
diff --git a/litestar/_openapi/responses.py b/litestar/_openapi/responses.py
--- a/litestar/_openapi/responses.py
+++ b/litestar/_openapi/responses.py
@@ -91,13 +91,13 @@ def create_success_response(  # noqa: C901
     if return_annotation is not Signature.empty and not return_type.is_subclass_of(
         (NoneType, File, Redirect, Stream, ASGIResponse)
     ):
+        media_type = route_handler.media_type
         if return_annotation is Template:
             return_annotation = str
-            route_handler.media_type = get_enum_string_value(MediaType.HTML)
+            media_type = media_type or MediaType.HTML
         elif return_type.is_subclass_of(LitestarResponse):
             return_annotation = return_type.inner_types[0].annotation if return_type.inner_types else Any
-            if not route_handler.media_type:
-                route_handler.media_type = get_enum_string_value(MediaType.JSON)
+            media_type = media_type or MediaType.JSON
 
         if dto := route_handler.resolve_return_dto():
             result = dto.create_openapi_schema("return", str(route_handler), generate_examples, schemas, False)
@@ -116,8 +116,7 @@ def create_success_response(  # noqa: C901
         schema.content_media_type = route_handler.content_media_type
 
         response = OpenAPIResponse(
-            content={route_handler.media_type: OpenAPIMediaType(schema=result)},
-            description=description,
+            content={get_enum_string_value(media_type): OpenAPIMediaType(schema=result)}, description=description
         )
 
     elif return_type.is_subclass_of(Redirect):


Test patch:
Repository: litestar-org/litestar

Issue:
Migrating from `msgspec.from_builtins` to `msgspec.convert`
Msgspec deprecated `from_builtins` in favour of `convert` in the latest release. We should update accordingly.

See https://github.com/jcrist/msgspec/releases/tag/0.16.0 and https://jcristharif.com/msgspec/converters.html


Discussion:

Resolving patch:
diff --git a/litestar/dto/factory/_backends/msgspec/backend.py b/litestar/dto/factory/_backends/msgspec/backend.py
--- a/litestar/dto/factory/_backends/msgspec/backend.py
+++ b/litestar/dto/factory/_backends/msgspec/backend.py
@@ -2,7 +2,7 @@
 
 from typing import TYPE_CHECKING, NewType, TypeVar
 
-from msgspec import Struct, from_builtins
+from msgspec import Struct, convert
 
 from litestar.dto.factory._backends.abc import AbstractDTOBackend
 from litestar.serialization import decode_media_type
@@ -35,4 +35,4 @@ def parse_raw(self, raw: bytes, connection_context: ConnectionContext) -> Struct
         )
 
     def parse_builtins(self, builtins: Any, connection_context: ConnectionContext) -> Any:
-        return from_builtins(builtins, self.annotation)
+        return convert(builtins, self.annotation)


Test patch:
Repository: litestar-org/litestar

Issue:
StaticFilesConfig and virtual directories
I'm trying to write a ``FileSystemProtocol`` to load files from the package data using [importlib_resources](https://importlib-resources.readthedocs.io/en/latest/using.html#). But because ``directories`` is defined as ``DirectoryPath``, pydantic checks if the given directories exist in the local filesystem. 

This is not generally true, especially in any kind of virtual filesystem (e.g. a zipped package). I think this condition should be relaxed to support virtual filesystems.

https://github.com/starlite-api/starlite/blob/9bb6dcd57c10a591377cf8e3a537e9292566d5b9/starlite/config/static_files.py#L32


Discussion:
I agree. Do you want to submit a PR?

Resolving patch:
diff --git a/litestar/constants.py b/litestar/constants.py
--- a/litestar/constants.py
+++ b/litestar/constants.py
@@ -14,7 +14,7 @@
 ONE_MEGABYTE = 1024 * 1024
 OPENAPI_NOT_INITIALIZED = "Litestar has not been instantiated with OpenAPIConfig"
 REDIRECT_STATUS_CODES = {301, 302, 303, 307, 308}
-REDIRECT_ALLOWED_MEDIA_TYPES = {MediaType.TEXT, MediaType.HTML}
+REDIRECT_ALLOWED_MEDIA_TYPES = {MediaType.TEXT, MediaType.HTML, MediaType.JSON}
 RESERVED_KWARGS = {"state", "headers", "cookies", "request", "socket", "data", "query", "scope", "body"}
 SCOPE_STATE_DEPENDENCY_CACHE: Literal["dependency_cache"] = "dependency_cache"
 SCOPE_STATE_NAMESPACE: Literal["__litestar__"] = "__litestar__"


Test patch:
diff --git a/tests/unit/test_response/test_redirect_response.py b/tests/unit/test_response/test_redirect_response.py
--- a/tests/unit/test_response/test_redirect_response.py
+++ b/tests/unit/test_response/test_redirect_response.py
@@ -81,7 +81,7 @@ async def app(scope: "Scope", receive: "Receive", send: "Send") -> None:
 
 def test_redirect_response_media_type_validation() -> None:
     with pytest.raises(ImproperlyConfiguredException):
-        ASGIRedirectResponse(path="/", media_type="application/json")
+        ASGIRedirectResponse(path="/", media_type="application/mspgpack")
 
 
 @pytest.mark.parametrize(
Repository: litestar-org/litestar

Issue:
StaticFilesConfig and virtual directories
I'm trying to write a ``FileSystemProtocol`` to load files from the package data using [importlib_resources](https://importlib-resources.readthedocs.io/en/latest/using.html#). But because ``directories`` is defined as ``DirectoryPath``, pydantic checks if the given directories exist in the local filesystem. 

This is not generally true, especially in any kind of virtual filesystem (e.g. a zipped package). I think this condition should be relaxed to support virtual filesystems.

https://github.com/starlite-api/starlite/blob/9bb6dcd57c10a591377cf8e3a537e9292566d5b9/starlite/config/static_files.py#L32


Discussion:
I agree. Do you want to submit a PR?

Resolving patch:
diff --git a/litestar/stores/file.py b/litestar/stores/file.py
--- a/litestar/stores/file.py
+++ b/litestar/stores/file.py
@@ -64,7 +64,7 @@ def _write_sync(self, target_file: Path, storage_obj: StorageObject) -> None:
                 finally:
                     os.close(tmp_file_fd)
 
-                shutil.move(tmp_file_name, target_file)
+                os.replace(tmp_file_name, target_file)  # noqa: PTH105
                 renamed = True
             finally:
                 if not renamed:


Test patch:
diff --git a/tests/unit/test_stores.py b/tests/unit/test_stores.py
--- a/tests/unit/test_stores.py
+++ b/tests/unit/test_stores.py
@@ -344,7 +344,7 @@ def test_registry_register_exist_override(memory_store: MemoryStore) -> None:
 
 
 async def test_file_store_handle_rename_fail(file_store: FileStore, mocker: MockerFixture) -> None:
-    mocker.patch("litestar.stores.file.shutil.move", side_effect=OSError)
+    mocker.patch("litestar.stores.file.os.replace", side_effect=OSError)
     mock_unlink = mocker.patch("litestar.stores.file.os.unlink")
 
     await file_store.set("foo", "bar")
Repository: litestar-org/litestar

Issue:
StaticFilesConfig and virtual directories
I'm trying to write a ``FileSystemProtocol`` to load files from the package data using [importlib_resources](https://importlib-resources.readthedocs.io/en/latest/using.html#). But because ``directories`` is defined as ``DirectoryPath``, pydantic checks if the given directories exist in the local filesystem. 

This is not generally true, especially in any kind of virtual filesystem (e.g. a zipped package). I think this condition should be relaxed to support virtual filesystems.

https://github.com/starlite-api/starlite/blob/9bb6dcd57c10a591377cf8e3a537e9292566d5b9/starlite/config/static_files.py#L32


Discussion:
I agree. Do you want to submit a PR?

Resolving patch:
diff --git a/litestar/cli/main.py b/litestar/cli/main.py
--- a/litestar/cli/main.py
+++ b/litestar/cli/main.py
@@ -27,7 +27,7 @@
     click.rich_click.STYLE_ERRORS_SUGGESTION = "magenta italic"
     click.rich_click.ERRORS_SUGGESTION = ""
     click.rich_click.ERRORS_EPILOGUE = ""
-    click.rich_click.MAX_WIDTH = 100
+    click.rich_click.MAX_WIDTH = 80
     click.rich_click.SHOW_METAVARS_COLUMN = True
     click.rich_click.APPEND_METAVARS_HELP = True
 


Test patch:
Repository: litestar-org/litestar

Issue:
StaticFilesConfig and virtual directories
I'm trying to write a ``FileSystemProtocol`` to load files from the package data using [importlib_resources](https://importlib-resources.readthedocs.io/en/latest/using.html#). But because ``directories`` is defined as ``DirectoryPath``, pydantic checks if the given directories exist in the local filesystem. 

This is not generally true, especially in any kind of virtual filesystem (e.g. a zipped package). I think this condition should be relaxed to support virtual filesystems.

https://github.com/starlite-api/starlite/blob/9bb6dcd57c10a591377cf8e3a537e9292566d5b9/starlite/config/static_files.py#L32


Discussion:
I agree. Do you want to submit a PR?

Resolving patch:
diff --git a/docs/examples/contrib/sqlalchemy/sqlalchemy_repository_bulk_operations.py b/docs/examples/contrib/sqlalchemy/sqlalchemy_repository_bulk_operations.py
--- a/docs/examples/contrib/sqlalchemy/sqlalchemy_repository_bulk_operations.py
+++ b/docs/examples/contrib/sqlalchemy/sqlalchemy_repository_bulk_operations.py
@@ -63,7 +63,7 @@ def run_script() -> None:
         USState.metadata.create_all(conn)
 
     with session_factory() as db_session:
-        # 1) load the JSON data into the US States table
+        # 1) Load the JSON data into the US States table.
         repo = USStateRepository(session=db_session)
         fixture = open_fixture(here, USStateRepository.model_type.__tablename__)  # type: ignore
         objs = repo.add_many([USStateRepository.model_type(**raw_obj) for raw_obj in fixture])
@@ -74,11 +74,11 @@ def run_script() -> None:
         created_objs, total_objs = repo.list_and_count(LimitOffset(limit=10, offset=0))
         console.print(f"Selected {len(created_objs)} records out of a total of {total_objs}.")
 
-        # 2) Let's remove the batch of records selected.
+        # 3) Let's remove the batch of records selected.
         deleted_objs = repo.delete_many([new_obj.id for new_obj in created_objs])
         console.print(f"Removed {len(deleted_objs)} records out of a total of {total_objs}.")
 
-        # 3) Le'ts count the remaining rows
+        # 4) Let's count the remaining rows
         remaining_count = repo.count()
         console.print(f"Found {remaining_count} remaining records after delete.")
 


Test patch:
Repository: litestar-org/litestar

Issue:
StaticFilesConfig and virtual directories
I'm trying to write a ``FileSystemProtocol`` to load files from the package data using [importlib_resources](https://importlib-resources.readthedocs.io/en/latest/using.html#). But because ``directories`` is defined as ``DirectoryPath``, pydantic checks if the given directories exist in the local filesystem. 

This is not generally true, especially in any kind of virtual filesystem (e.g. a zipped package). I think this condition should be relaxed to support virtual filesystems.

https://github.com/starlite-api/starlite/blob/9bb6dcd57c10a591377cf8e3a537e9292566d5b9/starlite/config/static_files.py#L32


Discussion:
I agree. Do you want to submit a PR?

Resolving patch:
diff --git a/litestar/contrib/sqlalchemy/plugins/__init__.py b/litestar/contrib/sqlalchemy/plugins/__init__.py
--- a/litestar/contrib/sqlalchemy/plugins/__init__.py
+++ b/litestar/contrib/sqlalchemy/plugins/__init__.py
@@ -1,5 +1,10 @@
 from __future__ import annotations
 
+from typing import TYPE_CHECKING
+
+from litestar.contrib.sqlalchemy.plugins import _slots_base
+from litestar.plugins import InitPluginProtocol
+
 from .init import (
     AsyncSessionConfig,
     EngineConfig,
@@ -12,13 +17,29 @@
 )
 from .serialization import SQLAlchemySerializationPlugin
 
+if TYPE_CHECKING:
+    from litestar.config.app import AppConfig
+
 
-class SQLAlchemyPlugin(SQLAlchemyInitPlugin, SQLAlchemySerializationPlugin):
+class SQLAlchemyPlugin(InitPluginProtocol, _slots_base.SlotsBase):
     """A plugin that provides SQLAlchemy integration."""
 
     def __init__(self, config: SQLAlchemyAsyncConfig | SQLAlchemySyncConfig) -> None:
-        SQLAlchemyInitPlugin.__init__(self, config=config)
-        SQLAlchemySerializationPlugin.__init__(self)
+        """Initialize ``SQLAlchemyPlugin``.
+
+        Args:
+            config: configure DB connection and hook handlers and dependencies.
+        """
+        self._config = config
+
+    def on_app_init(self, app_config: AppConfig) -> AppConfig:
+        """Configure application for use with SQLAlchemy.
+
+        Args:
+            app_config: The :class:`AppConfig <.config.app.AppConfig>` instance.
+        """
+        app_config.plugins.extend([SQLAlchemyInitPlugin(config=self._config), SQLAlchemySerializationPlugin()])
+        return app_config
 
 
 __all__ = (


Test patch:
Repository: litestar-org/litestar

Issue:
StaticFilesConfig and virtual directories
I'm trying to write a ``FileSystemProtocol`` to load files from the package data using [importlib_resources](https://importlib-resources.readthedocs.io/en/latest/using.html#). But because ``directories`` is defined as ``DirectoryPath``, pydantic checks if the given directories exist in the local filesystem. 

This is not generally true, especially in any kind of virtual filesystem (e.g. a zipped package). I think this condition should be relaxed to support virtual filesystems.

https://github.com/starlite-api/starlite/blob/9bb6dcd57c10a591377cf8e3a537e9292566d5b9/starlite/config/static_files.py#L32


Discussion:
I agree. Do you want to submit a PR?

Resolving patch:
diff --git a/litestar/contrib/sqlalchemy/base.py b/litestar/contrib/sqlalchemy/base.py
--- a/litestar/contrib/sqlalchemy/base.py
+++ b/litestar/contrib/sqlalchemy/base.py
@@ -12,6 +12,7 @@
     UUIDBase,
     UUIDPrimaryKey,
     create_registry,
+    orm_registry,
     touch_updated_timestamp,
 )
 
@@ -27,4 +28,5 @@
     "UUIDAuditBase",
     "UUIDBase",
     "UUIDPrimaryKey",
+    "orm_registry",
 )


Test patch:
Repository: litestar-org/litestar

Issue:
StaticFilesConfig and virtual directories
I'm trying to write a ``FileSystemProtocol`` to load files from the package data using [importlib_resources](https://importlib-resources.readthedocs.io/en/latest/using.html#). But because ``directories`` is defined as ``DirectoryPath``, pydantic checks if the given directories exist in the local filesystem. 

This is not generally true, especially in any kind of virtual filesystem (e.g. a zipped package). I think this condition should be relaxed to support virtual filesystems.

https://github.com/starlite-api/starlite/blob/9bb6dcd57c10a591377cf8e3a537e9292566d5b9/starlite/config/static_files.py#L32


Discussion:
I agree. Do you want to submit a PR?

Resolving patch:
diff --git a/litestar/openapi/spec/enums.py b/litestar/openapi/spec/enums.py
--- a/litestar/openapi/spec/enums.py
+++ b/litestar/openapi/spec/enums.py
@@ -26,6 +26,7 @@ class OpenAPIFormat(str, Enum):
     IRI_REFERENCE = "iri-reference"  # noqa: PIE796
     UUID = "uuid"
     REGEX = "regex"
+    BINARY = "binary"
 
 
 class OpenAPIType(str, Enum):


Test patch:
Repository: litestar-org/litestar

Issue:
Docs: stale chart for lifecycle hooks
### Summary

![image](https://github.com/litestar-org/litestar/assets/20659309/38edd05f-1942-49a7-96f5-f4d498fefbba)

We only have `on_startup` and `on_shutdown` hooks now, so this should probably be removed.

<!-- POLAR PLEDGE BADGE START -->
---

## Funding
* If you would like to see an issue prioritized, make a pledge towards it!
* We receive the pledge once the issue is completed & verified

<a href="https://polar.sh/litestar-org/litestar/issues/2375">
<picture>
  <source media="(prefers-color-scheme: dark)" srcset="https://polar.sh/api/github/litestar-org/litestar/issues/2375/pledge.svg?darkmode=1">
  <img alt="Fund with Polar" src="https://polar.sh/api/github/litestar-org/litestar/issues/2375/pledge.svg">
</picture>
</a>
<!-- POLAR PLEDGE BADGE END -->



Discussion:

Resolving patch:
diff --git a/litestar/app.py b/litestar/app.py
--- a/litestar/app.py
+++ b/litestar/app.py
@@ -528,9 +528,8 @@ async def lifespan(self) -> AsyncGenerator[None, None]:
 
         It will be entered when the ``lifespan`` message has been received from the
         server, and exit after the ``asgi.shutdown`` message. During this period, it is
-        responsible for calling the ``before_startup``, ``after_startup``,
-        `on_startup``, ``before_shutdown``, ``on_shutdown`` and ``after_shutdown``
-        hooks, as well as custom lifespan managers.
+        responsible for calling the ``on_startup``, ``on_shutdown`` hooks, as well as
+        custom lifespan managers.
         """
         async with AsyncExitStack() as exit_stack:
             for hook in self.on_shutdown[::-1]:


Test patch:
Repository: litestar-org/litestar

Issue:
Bug: `2.2.0` does not have `[full]` group
### Description

The move from `poetry` to `pdm` in 2.2.0 has a regression for the `[full]` group.

### URL to code causing the issue

_No response_

### MCVE

```python
pip install litestar[full]==2.2.0 && pip show pydantic
```


### Steps to reproduce

- `pip install litestar[full]`
- Observe no `[full]` group is available, and `pip show $package` does not show expected pacakges


### Screenshots

_No response_

### Logs

_No response_

### Litestar Version

2.2.0

### Platform

- [ ] Linux
- [ ] Mac
- [ ] Windows
- [X] Other (Please specify in the description above)

<!-- POLAR PLEDGE BADGE START -->
> [!NOTE]  
> Check out all issues funded or available for funding here: https://polar.sh/litestar-org
> * If you would like to see an issue prioritized, make a pledge towards it!
> * We receive the pledge once the issue is completed & verified

<a href="https://polar.sh/litestar-org/litestar/issues/2434">
<picture>
  <source media="(prefers-color-scheme: dark)" srcset="https://polar.sh/api/github/litestar-org/litestar/issues/2434/pledge.svg?darkmode=1">
  <img alt="Fund with Polar" src="https://polar.sh/api/github/litestar-org/litestar/issues/2434/pledge.svg">
</picture>
</a>
<!-- POLAR PLEDGE BADGE END -->



Discussion:

Resolving patch:
diff --git a/litestar/types/internal_types.py b/litestar/types/internal_types.py
--- a/litestar/types/internal_types.py
+++ b/litestar/types/internal_types.py
@@ -48,7 +48,7 @@ class PathParameterDefinition(NamedTuple):
 def __getattr__(name: str) -> Any:
     if name == "LitestarType":
         warn_deprecation(
-            "2.3.0",
+            "2.2.1",
             "LitestarType",
             "import",
             removal_in="3.0.0",


Test patch:
Repository: litestar-org/litestar

Issue:
Docs: `template_engine` documented but not actually used
### Summary

In the `Template` response, there's a `template_engine` parameter that is taken as per the docstrings as seen [here](https://github.com/litestar-org/litestar/blob/2385b32b52a786634bcef6059900165123f31705/litestar/response/template.py#L59) (it's also there in the reference documentation). Was this meant to be removed or should support for giving a custom engine class on instantiation of the response be allowed?

<!-- POLAR PLEDGE BADGE START -->
---
> [!NOTE]  
> While we are open for sponsoring on [GitHub Sponsors](https://github.com/sponsors/litestar-org/) and 
> [OpenCollective](https://opencollective.com/litestar), we also utilize [Polar.sh](https://polar.sh/) to engage in pledge-based sponsorship.
>
> Check out all issues funded or available for funding [on our Polar.sh Litestar dashboard](https://polar.sh/litestar-org)
> * If you would like to see an issue prioritized, make a pledge towards it!
> * We receive the pledge once the issue is completed & verified
> * This, along with engagement in the community, helps us know which features are a priority to our users.

<a href="https://polar.sh/litestar-org/litestar/issues/2454">
<picture>
  <source media="(prefers-color-scheme: dark)" srcset="https://polar.sh/api/github/litestar-org/litestar/issues/2454/pledge.svg?darkmode=1">
  <img alt="Fund with Polar" src="https://polar.sh/api/github/litestar-org/litestar/issues/2454/pledge.svg">
</picture>
</a>
<!-- POLAR PLEDGE BADGE END -->



Discussion:
It was removed in favor of retrieving it from the application as part of the PR that created the ASGI response variants. That PR was merged somewhat abruptly, so not surprising there are some rough edges around that stuff.

Should be safe to remove the docstring for it.

Resolving patch:
diff --git a/litestar/response/template.py b/litestar/response/template.py
--- a/litestar/response/template.py
+++ b/litestar/response/template.py
@@ -56,7 +56,6 @@ def __init__(
             media_type: A string or member of the :class:`MediaType <.enums.MediaType>` enum. If not set, try to infer
                 the media type based on the template name. If this fails, fall back to ``text/plain``.
             status_code: A value for the response HTTP status code.
-            template_engine: The template engine class to use to render the response.
         """
         super().__init__(
             background=background,


Test patch: