Metadata-Version: 2.1
Name: flake8-private-name-import
Version: 1.0.0
Summary: flake8 plugin that reports imports of private names
Home-page: https://github.com/rows-s/flake8_private_name_import
Author: Vladimir Marmuz
Author-email: vladimir.rows@gmail.com
License: MIT
Keywords: python pep8 flake8 private import
Platform: UNKNOWN
Classifier: Development Status :: 5 - Production/Stable
Classifier: Environment :: Console
Classifier: Framework :: Flake8
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: GNU General Public License v2 (GPLv2)
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Topic :: Software Development
Classifier: Topic :: Software Development :: Quality Assurance
Requires-Python: >=3.7
Requires-Dist: flake8 (>=3.3.0)
Provides-Extra: test
Requires-Dist: pytest ; extra == 'test'

# 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).


