Giter Club home page Giter Club logo

python-third-party-imports's Introduction

python-third-party-imports

This is a Python CLI tool built with Rust that finds all third-party packages imported into your Python project.

Install

You can install this package via pip.

pip install third-party-imports

Usage

Run:

Check a directory:

third-party-imports path/to/project/dir

Check a directory with extra files:

third-party-imports --extra-file-paths path/to/project/dir/foo.sh path/to/project/dir

Note: You can use --extra-file-paths option to include files that do not contain .py or .pyi extension.

Check a file:

third-party-imports --project-root path/to/project/dir/ path/to/project/dir/foo/main.py

Note: If the file is not located in the project root directory, then you need to use --project-root option to specify where the project root directory is located.

Help:

Find all third-party packages imported into your python project.

Usage: third-party-imports [OPTIONS] <PATH>

Arguments:
  <PATH>  Path to a file or directory to check

Options:
  -p, --project-root <PROJECT_ROOT>          Path to the project's root directory
  -e, --extra-file-paths <EXTRA_FILE_PATHS>  Extra file paths to check
  -h, --help                                 Print help
  -V, --version                              Print version

Example

third-party-imports examples/

Output:

Found '4' third-party package imports in '5' files. (Took 920.50µs)

celery
django
pandas
requests

Development

Run using Cargo

cargo +nightly run -- path/to/project/dir

Code Format

cargo +nightly fmt

Run Tests

cargo +nightly test

Install Package in current virtualenv

maturin develop

License

The code in this project is released under the MIT License.

python-third-party-imports's People

Contributors

saadmk11 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

python-third-party-imports's Issues

'Path must be a directory' error on Windows

Hi,

On Windows 10, when I run the following:

third-party-imports gPython\gremote.py

I get the following:

error: invalid value 'gPython\gremote.py' for '<PROJECT_ROOT>': Path must be a directory

This also happens if I try with forward-slash (as in Linux) or the with the full path.

Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.