pymport


Namepymport JSON
Version 0.0.2 PyPI version JSON
download
home_pageNone
SummaryA lightweight Python linter for checking unused docstrings.
upload_time2025-10-23 15:54:20
maintainerNone
docs_urlNone
authormalatorrediaz
requires_python>=3.8
licenseNone
keywords python linter developer-tools code-quality import
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # pymport

[![PyPI](https://img.shields.io/pypi/v/pymport.svg)](https://pypi.python.org/pypi/pymport)
[![CI](https://github.com/rmoralespp/pymport/workflows/CI/badge.svg)](https://github.com/rmoralespp/pymport/actions?query=event%3Arelease+workflow%3ACI)
[![versions](https://img.shields.io/pypi/pyversions/pymport.svg)](https://github.com/rmoralespp/pymport)
[![codecov](https://codecov.io/gh/rmoralespp/pymport/branch/main/graph/badge.svg)](https://app.codecov.io/gh/rmoralespp/pymport)
[![license](https://img.shields.io/github/license/rmoralespp/pymport.svg)](https://github.com/rmoralespp/pymport/blob/main/LICENSE)
[![Linter: ruff](https://img.shields.io/badge/linter-_ruff-orange)](https://github.com/charliermarsh/ruff)

## About

A lightweight Python linter for checking unused imports

### Features

* ๐Ÿงน Detects unused or shadowed `imports` that linters like **ruff** may miss
* ๐Ÿšซ Use `noqa` comments to ignore imports you want to keep
* โš™๏ธ Minimalist CLI interface for easy integration in **CI/CD** pipelines
* ๐Ÿ No external dependencies beyond the Python standard library
* โœ… **100%** test coverage with automated tests

> [!IMPORTANT]
> **False positives**
>
> This tool is not possible to assure a 100% false positive free result due to the
> possible collateral execution effects when importing a module.
> This is, importing a module can affect or enable some feature needed somewhere
> else, so not using anything from that imported package/module does not necessarily mean is not needed.

A minimal typical example could be:

```python
import os.path

print(os.curdir)
```

## Installation

To install **pymport** using `pip`, run the following command:

```bash
pip install pymport --upgrade
```

## Quick Start

To run the linter on the current directory, use the following command:

```bash
pymport .
```

* This will check all Python files in the current directory and its subdirectories.

### Command-Line Interface

`pymport [FILE] [--help]`

| Argument / Option | Description                                                             |
|-------------------|-------------------------------------------------------------------------|
| `[FILE]`          | Files or directories to lint. (Need at least one file or dir to check.) |
| `--help`          | Show help message and exit.                                             |

> [!TIP]
> **Ignoring Unused Imports**
>
> Use a comment like `# noqa: unused-import` to ignore the line.

### Output

When unused imports are detected, they will be reported in the following format:

```text
path/to/file.py:LINE-NUMBER: UNUSED-IMPORT-NAME
```

> [!NOTE]
>
> * Exit code `0` means no unused imports were found; exit code `1` indicates that unused imports were detected.
> * When no unused imports are found, success message is printed.

## Development

To contribute to the project, you can run the following commands for testing and documentation:

First, ensure you have the latest version of `pip`:

```bash
python -m pip install --upgrade pip
```

### Running Tests

```bash
pip install --group=test --upgrade # Install test dependencies, skip if already installed
python -m pytest tests/ # Run all tests
python -m pytest tests/ --cov # Run tests with coverage
```

### Running Linter

```bash
pip install --group=lint --upgrade  # Install lint dependencies, skip if already installed
ruff check . # Run linter
```

## License

This project is licensed under the [MIT license](LICENSE).

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "pymport",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": "python, linter, developer-tools, code-quality, import",
    "author": "malatorrediaz",
    "author_email": "rmoralespp <rmoralespp@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/44/f8/55240eed5fd2f84af44e2353b87c9aa3e08eb44c5181cd85e67c325fc650/pymport-0.0.2.tar.gz",
    "platform": null,
    "description": "# pymport\n\n[![PyPI](https://img.shields.io/pypi/v/pymport.svg)](https://pypi.python.org/pypi/pymport)\n[![CI](https://github.com/rmoralespp/pymport/workflows/CI/badge.svg)](https://github.com/rmoralespp/pymport/actions?query=event%3Arelease+workflow%3ACI)\n[![versions](https://img.shields.io/pypi/pyversions/pymport.svg)](https://github.com/rmoralespp/pymport)\n[![codecov](https://codecov.io/gh/rmoralespp/pymport/branch/main/graph/badge.svg)](https://app.codecov.io/gh/rmoralespp/pymport)\n[![license](https://img.shields.io/github/license/rmoralespp/pymport.svg)](https://github.com/rmoralespp/pymport/blob/main/LICENSE)\n[![Linter: ruff](https://img.shields.io/badge/linter-_ruff-orange)](https://github.com/charliermarsh/ruff)\n\n## About\n\nA lightweight Python linter for checking unused imports\n\n### Features\n\n* \ud83e\uddf9 Detects unused or shadowed `imports` that linters like **ruff** may miss\n* \ud83d\udeab Use `noqa` comments to ignore imports you want to keep\n* \u2699\ufe0f Minimalist CLI interface for easy integration in **CI/CD** pipelines\n* \ud83d\udc0d No external dependencies beyond the Python standard library\n* \u2705 **100%** test coverage with automated tests\n\n> [!IMPORTANT]\n> **False positives**\n>\n> This tool is not possible to assure a 100% false positive free result due to the\n> possible collateral execution effects when importing a module.\n> This is, importing a module can affect or enable some feature needed somewhere\n> else, so not using anything from that imported package/module does not necessarily mean is not needed.\n\nA minimal typical example could be:\n\n```python\nimport os.path\n\nprint(os.curdir)\n```\n\n## Installation\n\nTo install **pymport** using `pip`, run the following command:\n\n```bash\npip install pymport --upgrade\n```\n\n## Quick Start\n\nTo run the linter on the current directory, use the following command:\n\n```bash\npymport .\n```\n\n* This will check all Python files in the current directory and its subdirectories.\n\n### Command-Line Interface\n\n`pymport [FILE] [--help]`\n\n| Argument / Option | Description                                                             |\n|-------------------|-------------------------------------------------------------------------|\n| `[FILE]`          | Files or directories to lint. (Need at least one file or dir to check.) |\n| `--help`          | Show help message and exit.                                             |\n\n> [!TIP]\n> **Ignoring Unused Imports**\n>\n> Use a comment like `# noqa: unused-import` to ignore the line.\n\n### Output\n\nWhen unused imports are detected, they will be reported in the following format:\n\n```text\npath/to/file.py:LINE-NUMBER: UNUSED-IMPORT-NAME\n```\n\n> [!NOTE]\n>\n> * Exit code `0` means no unused imports were found; exit code `1` indicates that unused imports were detected.\n> * When no unused imports are found, success message is printed.\n\n## Development\n\nTo contribute to the project, you can run the following commands for testing and documentation:\n\nFirst, ensure you have the latest version of `pip`:\n\n```bash\npython -m pip install --upgrade pip\n```\n\n### Running Tests\n\n```bash\npip install --group=test --upgrade # Install test dependencies, skip if already installed\npython -m pytest tests/ # Run all tests\npython -m pytest tests/ --cov # Run tests with coverage\n```\n\n### Running Linter\n\n```bash\npip install --group=lint --upgrade  # Install lint dependencies, skip if already installed\nruff check . # Run linter\n```\n\n## License\n\nThis project is licensed under the [MIT license](LICENSE).\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "A lightweight Python linter for checking unused docstrings.",
    "version": "0.0.2",
    "project_urls": {
        "Changelog": "https://github.com/rmoralespp/pymport/blob/main/CHANGELOG.md",
        "Homepage": "https://github.com/rmoralespp/pymport",
        "Issues": "https://github.com/rmoralespp/pymport/issues",
        "Source": "https://github.com/rmoralespp/pymport"
    },
    "split_keywords": [
        "python",
        " linter",
        " developer-tools",
        " code-quality",
        " import"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "f10f1221bebdbdc42f4c5d4a7109384c0e48ce6e27d839801d7dff7b8b405902",
                "md5": "3a247ae79e16a350e2518f537e675648",
                "sha256": "7371ce34c8fb56e577072332362e70bfb18e55e1cb7f8d31694383a749431f2f"
            },
            "downloads": -1,
            "filename": "pymport-0.0.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "3a247ae79e16a350e2518f537e675648",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 6349,
            "upload_time": "2025-10-23T15:54:19",
            "upload_time_iso_8601": "2025-10-23T15:54:19.585818Z",
            "url": "https://files.pythonhosted.org/packages/f1/0f/1221bebdbdc42f4c5d4a7109384c0e48ce6e27d839801d7dff7b8b405902/pymport-0.0.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "44f855240eed5fd2f84af44e2353b87c9aa3e08eb44c5181cd85e67c325fc650",
                "md5": "5d27820dedba754eaf5699458b433be0",
                "sha256": "5424ab2584a6a8b52cda8f0fe20fc841d2d658c28c036439086a8f62c1f66f2b"
            },
            "downloads": -1,
            "filename": "pymport-0.0.2.tar.gz",
            "has_sig": false,
            "md5_digest": "5d27820dedba754eaf5699458b433be0",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 7541,
            "upload_time": "2025-10-23T15:54:20",
            "upload_time_iso_8601": "2025-10-23T15:54:20.799774Z",
            "url": "https://files.pythonhosted.org/packages/44/f8/55240eed5fd2f84af44e2353b87c9aa3e08eb44c5181cd85e67c325fc650/pymport-0.0.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-10-23 15:54:20",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "rmoralespp",
    "github_project": "pymport",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "pymport"
}
        
Elapsed time: 1.44231s