Skip to content

feat: ✨ Introduce @asfunction#258

Merged
remimd merged 3 commits intodevfrom
asfunction
Jun 7, 2025
Merged

feat: ✨ Introduce @asfunction#258
remimd merged 3 commits intodevfrom
asfunction

Conversation

@remimd
Copy link
Copy Markdown
Member

@remimd remimd commented Jun 7, 2025

No description provided.

@remimd remimd requested a review from Copilot June 7, 2025 11:22
@remimd remimd self-assigned this Jun 7, 2025
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Introduce a new @asfunction decorator that converts injectable classes with a __call__ method into standalone functions.

  • Add the asfunction decorator implementation and register it in the module API
  • Provide type stubs and overloads for proper typing support
  • Include tests and documentation demonstrating sync/async use cases and integration guide

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
tests/core/test_asfunction.py Add tests covering sync and async uses of the new @asfunction
injection/_core/asfunction.py Implement the asfunction decorator logic
injection/init.pyi Add overload signatures for asfunction in the type stub
injection/init.py Export asfunction in the public API
documentation/integrations/unlisted-framework.md Document how to use asfunction with unlisted frameworks
README.md Link the new unlisted-framework integration guide
Comments suppressed due to low confidence (2)

tests/core/test_asfunction.py:1

  • There’s no test covering the threadsafe=True flag on asfunction. Consider adding a test that uses @asfunction(module=module, threadsafe=True) to verify thread-safe behavior.
from typing import NamedTuple

injection/_core/asfunction.py:10

  • The generic parameters P and T are not defined or imported. Import ParamSpec and TypeVar from typing and add P = ParamSpec('P') and T = TypeVar('T') before this function so the annotations resolve correctly.
def asfunction[**P, T](

Comment thread injection/_core/asfunction.py Outdated
remimd added 2 commits June 7, 2025 13:26
@remimd remimd merged commit aef964d into dev Jun 7, 2025
5 checks passed
@remimd remimd deleted the asfunction branch June 7, 2025 11:35
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.

2 participants