scanreq


Namescanreq JSON
Version 0.0.8 PyPI version JSON
download
home_pageNone
SummaryPython tool to scan all unused packages in requirements.txt file for your project.
upload_time2024-04-07 15:56:58
maintainerNone
docs_urlNone
authorNone
requires_python>=3.8
licenseNone
keywords packages requirements scan unused
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # ScanReq

[![PyPI - Version](https://img.shields.io/pypi/v/scanreq.svg)](https://pypi.org/project/scanreq)
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/scanreq.svg)](https://pypi.org/project/scanreq)
[![Build Status](https://img.shields.io/github/actions/workflow/status/agusmakmun/scan-unused-requirements/run-tests.yml?branch=master)](https://github.com/agusmakmun/scan-unused-requirements/actions/workflows/run-tests.yml)
[![Code Style](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)

**ScanReq** - Python tool to scan all unused packages in requirements.txt file for your project.

## Background

One popular tool for checking requirements in a Python project is `pipdeptree`. However, the problem arises when we don't know which packages listed in the `requirements.txt` file are actually being used in the project or not. It's easy to check if your project is small, but as your project grows larger, it becomes a headache to check one by one.

So, this tool comes in handy for easily identifying which exact packages are actually unused in our project.

### Benefits

1. **Save Money**: Remove unused dependencies to lower hosting costs.
2. **Speed Up**: Faster installation and build times mean quicker development.
3. **Use Resources Wisely**: Free up disk and memory space by removing what you don't use.
4. **Easier Maintenance**: Keep your project cleaner and simpler for easier management.
5. **Focus Better**: Work with only what you need, enhancing productivity.
6. **Update Efficiently**: Ensure your dependencies are up-to-date for smoother compatibility.
7. **Stay Safe**: Reduce the chance of security vulnerabilities by trimming unnecessary dependencies.
8. **Stay Legal**: Avoid licensing issues by managing dependencies more effectively.
9. **Work Together**: Simplify collaboration with a consistent set of dependencies.
10. **Code Better**: Keep your documentation and codebase cleaner for improved quality.


## Installation


```console
pip3 install scanreq
```


## Usage

> **Note:** Ensure you're working on python environment & already installed all your project requirements.txt

```console
scanreq -r requirements.txt -p . -o unused-requirements.txt -i black,flake8
```

```
[i] Please wait! It may take few minutes to complete...
[i] Scanning unused packages:
 1.  Module: rcssmin                       -> Package: rcssmin
 2.  Module: model_utils                   -> Package: django-model-utils
 3.  Module: pinax_theme_bootstrap         -> Package: pinax-theme-bootstrap
 4.  Module: phonenumbers                  -> Package: phonenumbers
```

```console
cat unused-requirements.txt
```

```
rcssmin
django-model-utils
pinax-theme-bootstrap
phonenumbers
```

Cool right? 😎

```console
scanreq --help
```

```
usage: scanreq [-h] [-r REQUIREMENTS] [-p PATH] [-o OUTPUT] [-i IGNORED_PACKAGES]

Scan for unused Python packages.

optional arguments:
  -h, --help            show this help message and exit
  -r REQUIREMENTS, --requirements REQUIREMENTS
                        Path to the requirements.txt file to read packages from.
  -p PATH, --path PATH  Project path to scan for unused packages (default: current directory).
  -o OUTPUT, --output OUTPUT
                        Path to the output file where unused packages will be saved.
  -i IGNORED_PACKAGES, --ignored-packages IGNORED_PACKAGES
                        Comma separated list of package names to be ignored.
```

> **Note:** Don't forget to cross-check the unused packages after finding them,
> because sometimes they are used in different cases without being imported in the code.
> For example: `argon2-cffi` used in `settings.PASSWORD_HASHERS = ["django.contrib.auth.hashers.Argon2PasswordHasher", ...]` for Django.


## ToDo List

- [x] Support argument parser (command arguments)
   - [x] Directory to scan
   - [x] Requirement file to scan
   - [x] Option to write the output of unused packages
   - [x] Option to exclude or ignore some packages
   - [ ] Option to auto replace the package from requirements.txt file
- [x] Support CLI - make it as a command
- [x] Write some tests
- [x] Publish to PyPi
- [x] Support multiple python versions
- [ ] Support scan the `pyproject.toml`
- [ ] Support multiple devices (Linux, Macbook, and Windows)

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "scanreq",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": "packages, requirements, scan, unused",
    "author": null,
    "author_email": "agusmakmun <summon.agus@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/3f/9f/a2fdc2662459c74b3814059127b53fc3d328dcce834027a1c1189a3dffe5/scanreq-0.0.8.tar.gz",
    "platform": null,
    "description": "# ScanReq\n\n[![PyPI - Version](https://img.shields.io/pypi/v/scanreq.svg)](https://pypi.org/project/scanreq)\n[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/scanreq.svg)](https://pypi.org/project/scanreq)\n[![Build Status](https://img.shields.io/github/actions/workflow/status/agusmakmun/scan-unused-requirements/run-tests.yml?branch=master)](https://github.com/agusmakmun/scan-unused-requirements/actions/workflows/run-tests.yml)\n[![Code Style](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)\n\n**ScanReq** - Python tool to scan all unused packages in requirements.txt file for your project.\n\n## Background\n\nOne popular tool for checking requirements in a Python project is `pipdeptree`. However, the problem arises when we don't know which packages listed in the `requirements.txt` file are actually being used in the project or not. It's easy to check if your project is small, but as your project grows larger, it becomes a headache to check one by one.\n\nSo, this tool comes in handy for easily identifying which exact packages are actually unused in our project.\n\n### Benefits\n\n1. **Save Money**: Remove unused dependencies to lower hosting costs.\n2. **Speed Up**: Faster installation and build times mean quicker development.\n3. **Use Resources Wisely**: Free up disk and memory space by removing what you don't use.\n4. **Easier Maintenance**: Keep your project cleaner and simpler for easier management.\n5. **Focus Better**: Work with only what you need, enhancing productivity.\n6. **Update Efficiently**: Ensure your dependencies are up-to-date for smoother compatibility.\n7. **Stay Safe**: Reduce the chance of security vulnerabilities by trimming unnecessary dependencies.\n8. **Stay Legal**: Avoid licensing issues by managing dependencies more effectively.\n9. **Work Together**: Simplify collaboration with a consistent set of dependencies.\n10. **Code Better**: Keep your documentation and codebase cleaner for improved quality.\n\n\n## Installation\n\n\n```console\npip3 install scanreq\n```\n\n\n## Usage\n\n> **Note:** Ensure you're working on python environment & already installed all your project requirements.txt\n\n```console\nscanreq -r requirements.txt -p . -o unused-requirements.txt -i black,flake8\n```\n\n```\n[i] Please wait! It may take few minutes to complete...\n[i] Scanning unused packages:\n 1.  Module: rcssmin                       -> Package: rcssmin\n 2.  Module: model_utils                   -> Package: django-model-utils\n 3.  Module: pinax_theme_bootstrap         -> Package: pinax-theme-bootstrap\n 4.  Module: phonenumbers                  -> Package: phonenumbers\n```\n\n```console\ncat unused-requirements.txt\n```\n\n```\nrcssmin\ndjango-model-utils\npinax-theme-bootstrap\nphonenumbers\n```\n\nCool right? \ud83d\ude0e\n\n```console\nscanreq --help\n```\n\n```\nusage: scanreq [-h] [-r REQUIREMENTS] [-p PATH] [-o OUTPUT] [-i IGNORED_PACKAGES]\n\nScan for unused Python packages.\n\noptional arguments:\n  -h, --help            show this help message and exit\n  -r REQUIREMENTS, --requirements REQUIREMENTS\n                        Path to the requirements.txt file to read packages from.\n  -p PATH, --path PATH  Project path to scan for unused packages (default: current directory).\n  -o OUTPUT, --output OUTPUT\n                        Path to the output file where unused packages will be saved.\n  -i IGNORED_PACKAGES, --ignored-packages IGNORED_PACKAGES\n                        Comma separated list of package names to be ignored.\n```\n\n> **Note:** Don't forget to cross-check the unused packages after finding them,\n> because sometimes they are used in different cases without being imported in the code.\n> For example: `argon2-cffi` used in `settings.PASSWORD_HASHERS = [\"django.contrib.auth.hashers.Argon2PasswordHasher\", ...]` for Django.\n\n\n## ToDo List\n\n- [x] Support argument parser (command arguments)\n   - [x] Directory to scan\n   - [x] Requirement file to scan\n   - [x] Option to write the output of unused packages\n   - [x] Option to exclude or ignore some packages\n   - [ ] Option to auto replace the package from requirements.txt file\n- [x] Support CLI - make it as a command\n- [x] Write some tests\n- [x] Publish to PyPi\n- [x] Support multiple python versions\n- [ ] Support scan the `pyproject.toml`\n- [ ] Support multiple devices (Linux, Macbook, and Windows)\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "Python tool to scan all unused packages in requirements.txt file for your project.",
    "version": "0.0.8",
    "project_urls": {
        "Changelog": "https://github.com/agusmakmun/scan-unused-requirements/releases",
        "Documentation": "https://github.com/agusmakmun/scan-unused-requirements",
        "Issues": "https://github.com/agusmakmun/scan-unused-requirements/issues",
        "Source": "https://github.com/agusmakmun/scan-unused-requirements"
    },
    "split_keywords": [
        "packages",
        " requirements",
        " scan",
        " unused"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "245cf199bd8046541f20e6e8e4d8721dcde294018a48d5f4ff78911c4403e095",
                "md5": "c0820574466319d4c54182b338cd2117",
                "sha256": "a7330b953285c41ae2296974d4877f009de3c943ead2b7533f5c56dbbcc83830"
            },
            "downloads": -1,
            "filename": "scanreq-0.0.8-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "c0820574466319d4c54182b338cd2117",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 7705,
            "upload_time": "2024-04-07T15:56:55",
            "upload_time_iso_8601": "2024-04-07T15:56:55.852115Z",
            "url": "https://files.pythonhosted.org/packages/24/5c/f199bd8046541f20e6e8e4d8721dcde294018a48d5f4ff78911c4403e095/scanreq-0.0.8-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "3f9fa2fdc2662459c74b3814059127b53fc3d328dcce834027a1c1189a3dffe5",
                "md5": "1a03d353afd37d296012bccd66c6e27f",
                "sha256": "03abb6886fc90c35485614800b87ea24440c523a379a0666f6f8ec071c0f7616"
            },
            "downloads": -1,
            "filename": "scanreq-0.0.8.tar.gz",
            "has_sig": false,
            "md5_digest": "1a03d353afd37d296012bccd66c6e27f",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 8981,
            "upload_time": "2024-04-07T15:56:58",
            "upload_time_iso_8601": "2024-04-07T15:56:58.182388Z",
            "url": "https://files.pythonhosted.org/packages/3f/9f/a2fdc2662459c74b3814059127b53fc3d328dcce834027a1c1189a3dffe5/scanreq-0.0.8.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-04-07 15:56:58",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "agusmakmun",
    "github_project": "scan-unused-requirements",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "scanreq"
}
        
Elapsed time: 3.18468s