# flake8_private_name_import
flake8 plugin that reports imports of private names.
# Codes
<details>
<summary>PNI001 found import of private name: {name}</summary>
```python
from module import _my_private_name # PNI001 found import of private name: _my_private_name
```
</details>
<details>
<summary>PNI002 found import of private module: {module}</summary>
```python
import _module # PNI002 found import of private module: _module
import module._sub_module # PNI002 found import of private module: module._sub_module
```
</details>
<details>
<summary>PNI003 found import from private module: {module}</summary>
```python
from _module import name # PNI003 found import from private module: _module
from module._sub_module import name # PNI003 found import from private module: module._sub_module
```
</details>
# Options
### Skip names (`PNI001`)
`console`: --private-name-import-skip-names
`config_file`: private_name_import_skip_names
`type`: comma separated list (list for config_file)
Private names import of which must not be reported.
Accepts full path (`module.sub_module._name`) or plain name (`_name`).
If full path used then only that name from that module would be skipped.
If plain name used then name would be skipped independent on module it imported from.
<details>
<summary>Example (specific name from specific module)</summary>
```text
flake8 --private-name-import-skip-names=module.sub_module._function,module.sub_module._Class
```
```python
from module.sub_module import _function, _Class # both skipped
from module.sub_module import _CONSTANT # PNI001 found import of private name: _CONSTANT
```
</details>
<details>
<summary>Example (module independent name)</summary>
```text
flake8 --private-name-import-skip-names=_function,_Class
```
```python
from module import _function, _Class # both skipped
from module.sub_module import _function, _Class # both skipped
from module.sub_module import _CONSTANT # PNI001 found import of private name: _CONSTANT
```
</details>
### Skip modules (`PNI002`)
`console`: --private-name-import-skip-modules
`config_file`: private_name_import_skip_modules
`type`: comma separated list (list for config_file)
Private modules import of which must not be reported.
Affects only imports of modules, imports of names from those modules will be reported.
<details>
<summary>Example</summary>
```text
flake8 --private-name-import-skip-modules=_module,module._sub_module
```
```python
import _module # skipped
import module._sub_module # skipped
from _module import name # PNI003 found import from private module: _module
```
</details>
### Skip names from modules (`PNI003`, `PNI001`)
`console`: --private-name-import-skip-names-from-modules
`config_file`: private_name_import_skip_names_from_modules
`type`: comma separated list (list for config_file)
Comma separated modules imports of private names from which must not be reported.
Affects only imports of names from those modules, imports of modules will be reported.
<details>
<summary>Example</summary>
```text
flake8 --private-name-import-skip-names-from-modules=_module,module._sub_module
```
```python
from _module import name # skipped
from module._sub_module import _name # skipped (both private module and private name)
import _module # PNI002 found import of private module: _module
```
</details>
### Skip local imports
`console`: --private-name-import-skip-local
`config_file`: private_name_import_skip_local
`type`: flag
When option used, import inside functions will not be reported
### Skip relative imports
`console`: --private-name-import-skip-relative
`config_file`: private_name_import_skip_relative
`type`: flag
When option used, relative imports will not be reported
### Skip test files and folders
`console`: --private-name-import-dont-skip-test
`config_file`: private_name_import_dont_skip_test
`type`: flag
By default, imports in test directories/files are not reported.
This option turn the feature off (test files and folders will be checked for private imports).
### Skip `TYPE_CHECKING`
`console`: --private-name-import-dont-skip-type-checking
`config_file`: private_name_import_dont_skip_type_checking
`type`: flag
By default, imports under `TYPE_CHECKING` are not reported.
This option turn the feature off (`TYPE_CHECKING` imports will be checked for private imports).
Raw data
{
"_id": null,
"home_page": "https://github.com/rows-s/flake8_private_name_import",
"name": "flake8-private-name-import",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": "",
"keywords": "python pep8 flake8 private import",
"author": "Vladimir Marmuz",
"author_email": "vladimir.rows@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/ea/f8/db95a3f5fe7a66cba9e683d2a0090017167fd53ee8d33450c101640a6ef5/flake8_private_name_import-1.0.0.tar.gz",
"platform": null,
"description": "# flake8_private_name_import\nflake8 plugin that reports imports of private names. \n\n# Codes\n\n<details>\n <summary>PNI001 found import of private name: {name}</summary>\n\n ```python\n from module import _my_private_name # PNI001 found import of private name: _my_private_name\n ```\n\n</details>\n\n<details>\n <summary>PNI002 found import of private module: {module}</summary>\n\n ```python\n import _module # PNI002 found import of private module: _module\n import module._sub_module # PNI002 found import of private module: module._sub_module\n ```\n\n</details>\n\n<details>\n <summary>PNI003 found import from private module: {module}</summary>\n\n ```python\n from _module import name # PNI003 found import from private module: _module\n from module._sub_module import name # PNI003 found import from private module: module._sub_module\n ```\n\n</details>\n\n# Options\n\n### Skip names (`PNI001`)\n\n`console`: --private-name-import-skip-names \n`config_file`: private_name_import_skip_names \n`type`: comma separated list (list for config_file)\n\nPrivate names import of which must not be reported. \nAccepts full path (`module.sub_module._name`) or plain name (`_name`). \nIf full path used then only that name from that module would be skipped. \nIf plain name used then name would be skipped independent on module it imported from.\n\n<details>\n <summary>Example (specific name from specific module)</summary>\n\n ```text\n flake8 --private-name-import-skip-names=module.sub_module._function,module.sub_module._Class\n ```\n\n ```python\n from module.sub_module import _function, _Class # both skipped\n from module.sub_module import _CONSTANT # PNI001 found import of private name: _CONSTANT\n ```\n\n</details>\n\n<details>\n <summary>Example (module independent name)</summary>\n\n ```text\n flake8 --private-name-import-skip-names=_function,_Class\n ```\n\n ```python\n from module import _function, _Class # both skipped\n from module.sub_module import _function, _Class # both skipped\n from module.sub_module import _CONSTANT # PNI001 found import of private name: _CONSTANT\n ```\n\n</details>\n\n### Skip modules (`PNI002`)\n\n`console`: --private-name-import-skip-modules \n`config_file`: private_name_import_skip_modules \n`type`: comma separated list (list for config_file)\n\nPrivate modules import of which must not be reported. \nAffects only imports of modules, imports of names from those modules will be reported.\n\n<details>\n <summary>Example</summary>\n\n ```text\n flake8 --private-name-import-skip-modules=_module,module._sub_module\n ```\n\n ```python\n import _module # skipped\n import module._sub_module # skipped\n from _module import name # PNI003 found import from private module: _module\n ```\n\n</details>\n\n### Skip names from modules (`PNI003`, `PNI001`)\n\n`console`: --private-name-import-skip-names-from-modules \n`config_file`: private_name_import_skip_names_from_modules \n`type`: comma separated list (list for config_file)\n\nComma separated modules imports of private names from which must not be reported. \nAffects only imports of names from those modules, imports of modules will be reported.\n\n<details>\n <summary>Example</summary>\n\n ```text\n flake8 --private-name-import-skip-names-from-modules=_module,module._sub_module\n ```\n\n ```python\n from _module import name # skipped\n from module._sub_module import _name # skipped (both private module and private name)\n import _module # PNI002 found import of private module: _module\n ```\n\n</details>\n\n### Skip local imports\n\n`console`: --private-name-import-skip-local \n`config_file`: private_name_import_skip_local \n`type`: flag\n\nWhen option used, import inside functions will not be reported\n\n### Skip relative imports\n\n`console`: --private-name-import-skip-relative \n`config_file`: private_name_import_skip_relative \n`type`: flag\n\nWhen option used, relative imports will not be reported\n\n### Skip test files and folders\n\n`console`: --private-name-import-dont-skip-test \n`config_file`: private_name_import_dont_skip_test \n`type`: flag\n\nBy default, imports in test directories/files are not reported. \nThis option turn the feature off (test files and folders will be checked for private imports).\n\n### Skip `TYPE_CHECKING`\n\n`console`: --private-name-import-dont-skip-type-checking \n`config_file`: private_name_import_dont_skip_type_checking \n`type`: flag\n\nBy default, imports under `TYPE_CHECKING` are not reported. \nThis option turn the feature off (`TYPE_CHECKING` imports will be checked for private imports).\n\n\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "flake8 plugin that reports imports of private names",
"version": "1.0.0",
"project_urls": {
"Homepage": "https://github.com/rows-s/flake8_private_name_import"
},
"split_keywords": [
"python",
"pep8",
"flake8",
"private",
"import"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "4ef99a7fc46d4cb4666c9037669ae08e7adaeff2198481274ca1923ee9fce775",
"md5": "a42b26a7c5f0831bd7ac3793a90e50e3",
"sha256": "0d7f1fbf50aea08f8003f18fa9ed8be297c35dbd0b4eac6c63c32abf09dd0c35"
},
"downloads": -1,
"filename": "flake8_private_name_import-1.0.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "a42b26a7c5f0831bd7ac3793a90e50e3",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7",
"size": 6197,
"upload_time": "2023-07-29T20:17:47",
"upload_time_iso_8601": "2023-07-29T20:17:47.350196Z",
"url": "https://files.pythonhosted.org/packages/4e/f9/9a7fc46d4cb4666c9037669ae08e7adaeff2198481274ca1923ee9fce775/flake8_private_name_import-1.0.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "eaf8db95a3f5fe7a66cba9e683d2a0090017167fd53ee8d33450c101640a6ef5",
"md5": "509fdb4b90a043af5d07b5dfb3acbf63",
"sha256": "e4ae9c5f17194d8754fd239923ad6a78324e98dab013b9bb92ad5b1814029436"
},
"downloads": -1,
"filename": "flake8_private_name_import-1.0.0.tar.gz",
"has_sig": false,
"md5_digest": "509fdb4b90a043af5d07b5dfb3acbf63",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7",
"size": 4885,
"upload_time": "2023-07-29T20:17:49",
"upload_time_iso_8601": "2023-07-29T20:17:49.147992Z",
"url": "https://files.pythonhosted.org/packages/ea/f8/db95a3f5fe7a66cba9e683d2a0090017167fd53ee8d33450c101640a6ef5/flake8_private_name_import-1.0.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-07-29 20:17:49",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "rows-s",
"github_project": "flake8_private_name_import",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "flake8-private-name-import"
}