🚀 New issue to wemake-services/django-modern-rest by @sobolevn
📝 Support `Path` with `*args` (#754)
Right now
However, parsing from
django-modern-rest/dmr/components.py
Lines 655 to 662 in b3f9c08
What should we do instead?
1. When
1. We would return
2. Test this with unnamed
3. Test this in
4. Document this feature in
5. Provide an example in
6. Provide a changelog entry
7. Remove
Contributions are welcome! This is an intermediate level task :)
#enhancement #good_first_issue #help_wanted #django_modern_rest
sent via relator
📝 Support `Path` with `*args` (#754)
Right now
Path component only supports parsing from request.kwargs. Which is like 99% of cases.However, parsing from
request.args is not supported:django-modern-rest/dmr/components.py
Lines 655 to 662 in b3f9c08
What should we do instead?
1. When
request.args is provided we should require models like:>>> import pydantic
>>> class UserId(pydantic.BaseModel):
... user_id: int
>>> PathModel = pydantic.RootModel[tuple[tuple[int, ...], UserId]]
>>> PathModel.model_validate((('1', '2', '3'), {'user_id': 10}))
RootModel[tuple[tuple[int, ...], UserId]](root=((1, 2, 3), UserId(user_id=10)))
1. We would return
tuple[Args, Kwargs] from this component if request.args is set2. Test this with unnamed
re_path urls https://docs.djangoproject.com/en/6.0/topics/http/urls/#using-unnamed-regular-expression-groups3. Test this in
tests/test_unit/test_components/test_path.py4. Document this feature in
docs/pages/components/path.rst5. Provide an example in
docs/examples/components/path_args.py and include it to path.rst6. Provide a changelog entry
7. Remove
_UNNAMED_PATH_PARAMS_MSG and all translations of this string, recompile all translations with make translationsContributions are welcome! This is an intermediate level task :)
#enhancement #good_first_issue #help_wanted #django_modern_rest
sent via relator
🚀 New issue to wemake-services/django-modern-rest by @sobolevn
📝 Use the latest django version by default (#759)
Currently we use
django-modern-rest/pyproject.toml
Line 77 in bea5f2d
But, we need to use the latest one. Which is
Also, we would need to change this CI job to use
django-modern-rest/.github/workflows/test.yml
Lines 71 to 78 in bea5f2d
#good_first_issue #help_wanted #django_modern_rest
sent via relator
📝 Use the latest django version by default (#759)
Currently we use
5.2 by default:django-modern-rest/pyproject.toml
Line 77 in bea5f2d
But, we need to use the latest one. Which is
6.0.Also, we would need to change this CI job to use
5.2 instead:django-modern-rest/.github/workflows/test.yml
Lines 71 to 78 in bea5f2d
#good_first_issue #help_wanted #django_modern_rest
sent via relator
❤1
🚀 New issue to wemake-services/django-modern-rest by @sobolevn
📝 Provide our own `settings` fixture (#760)
When using
However, we have
So, let's add a new fixture to
Also, remove all
#enhancement #good_first_issue #help_wanted #django_modern_rest
sent via relator
📝 Provide our own `settings` fixture (#760)
When using
settings fixture from pytest-django we frequently change them.However, we have
dmr_clean_settings fixture, which should be use when we touch our own settings.So, let's add a new fixture to
dmr_pytest.py which will return unchanged settings: LazySettings, but will also use dmr_clean_settings.Also, remove all
dmr_clean_settings from our own tests, where settings is used.#enhancement #good_first_issue #help_wanted #django_modern_rest
sent via relator
🚀 New issue to wemake-services/django-modern-rest by @sobolevn
📝 Provide `dmr.cookies.set_cookies` helper function (#773)
Currently we have two places where we duplicate this code:
django-modern-rest/dmr/streaming/controller.py
Lines 172 to 178 in a6bc356
and
django-modern-rest/dmr/response.py
Lines 256 to 259 in a6bc356
So, it can probably be useful to others as well.
Let's move this to
Also, document it in
This is a very easy task for new contributors.
#enhancement #good_first_issue #help_wanted #django_modern_rest
sent via relator
📝 Provide `dmr.cookies.set_cookies` helper function (#773)
Currently we have two places where we duplicate this code:
django-modern-rest/dmr/streaming/controller.py
Lines 172 to 178 in a6bc356
and
django-modern-rest/dmr/response.py
Lines 256 to 259 in a6bc356
So, it can probably be useful to others as well.
Let's move this to
cookies.py as a public helper function.Also, document it in
public-api.rstThis is a very easy task for new contributors.
#enhancement #good_first_issue #help_wanted #django_modern_rest
sent via relator
🚀 New issue to wemake-services/django-modern-rest by @sobolevn
📝 Test and declare officail `NamedTuple` support (#774)
Here's the code:
As we can see,
1. Add a test case to
2. Add a doc example here https://django-modern-rest.readthedocs.io/en/latest/pages/getting-started.html#showcase
3. Add a changelog entry, that it is now officially supported
We welcome new contributors :)
#enhancement #good_first_issue #help_wanted #django_modern_rest
sent via relator
📝 Test and declare officail `NamedTuple` support (#774)
Here's the code:
>>> from typing import NamedTuple
>>> class A(NamedTuple):
... x: int
... y: int
...
>>> import pydantic
>>> pydantic.TypeAdapter(A).validate_python({'x': 1, 'y': 2})
A(x=1, y=2)
>>> pydantic.TypeAdapter(A).validate_python({'x': 1, 'y': 'a'})
Traceback (most recent call last):
File "<python-input-11>", line 1, in <module>
pydantic.TypeAdapter(A).validate_python({'x': 1, 'y': 'a'})
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^
File "/Users/sobolev/Desktop/django-modern-rest/.venv/lib/python3.13/site-packages/pydantic/type_adapter.py", line 441, in validate_python
return self.validator.validate_python(
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
object,
^^^^^^^
...<6 lines>...
by_name=by_name,
^^^^^^^^^^^^^^^^
)
^
pydantic_core._pydantic_core.ValidationError: 1 validation error for call[A]
y
Input should be a valid integer, unable to parse string as an integer [type=int_parsing, input_value='a', input_type=str]
For further information visit https://errors.pydantic.dev/2.12/v/int_parsing
As we can see,
NamedTuple models work well with pydantic. So, here's what we need to do:1. Add a test case to
test_plugins/test_pydantic that it works with NamedTuple2. Add a doc example here https://django-modern-rest.readthedocs.io/en/latest/pages/getting-started.html#showcase
3. Add a changelog entry, that it is now officially supported
We welcome new contributors :)
#enhancement #good_first_issue #help_wanted #django_modern_rest
sent via relator
🔥1
🚀 New issue to ag2ai/faststream by @hmvp
📝 Bug: topic patterns are not correctly documented (#2804)
Describe the bug
When using a pattern for a kafka topic the generated asyncapi spec (and docs) does not include that handler
How to reproduce
With something along the lines of:
Expected behavior
The subscriber is included in the asyncapi spec and docs. As far as I can see the asyncapi spec actually allows for this even when using Path variables.
Observed behavior
The asyncapi docs don't contain that subscriber.
Screenshots
Environment
Running FastStream 0.6.7 with CPython 3.14.0 on Linux
Additional context
#bug #good_first_issue #faststream #ag2ai
sent via relator
📝 Bug: topic patterns are not correctly documented (#2804)
Describe the bug
When using a pattern for a kafka topic the generated asyncapi spec (and docs) does not include that handler
How to reproduce
With something along the lines of:
broker = KafkaBroker(...)
router = KafkaRouter()
@router.subscriber(pattern="some.wildcard.topic.*")
def handle_event(event: Event): ...
broker.include_router(router)
app = AsgiFastStream(
broker,
asyncapi_path="/docs",
)
Expected behavior
The subscriber is included in the asyncapi spec and docs. As far as I can see the asyncapi spec actually allows for this even when using Path variables.
Observed behavior
The asyncapi docs don't contain that subscriber.
Screenshots
Environment
Running FastStream 0.6.7 with CPython 3.14.0 on Linux
Additional context
#bug #good_first_issue #faststream #ag2ai
sent via relator
🚀 New issue to ag2ai/faststream by @dumpler
📝 Bug: Logger not properly passed to Confluent Kafka Producer and AdminClient (#2691)
Describe the bug
There are two related issues with logger configuration in the Confluent Kafka components:
1.
Late Logger Setup in AsyncConfluentProducer
In faststream/confluent/helpers/client.py at line 46, the Producer object is created before the _setup() method is called for loger_state. This results in the Producer receiving a NoSetLoggerObject instead of the intended logger passed during initialization.
2.
Missing Logger in AdminClient
The AdminClient in AdminService does not accept a logger parameter, even though it should. Currently, only the configuration is passed, leaving the AdminClient without proper logging.
How to reproduce
Include source code:
Expected behavior
1. The Producer in AsyncConfluentProducer should use the logger passed to KafkaRouter.
2. The AdminClient should inherit the same logger as other components.
Observed behavior
1. The Producer uses NoSetLoggerObject instead of the provided logger.
2. The AdminClient lacks logger configuration, leading to potential silent failures or inadequate logging.
Environment
Running FastStream 0.6.3 with CPython 3.13.1 on Linux
#bug #good_first_issue #faststream #ag2ai
sent via relator
📝 Bug: Logger not properly passed to Confluent Kafka Producer and AdminClient (#2691)
Describe the bug
There are two related issues with logger configuration in the Confluent Kafka components:
1.
Late Logger Setup in AsyncConfluentProducer
In faststream/confluent/helpers/client.py at line 46, the Producer object is created before the _setup() method is called for loger_state. This results in the Producer receiving a NoSetLoggerObject instead of the intended logger passed during initialization.
2.
Missing Logger in AdminClient
The AdminClient in AdminService does not accept a logger parameter, even though it should. Currently, only the configuration is passed, leaving the AdminClient without proper logging.
How to reproduce
Include source code:
import logging
import uvicorn
from fastapi import FastAPI
from faststream.confluent.fastapi import KafkaRouter
logger = logging.getLogger("faststream")
router = KafkaRouter(
bootstrap_servers="kafka:9092",
enable_idempotence=True,
allow_auto_create_topics=False,
schema_url="/asyncapi",
include_in_schema=True,
logger=logger,
)
app = FastAPI()
app.include_router(router)
uvicorn.run(app, host="0.0.0.0", port=8000)
Expected behavior
1. The Producer in AsyncConfluentProducer should use the logger passed to KafkaRouter.
2. The AdminClient should inherit the same logger as other components.
Observed behavior
1. The Producer uses NoSetLoggerObject instead of the provided logger.
2. The AdminClient lacks logger configuration, leading to potential silent failures or inadequate logging.
Environment
Running FastStream 0.6.3 with CPython 3.13.1 on Linux
#bug #good_first_issue #faststream #ag2ai
sent via relator
🚀 New issue to wemake-services/django-modern-rest by @sobolevn
📝 Add docs and example about `django-health-check` integration (#831)
One can use https://github.com/codingjoe/django-health-check for health checks.
No special integration from our side is required.
This information can be added here: https://github.com/wemake-services/django-modern-rest/blob/master/docs/pages/integrations.rst
#documentation #enhancement #good_first_issue #help_wanted #django_modern_rest
sent via relator
📝 Add docs and example about `django-health-check` integration (#831)
One can use https://github.com/codingjoe/django-health-check for health checks.
No special integration from our side is required.
This information can be added here: https://github.com/wemake-services/django-modern-rest/blob/master/docs/pages/integrations.rst
#documentation #enhancement #good_first_issue #help_wanted #django_modern_rest
sent via relator
🚀 New issue to wemake-services/django-modern-rest by @sobolevn
📝 Support `orjson` as a possible backend for `JsonParser` / `JsonRenderer` (#857)
Currently we always use
django-modern-rest/dmr/parsers.py
Lines 132 to 134 in 69822ff
But, we can make this module customizable. We can pass
Something like:
And later
This would need multiple test cases: install
And we can document that with an example in the
#enhancement #good_first_issue #help_wanted #django_modern_rest
sent via relator
📝 Support `orjson` as a possible backend for `JsonParser` / `JsonRenderer` (#857)
Currently we always use
json as a module in JsonParser and JsonRenderer:django-modern-rest/dmr/parsers.py
Lines 132 to 134 in 69822ff
But, we can make this module customizable. We can pass
orjson module there, since it also has a similar API.Something like:
class JsonParser(Parser):
__slots__ = ('_json_module', ...)
def __init__(self, json_module: _JsonModule = json, ...) -> None:
self._json_module = json_module
And later
self._json_module.loads(...)This would need multiple test cases: install
orjson as unit-test dependency and add unit tests for this new renderer / parser.And we can document that with an example in the
integrations.rst docs.#enhancement #good_first_issue #help_wanted #django_modern_rest
sent via relator
🚀 New issue to wemake-services/django-modern-rest by @sobolevn
📝 Add a Django command to export OpenAPI schemas (#858)
It migth be useful to people who want to share the schema. Or automate something with it.
I propose to add a django command:
Args:
• Where to find schema, I think we should reuse
• All json formatting ones:
• Format:
We should print it to the stdout always. Usages:
This would need tests, we can test it as a subprocess, it is a django command after all.
And docs.
#enhancement #good_first_issue #help_wanted #django_modern_rest
sent via relator
📝 Add a Django command to export OpenAPI schemas (#858)
It migth be useful to people who want to share the schema. Or automate something with it.
I propose to add a django command:
dmr_export_schema.Args:
• Where to find schema, I think we should reuse
import_string logic from Django. Required• All json formatting ones:
sort_keys and indent• Format:
json or yaml, check that yaml is installed. Default is jsonWe should print it to the stdout always. Usages:
# regular:
python manage.py dmr_export_schema server.urls:schema
# pretty:
python manage.py dmr_export_schema server.urls:schema --format json --indent=2 --sort-keys
This would need tests, we can test it as a subprocess, it is a django command after all.
And docs.
#enhancement #good_first_issue #help_wanted #django_modern_rest
sent via relator