Skip to main content

Find the python dependencies used by your python files and projects

Project description

Downloads Downloads Downloads

findpydeps

Find the python dependencies used by your python files and projects.

Installation

Simply install it via pip:

pip install findpydeps

If you are having trouble with the pip installation, you can use the source file :

git clone https://github.com/Nicolas-Reyland/findpydeps
cp findpydeps/src/findpydeps/findpydeps.py ~/.local/bin/findpydeps

Usage

Example usage:

findpydeps -i "$HOME"/python/example-project/ test.py ../test2.py

The output of findpydeps -i main.py -l --no-header could look like that :

tensorflow
pandas
numpy
pillow
requests

You could then use the output like this :

cd your_python_project
findpydeps -i main.py --follow-local-imports > requirements.txt
pip install -r requirements.txt

For exhaustive usage information, please refer to the findpydeps -h output (or python3 -m findpydeps -h) :

usage: findpydeps.py [-h] [-i input [input ...]] [-d expr] [-r policy] [-l] [-s] [--blocks] [--no-blocks] [--functions] [--no-functions] [--submodules-as-modules] [-v] [--header]
                     [--no-header]

Find the python dependencies used by your python files

options:
  -h, --help            show this help message and exit
  -i input [input ...], --input input [input ...]
                        input files and/or directories (directories will be scanned for *.py files)
  -d expr, --dir-scanning-expr expr
                        only process files with this expression in scanned directories [default: *.py]
  -r policy, --removal-policy policy
                        removal policy for modules (0: local & stdlib, 1: local only, 2: stdlib only, 3: no removal) [default: 0]
  -l, --follow-local-imports
                        also scan files which are imported locally (not libraries)
  -s, --strict          raise an error on SyntaxErrors in the input python files
  --blocks              scan contents of 'if', 'try' and 'with' blocks
  --no-blocks           don't scan contents of 'if', 'try' and 'with' blocks
  --functions           scan contents of functions
  --no-functions        don't scan contents of functions
  --submodules-as-modules
                        submodule imports are treated as module-imports (e.g. "import random.shuffle" generates "random.shuffle", not "random", which is the default behavior)
  -v, --verbose         verbose mode (all messages prepended with '#')
  --header              show the greeting header
  --no-header           don't show the greeting header

Todo

  • Option to manually exclude/include modules

MIT License

Copyright (c) 2021 Nicolas Reyland

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 details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

findpydeps-0.2.7-py3-none-any.whl (12.6 kB view details)

Uploaded Python 3

File details

Details for the file findpydeps-0.2.7-py3-none-any.whl.

File metadata

  • Download URL: findpydeps-0.2.7-py3-none-any.whl
  • Upload date:
  • Size: 12.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.2

File hashes

Hashes for findpydeps-0.2.7-py3-none-any.whl
Algorithm Hash digest
SHA256 187d40327200f7012d597108711e1979097f921c5497bd2b72ce40c0f3acfd3b
MD5 e0c5547b341dd237168602bf83981ace
BLAKE2b-256 f4226cbd8c0553f73c2a73fdf629329fec1b6c1f186537169193e780c58e6125

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page