Metadata-Version: 2.1
Name: flake8-allowlist-imports
Version: 0.1.2
Summary: flake8 plugin to allowlist imports
Author-email: Felix Scherz <felixwscherz@gmail.com>
License: MIT License
        
        Copyright (c) 2024 Felix Scherz
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
        
Project-URL: issues, https://github.com/felixwscherz/flake8-allowlist-imports/issues
Project-URL: repository, https://github.com/felixscherz/flake8-allowlist-imports
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: Implementation :: CPython
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: flake8 >=3.8
Requires-Dist: classify-imports >=4.0
Requires-Dist: importlib-metadata ; python_version < "3.10"

# flake8-allowlist-imports

[![PyPI - Version](https://img.shields.io/pypi/v/flake8-allowlist-imports.svg)](https://pypi.org/project/flake8-allowlist-imports)
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/flake8-allowlist-imports.svg)](https://pypi.org/project/flake8-allowlist-imports)

---

flake8 plugin which validates imports against an allowlist

## installation

`pip install flake8-allowlist-imports`

## flake8 codes

| Code   | Description                                             |
|--------|---------------------------------------------------------|
| FAI001 | third party package is not allowed by the allowlist     |

## rationale

flake8-allowlist-imports helps with constraining imports when building applications in a team

## configuration

This plugin expects a comma-separated list of package names to allow.
Packages can be specified via `--import-allowlist` or as part of the flake8 configuration:

```ini
[flake8]
import-allowlist = mypackage,requests
```

## as a pre-commit hook

See [pre-commit](https://github.com/pre-commit/pre-commit) for instructions.
Sample `.pre-commit-config.yaml`:

```yaml
- repo: https://github.com/pycqa/flake8
  rev: 7.0.0
  hooks:
    - id: flake8
      additional_dependencies: [flake8-allowlist-imports==0.1.1]
      args:
        - --import-allowlist
        - mypackage,requests
```

