How to use the pipreqs.get_all_imports function in pipreqs

To help you get started, we’ve selected a few pipreqs examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github replit / upm / resources / python / bare-imports.py View on Github external
# This is a Python script that implements bare imports for Python
# using pipreqs. It takes no arguments, and dumps a list of package
# names (strings) to stdout in JSON format. The script works in both
# Python 2 and Python 3. It expects pipreqs.py to be on the
# PYTHONPATH. UPM accomplishes this by writing it into the same
# directory as this script.

from __future__ import print_function
import json
import pipreqs
import sys

imports, had_errors = pipreqs.get_all_imports(
    ".", extra_ignore_dirs=sys.argv[1].split()
)
json.dump({"imports": imports, "success": not had_errors}, sys.stdout)

pipreqs

Pip requirements.txt generator based on imports in project

Apache-2.0
Latest version published 10 months ago

Package Health Score

77 / 100
Full package analysis

Similar packages