Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix reportPrivateImportUsage for VS Code #5

Merged
merged 1 commit into from
Nov 15, 2023

Conversation

M1troll
Copy link
Contributor

@M1troll M1troll commented Nov 14, 2023

In VS Code Pylance when trying to import non-module names from pomcorn raises reportPrivateImportUsage.

This doesn't interfere with the package, and mypy doesn't swear at it, but we lose the import hints described in the main __init__.py file
image
and see the nasty underline:
image

I found the following two solutions:

  1. Add "private imports" to the __all__ symbol as written in the pyright docs
  2. Ignore this error and use full path imports (like import pomcorn.locators.xpath_locators as locators)

I find it very convenient to use a short import, so I implemented the first solution.

@M1troll M1troll self-assigned this Nov 14, 2023
@M1troll M1troll changed the title Fix \reportPrivateImportUsage\ for VS Code Fix reportPrivateImportUsage for VS Code Nov 14, 2023
pomcorn/__init__.py Outdated Show resolved Hide resolved
pomcorn/locators/__init__.py Show resolved Hide resolved
@M1troll M1troll force-pushed the feature/fix-private-import-error branch from 529d6d7 to 78d2177 Compare November 15, 2023 03:44
@M1troll M1troll requested a review from ron8mcr November 15, 2023 03:45
In VS Code `Pylance` when trying to import non-module names from
`pomcorn` raises `reportPrivateImportUsage`.
@M1troll M1troll force-pushed the feature/fix-private-import-error branch from 78d2177 to f1ff858 Compare November 15, 2023 04:48
@M1troll M1troll merged commit 1bd9408 into main Nov 15, 2023
2 checks passed
@M1troll M1troll deleted the feature/fix-private-import-error branch November 15, 2023 04:54
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.

3 participants