oremanj / greenback

Reenter an asyncio or Trio event loop from synchronous code
https://greenback.readthedocs.io/
Other
80 stars 2 forks source link

Fix: top-level imports not flagged as public for type checkers #23

Closed mikenerone closed 10 months ago

mikenerone commented 10 months ago

Pyright and Mypy both emit errors when using greenback's top-level symbols because they aren't recognized as public. Example pyright error: trio.py:

4: import greenback
...
22:         result = await greenback.with_portal_run_tree(async_fn, *args)
...

Error:

  .../trio.py:22:34 - error: "with_portal_run_tree" is not exported from module "greenback" (reportPrivateImportUsage)

This branch changes those top-level imports to the redundant from X import A as A form to flag that the symbols are public.

codecov[bot] commented 10 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Comparison is base (2acb0b3) 99.74% compared to head (b51d10e) 99.74%. Report is 1 commits behind head on master.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #23 +/- ## ======================================= Coverage 99.74% 99.74% ======================================= Files 7 7 Lines 788 788 Branches 113 113 ======================================= Hits 786 786 Misses 1 1 Partials 1 1 ``` | [Flag](https://app.codecov.io/gh/oremanj/greenback/pull/23/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Joshua+Oreman) | Coverage Δ | | |---|---|---| | [cpython](https://app.codecov.io/gh/oremanj/greenback/pull/23/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Joshua+Oreman) | `98.98% <100.00%> (ø)` | | | [pypy36release](https://app.codecov.io/gh/oremanj/greenback/pull/23/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Joshua+Oreman) | `90.95% <100.00%> (ø)` | | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Joshua+Oreman#carryforward-flags-in-the-pull-request-comment) to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

oremanj commented 10 months ago

RTD error is fixed on master. Black error is because the CI is picking up prerelease 24.1a1, probably not worth fixing right now. Thanks for the PR!