Skip to content

feat: [698] Added TypeForm for provide#731

Open
ApusBerliozi wants to merge 1 commit into
reagento:developfrom
ApusBerliozi:698_add_TypeForm_for_provide
Open

feat: [698] Added TypeForm for provide#731
ApusBerliozi wants to merge 1 commit into
reagento:developfrom
ApusBerliozi:698_add_TypeForm_for_provide

Conversation

@ApusBerliozi

Copy link
Copy Markdown
Contributor

Added TypeForm annotation for provide (both Provide class and provide function).

Didn't go into guts yet, started with public API first

@sonarqubecloud

Copy link
Copy Markdown

@github-actions

Copy link
Copy Markdown

Coverage report

Click to see where and how coverage changed

FileStatementsMissingCoverageCoverage
(new stmts)
Lines missing
  src/dishka/provider
  make_factory.py
  provider.py
Project Total  

This report was generated by python-coverage-comment-action

@Tishka17

Tishka17 commented May 20, 2026

Copy link
Copy Markdown
Member

I expect that TypeForm will help detecting such cases:

class AImpl(AProtocol): ...

provide(AImpl, provides=AProtocol)  # ok
provide(AImpl, provides=str)  # err
provide(str, provides=AProtocol)  # err

Still it is not clear about Union types in provides. Let's write down test cases firstly. If TypeForm does not add anything useful, we'd rather not use it

@ApusBerliozi

Copy link
Copy Markdown
Contributor Author

Oh, I see

Hm. In that case, I need to do something with CompositeDependencySource...

I'll take a look at it, check what can be done

@Tishka17

Copy link
Copy Markdown
Member

I am not sure we can solve all cases, so let's discuss

@ApusBerliozi

Copy link
Copy Markdown
Contributor Author

Yeaaaaaaaah, I think you are right :(

In order for code to do what we wanna do, we need to point that source argument has the same TypeForm as in provides (or smth like that).

While I think that it's possible, it isn't an easy task for sure, cause of the code's guts. I would gladly work with that, always wanted to try and add new changes in existing infrastructure, but if it isn't a priority - I can understand it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

2 participants