Находки в опенсорсе: Python
966 subscribers
5 photos
248 links
Легкие задачки в опенсорсе из мира Python

Чат: @opensource_findings_chat
Download Telegram
🚀 New issue to wemake-services/django-modern-rest by @sobolevn
📝 Flaky test: `test_redis_sync_leaky_bucket` (#1043)


Output:

 ______________________ test_redis_sync_leaky_bucket[True] ______________________
tests/test_integration/test_throttling/test_backends/test_redis_backend/test_redis_backend.py:110: in test_redis_sync_leaky_bucket
assert response.status_code == HTTPStatus.TOO_MANY_REQUESTS
E assert 200 == <HTTPStatus.TOO_MANY_REQUESTS: 429>
E + where 200 = <HttpResponse status_code=200, "application/json">.status_code
E + and <HTTPStatus.TOO_MANY_REQUESTS: 429> = HTTPStatus.TOO_MANY_REQUESTS
================================ tests coverage ================================

=========================== short test summary info ============================
FAILED tests/test_integration/test_throttling/test_backends/test_redis_backend/test_redis_backend.py::test_redis_sync_leaky_bucket[True] - assert 200 == <HTTPStatus.TOO_MANY_REQUESTS: 429>
+ where 200 = <HttpResponse status_code=200, "application/json">.status_code
+ and <HTTPStatus.TOO_MANY_REQUESTS: 429> = HTTPStatus.TOO_MANY_REQUESTS
============ 1 failed, 2479 passed, 10 skipped in 243.50s (0:04:03) ============


It fails from time to time: https://github.com/wemake-services/django-modern-rest/actions/runs/26490639540/job/78007463856?pr=1042


#bug #good_first_issue #help_wanted #django_modern_rest
sent via relator
🚀 New issue to wemake-services/django-modern-rest by @sobolevn
📝 Flaky test: `test_sse_ping_with_last` (#1046)


Happened on mypyc wheels cp314-macosx_x86_64

  =================================== FAILURES ===================================
___________________________ test_sse_ping_with_last ____________________________

dmr_async_rf = <dmr.test.DMRAsyncRequestFactory object at 0x114ddad60>

@pytest.mark.asyncio
async def test_sse_ping_with_last(
dmr_async_rf: DMRAsyncRequestFactory,
) -> None:
"""Ensures that valid sse produces valid results."""
request = dmr_async_rf.post('/whatever/', data={'produce_last': True})

response = await dmr_async_rf.wrap(_PingSSE.as_view()(request))

assert isinstance(response, StreamingResponse)
assert response.streaming
assert response.status_code == HTTPStatus.OK
assert response.headers == {
'Cache-Control': 'no-cache',
'Content-Type': 'text/event-stream',
'X-Accel-Buffering': 'no',
'Connection': 'keep-alive',
}
> assert await get_streaming_content(response) == (
b'data: 1\r\n'
b'\r\n'
b': ping\r\n'
b'\r\n'
b'data: 2\r\n'
b'\r\n'
b': ping\r\n'
b'\r\n'
b': ping\r\n'
b'\r\n'
b'data: 3\r\n'
b'\r\n'
)
E AssertionError: assert b'data: 1\r\n...ta: 3\r\n\r\n' == b'data: 1\r\n...ta: 3\r\n\r\n'
E
E At index 42 diff: b'd' != b':'
E
E Full diff:
E - (b'data: 1\r\n\r\n: ping\r\n\r\ndata: 2\r\n\r\n: ping\r\n\r\n: ping\r\n\r\ndata'
E ? --------------
E + (b'data: 1\r\n\r\n: ping\r\n\r\ndata: 2\r\n\r\n: ping\r\n\r\ndata: 3\r\n\r\n')
E ? +++++++++++ +
E - b': 3\r\n\r\n')

For some reason data: 3 was not sent.
Let's fix it.


#bug #good_first_issue #help_wanted #django_modern_rest
sent via relator
🚀 New issue to wemake-services/django-modern-rest by @sobolevn
📝 Add default admin page for `dmr/security/jwt/blocklist` (#1054)


Right now our app for jwt blocklisting has a default model: https://github.com/wemake-services/django-modern-rest/blob/master/dmr/security/jwt/blocklist/models.py

But, it does not have a default admin.py file.
Good example: https://github.com/Dresdn/django-modern-rest/blob/3324d0aecf32509b5434df7e8826d7be6ddac7a8/dmr/security/token/admin.py

This is a very easy task :)


#feature #good_first_issue #help_wanted #django_modern_rest
sent via relator
«Институт логики» приглашает разработчиков свободного ПО на конкурс «Код логики»

Стартовал первый этап конкурса Open-Source-проектов разработчиков свободного программного обеспечения «Код логики». Конкурс проводится при финансовой поддержке «Базальт СПО» и частных лиц.
Организатор конкурса — АНО «Институт логики, когнитологии и развития личности».
Кто может участвовать: физические лица — разработчики свободного ПО, граждане РФ старше 18 лет, налоговые резиденты.
Что нужно сделать: предоставить значимый вклад в существующий Open-Source-проект, опубликованный в публичном репозитории под свободной лицензией. Вклад может быть сделан в свой или сторонний проект.
Призовой фонд: денежные премии. Всего 3 призовых места, максимальное количество победителей — до 6 человек. Победитель получит 1 000 000 рублей.
Сроки: заявки принимаются до 15 августа 2026 года на сайте института.
Награждение победителей состоится 2–4 октября на XXII ежегодной конференции разработчиков свободных программ.
Подробности об условиях конкурса доступны на сайте: https://logic.ru/
На протяжении 35 лет институт поддерживает разработчиков свободного ПО и образовательные технологии. Институт развивался как академическая площадка на стыке логики, искусственного интеллекта, образования и моделирования мышления. Миссия АНО «Институт логики» — помогать исследователям, специалистам и учебным учреждениям реализовывать проекты, влияющие на развитие технологий. Конкурс Open-Source-проектов разработчиков свободного программного обеспечения — часть этой работы.

Ссылка: https://logic.ru/
👍2
🚀 New issue to wemake-services/django-modern-rest by @sobolevn
📝 `test_user_create_models_example` is flaky (#1089)


Please fix it :)

=========================== short test summary info ============================
FAILED tests/test_integration/test_model_fk/test_model_fk.py::test_user_create_models_example[False] - AssertionError: assert {'email': 'jd... 'id': 1, ...} == {'email': 'jd...itiveInt, ...}

Omitting 4 identical items, use -vv to show
Differing items:
{'tags': [{'name': 'Jessica Johnson'}]} != {'tags': IsList({'name': 'Jessica Johnson'}, {'name': 'Jessica Johnson'}, check_order=False)}

Full diff:
{
'email': 'jdominguez@example.com',
'role': {
'name': 'Jason Burgess',
},
- 'tags': IsList({'name': 'Jessica Johnson'}, {'name': 'Jessica Johnson'}, check_order=False),
- 'id': IsPositiveInt,
+ 'tags': [
+ {
+ 'name': 'Jessica Johnson',
+ },
+ ],
+ 'id': 1,
'created_at': '2026-06-19T10:39:36.779795Z',
}
============ 1 failed, 2506 passed, 10 skipped in 268.28s (0:04:28) ============


https://github.com/wemake-services/django-modern-rest/actions/runs/27820624206/job/82332576787


#bug #good_first_issue #help_wanted #django_modern_rest
sent via relator
🚀 New issue to wemake-services/django-modern-rest by @sobolevn
📝 Setup `lychee` link check tool for `pre-commit` (#1094)


It allows checking that all links are actually valid.
This will helps us finding dead / renamed links in the docs / code.

Hooks: https://github.com/lycheeverse/lychee/blob/master/.pre-commit-hooks.yaml
Docs: https://lychee.cli.rs/
Example config: https://github.com/msgspec/msgspec/blob/main/lychee.toml (but I would prefer to have it in the same folder as zizmor config is).


#documentation #feature #good_first_issue #help_wanted #django_modern_rest
sent via relator
🚀 New issue to wemake-services/django-modern-rest by @ZhdanovAM72
📝 Add a built-in JWT access token verification flow. (#1129)


FEATURE

Thesis

Add a built-in JWT access token verification flow.

For example, django-modern-rest could provide a reusable controller:

from dmr.security.jwt.views import VerifyTokenSyncController


class TokenVerifyController(VerifyTokenSyncController):
pass

Expected behavior:

• accept an encoded token from the request body
• decode and validate the JWT
• reject malformed tokens
• reject expired tokens
• reject refresh tokens when an access token is expected
• verify that the token subject belongs to an existing active user
• return a successful empty response when the token is valid

The exact public API can be different. It could be implemented as a controller,
auth class, or reusable JWT verification component.

Reasoning

django-modern-rest already provides JWT obtain and refresh controllers, but
applications commonly also need a token verification endpoint.

Without built-in support, each project has to implement the same logic manually:

from django.conf import settings
from dmr.exceptions import NotAuthenticatedError
from dmr.security.jwt.token import JWToken


token = JWToken.decode(
encoded_token=encoded_token,
secret=str(settings.SECRET_KEY),
algorithm="HS256",
)

if token.extras.get("type") != "access":
raise NotAuthenticatedError

user = User.objects.get(pk=token.sub)

if not user.is_active:
raise NotAuthenticatedError

This logic is not application-specific. It is part of the common JWT API
surface.

Providing it in django-modern-rest would reduce duplication and make JWT support
more complete. It would also make error handling more consistent with the
existing obtain and refresh controllers.


#feature #good_first_issue #help_wanted #django_modern_rest
sent via relator
Forwarded from @yegor256 news (Yegor Bugayenko)
KaiCode, our annual festival of open source projects, is announcing winners of the 2026 competition (and rewarding some cash to help them grow):

raprogramm/yew-nav-link 6★
Perfect $2048

ahoo-wang/wow 296★
Excellent $1024

choplogic/chop-logic-components 5★
Awesome $512

These projects were selected out of all 153 submitted this year. As you see, popularity didn't matter, but only the quality of code, discipline of development, strictness of testing and delivery pipelines, and the accuracy of documentation.

Many thanks to nine Jury members, who manually reviewed all 14 finalists. Thanks to the Steering Committee (Alexander Medvednikov and Nikita Sobolev) — they validated the results of the Jury. Thanks to Claude Code — he helped us not to miss important details in every finalist.

You are welcome to submit your open source project to the next year competition!
6👍3
всех приглашаю для участия в следующем году :)
👍6
🚀 New issue to wemake-services/django-modern-rest by @sobolevn
📝 Fix all `@contextmanager` entries with `Iterator` return type (#1181)


Using @contextmanager with Iterator return type is deprecated.
It must use Generator return type.

🖼️Image

We need to fix all places where we use -> Iterator together with contextmanager decorator.


#bug #good_first_issue #help_wanted #django_modern_rest
sent via relator
🚀 New issue to wemake-services/django-modern-rest by @sobolevn
📝 Setup stricter `__slots__` check in CI (#1183)


We would need to enable:

--require-subclass
--detect-unused-slots (it is experimental)

Docs: https://slotscheck.readthedocs.io/en/latest/cli.html#cli

And fix all issues :)


#feature #good_first_issue #help_wanted #django_modern_rest
sent via relator
🚀 New issue to ag2ai/faststream by @DeoLeung
📝 Feature: relax typer version (#2969)


if no incompatibility, it will be great to relax the cap of typer, easy for projects using faststream cli to upgrade typer


#enhancement #good_first_issue #faststream #ag2ai
sent via relator
🚀 New issue to wemake-services/django-modern-rest by @sobolevn
📝 Support migration from `dj-rest-auth` (#1193)


This is a critical component in DRF's world: https://github.com/iMerica/dj-rest-auth
We need to provide a clean migration path from dj-rest-auth to django-modern-rest.

Without this component many project's can really migrate, because they would have to re-invent the most critical part: auth. This is not something we can allow for our users.

How?

◻️ Support default login views
◻️ Support registration default views
◻️ Support password change default views
◻️ Support OAuth flow #1012
◻️ Support MFA
◻️ Support Passkeys
◻️ Support cookie-based JWT auth flow (currently, we only support headers)
◻️ Support AI skill for migration from dj-rest-auth to django-modern-rest

For all features we would require:

• Strict AI review for the best practices of the method (because I am not an expert in several things here, so we need someone else's opinion), security folks are welcome!
• Docs
• Schemes, how everything works, like dj-rest-auth has
• Lots of tests :)

This is a big project, so any help / contributions are welcome!
Let's do it together, friends :)


#feature #help_wanted #django_modern_rest
sent via relator
👍1
🚀 New issue to wemake-services/django-modern-rest by @Lancetnik
📝 Add `pytest-timeout` to fail hanging tests fast (#1195)


FEATURE

Thesis

Add pytest-timeout to the test dependencies and enable a global per-test timeout, so a hanging test fails fast and names itself instead of stalling the job.

[dependency-groups]
unit-test = [
# ...
"pytest-timeout>=2.4,<3",
]

[tool.pytest.ini_options]
# Fail hanging tests instead of blocking CI:
timeout = 30
timeout_method = "thread"

Tests that legitimately need longer raise their own budget with the marker:

@pytest.mark.timeout(120)
def test_something_genuinely_slow() -> None: ...

Reasoning
Nothing currently bounds a hang. Only .github/workflows/relator.yml sets timeout-minutes; test.yml, test-extras.yml, build-wheels.yml and codspeed.yml do not, so a single deadlocked test burns the GitHub Actions default of 6 hours per job — multiplied across the Python/Django matrix.
The suite has real hang-prone surface. asyncio_mode = 'auto' means every async test can deadlock on an unawaited future; tests/test_integration/test_throttling/test_backends/test_redis_backend/ talks to a live Redis/Valkey; the streaming tests consume generators; the smoke tests spawn subprocesses. Today a wedged backend looks like "CI is slow", not "CI is broken".
Attribution. A job-level timeout-minutes kills the run without telling you which test hung. pytest-timeout dumps the stack of the offending test and keeps going, which is the difference between a five-minute fix and a bisect.
Locally too. The same protection applies to just unit, where a hang currently requires a manual Ctrl-C and offers no traceback.
Cheap. One pure-Python dev dependency, no runtime impact on the shipped package.

Notes / open questions
• It has to go in the unit-test group specifically: that group is the minimal one installed by cibuildwheel, and with --strict-config in addopts an unknown timeout ini key would make pytest error out anywhere the plugin isn't installed.
timeout_method = "thread" behaves the same on every platform (relevant for the Windows wheel jobs); signal gives a slightly nicer traceback but is POSIX-only. Happy to go with either.
• The 30s default is a starting point — it should be set above the slowest current test so the change is a no-op for a green suite. Worth a --durations run to pick the number.

#feature #good_first_issue #help_wanted #django_modern_rest
sent via relator
🔥1😁1
🚀 New issue to wemake-services/django-modern-rest by @sobolevn
📝 Flaky test: `test_redis_async_leaky_bucket` (#1204)


Using --randomly-seed=706466424: https://github.com/wemake-services/django-modern-rest/actions/runs/30856534508/job/91828743292#step:9:3033

=========================== short test summary info ============================
FAILED tests/test_integration/test_throttling/test_backends/test_redis_backend/test_redis_backend.py::test_redis_async_leaky_bucket[True] - assert 200 == <HTTPStatus.TOO_MANY_REQUESTS: 429>
+ where 200 = <HttpResponse status_code=200, "application/json">.status_code
+ and <HTTPStatus.TOO_MANY_REQUESTS: 429> = HTTPStatus.TOO_MANY_REQUESTS
============ 1 failed, 2787 passed, 14 skipped in 231.98s (0:03:51) ============

We need to investigate why it failed and fix / refactor it.


#bug #help_wanted #ci #django_modern_rest
sent via relator