Repository: bndr/pipreqs Branch: master Commit: 48dbafd39003 Files: 51 Total size: 169.6 KB Directory structure: gitextract_g_ilhfmq/ ├── .editorconfig ├── .github/ │ └── workflows/ │ ├── flake8.yml │ └── tests.yml ├── .gitignore ├── .pre-commit-config.yaml ├── .python-version ├── .tool-versions ├── AUTHORS.rst ├── CONTRIBUTING.rst ├── HISTORY.rst ├── LICENSE ├── Makefile ├── README.rst ├── docs/ │ ├── Makefile │ ├── authors.rst │ ├── conf.py │ ├── contributing.rst │ ├── history.rst │ ├── index.rst │ ├── installation.rst │ ├── make.bat │ ├── readme.rst │ └── usage.rst ├── pipreqs/ │ ├── __init__.py │ ├── mapping │ ├── pipreqs.py │ └── stdlib ├── poetry.toml ├── pyproject.toml ├── tests/ │ ├── __init__.py │ ├── _data/ │ │ ├── empty.txt │ │ ├── imports.txt │ │ ├── imports_any_version.txt │ │ ├── imports_no_version.txt │ │ ├── models.py │ │ └── test.py │ ├── _data_clean/ │ │ └── test.py │ ├── _data_duplicated_deps/ │ │ └── db.py │ ├── _data_ignore/ │ │ ├── .ignore_second/ │ │ │ └── ignored.py │ │ ├── .ignored_dir/ │ │ │ └── ignored.py │ │ └── test.py │ ├── _data_notebook/ │ │ ├── magic_commands.ipynb │ │ ├── markdown_test.ipynb │ │ ├── models.py │ │ └── test.ipynb │ ├── _data_pyw/ │ │ ├── py.py │ │ └── pyw.pyw │ ├── _invalid_data/ │ │ └── invalid.py │ ├── _invalid_data_notebook/ │ │ └── invalid.ipynb │ └── test_pipreqs.py └── tox.ini ================================================ FILE CONTENTS ================================================ ================================================ FILE: .editorconfig ================================================ # http://editorconfig.org root = true [*] indent_style = space indent_size = 4 trim_trailing_whitespace = true insert_final_newline = true charset = utf-8 end_of_line = lf [*.bat] indent_style = tab end_of_line = crlf [LICENSE] insert_final_newline = false [Makefile] indent_style = tab ================================================ FILE: .github/workflows/flake8.yml ================================================ name: flake8 concurrency: group: ${{ github.ref }} cancel-in-progress: true on: workflow_dispatch: push: tags: - "*" branches: - main - master - develop - "release/*" pull_request: jobs: flake8-lint: runs-on: ubuntu-24.04 name: Lint steps: - name: Check out source repository uses: actions/checkout@v4 - name: Set up Python environment uses: actions/setup-python@v5 with: python-version: "3.13" - name: flake8 Lint uses: reviewdog/action-flake8@v3 with: github_token: ${{ secrets.GITHUB_TOKEN }} reporter: github-pr-review ================================================ FILE: .github/workflows/tests.yml ================================================ name: Tests and Codecov on: push: branches: - master - main - "release/*" pull_request: workflow_dispatch: jobs: run_tests: runs-on: ubuntu-24.04 strategy: fail-fast: false matrix: python-version: ['3.9', '3.10', '3.11', '3.12', '3.13', 'pypy-3.10'] steps: - name: Checkout repository uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - name: Install dependencies run: | python -m pip install uv uv pip install --system tox tox-gh-actions - name: Test with tox run: tox coverage_report: needs: run_tests runs-on: ubuntu-24.04 steps: - name: Checkout repository uses: actions/checkout@v4 - name: Set up Python 3.13 uses: actions/setup-python@v5 with: python-version: 3.13 - name: Install dependencies run: | python -m pip install uv uv pip install --system poetry uv pip install --system .[dev] - name: Calculate coverage run: poetry run coverage run --source=pipreqs -m unittest discover - name: Create XML report run: poetry run coverage xml - name: Upload coverage to Codecov uses: codecov/codecov-action@v5 with: files: coverage.xml token: ${{ secrets.CODECOV_TOKEN }} fail_ci_if_error: false ================================================ FILE: .gitignore ================================================ *.py[cod] # C extensions *.so # Packages *.egg *.egg-info dist build eggs parts bin var sdist develop-eggs .installed.cfg lib lib64 # Installer logs pip-log.txt # Unit test / coverage reports .coverage .tox nosetests.xml htmlcov # Translations *.mo # Mr Developer .mr.developer.cfg .project .pydevproject # Complexity output/*.html output/*/index.html # Sphinx docs/_build .idea/ # Created by https://www.gitignore.io/api/vim ### Vim ### [._]*.s[a-w][a-z] [._]s[a-w][a-z] *.un~ Session.vim .netrwhist *~ /pipreqs/*.bak ================================================ FILE: .pre-commit-config.yaml ================================================ ci: autoupdate_commit_msg: "chore: update pre-commit hooks" autofix_commit_msg: "style: pre-commit fixes" autoupdate_schedule: quarterly repos: - repo: https://github.com/pre-commit/pre-commit-hooks rev: v5.0.0 hooks: - id: check-added-large-files args: [ '--maxkb=1000' ] - id: check-case-conflict - id: check-merge-conflict - id: check-symlinks - id: check-yaml - id: check-toml - id: check-json - id: debug-statements - id: end-of-file-fixer - id: mixed-line-ending - id: requirements-txt-fixer - id: trailing-whitespace files: ".*\\.(?:tex|py)$" args: [ --markdown-linebreak-ext=md ] exclude: (^notebooks/|^tests/truth/) - id: detect-private-key - id: fix-byte-order-marker - id: check-ast - id: check-docstring-first - id: debug-statements - repo: https://github.com/pre-commit/pygrep-hooks rev: v1.10.0 hooks: - id: python-use-type-annotations - id: python-check-mock-methods - id: python-no-eval - id: rst-backticks - id: rst-directive-colons - repo: https://github.com/asottile/pyupgrade rev: v3.3.1 hooks: - id: pyupgrade args: [ --py38-plus ] # Notebook formatting - repo: https://github.com/nbQA-dev/nbQA rev: 1.9.1 hooks: - id: nbqa-isort additional_dependencies: [ isort ] - id: nbqa-pyupgrade additional_dependencies: [ pyupgrade ] args: [ --py38-plus ] - repo: https://github.com/kynan/nbstripout rev: 0.8.1 hooks: - id: nbstripout - repo: https://github.com/sondrelg/pep585-upgrade rev: 'v1.0' hooks: - id: upgrade-type-hints args: [ '--futures=true' ] - repo: https://github.com/MarcoGorelli/auto-walrus rev: 0.3.4 hooks: - id: auto-walrus - repo: https://github.com/python-jsonschema/check-jsonschema rev: 0.30.0 hooks: - id: check-github-workflows - id: check-github-actions - id: check-dependabot - id: check-readthedocs - repo: https://github.com/dannysepler/rm_unneeded_f_str rev: v0.2.0 hooks: - id: rm-unneeded-f-str - repo: https://github.com/astral-sh/ruff-pre-commit rev: "v0.8.6" hooks: - id: ruff types_or: [ python, pyi, jupyter ] args: [ --fix, --show-fixes , --line-length=120 ] # --unsafe-fixes, # Run the formatter. - id: ruff-format types_or: [ python, pyi, jupyter ] ================================================ FILE: .python-version ================================================ 3.13 3.12 3.11 3.10 3.9 3.8 pypy3.9-7.3.12 ================================================ FILE: .tool-versions ================================================ python 3.13 3.12 3.11 3.10 3.9 3.8 pypy3.9-7.3.12 ================================================ FILE: AUTHORS.rst ================================================ ======= Credits ======= Development Lead ---------------- * Vadim Kravcenko Contributors ------------ * Jake Teo * Jerome Chan ================================================ FILE: CONTRIBUTING.rst ================================================ ============ Contributing ============ Contributions are welcome, and they are greatly appreciated! Every little bit helps, and credit will always be given. You can contribute in many ways: Types of Contributions ---------------------- Report Bugs ~~~~~~~~~~~ Report bugs at https://github.com/bndr/pipreqs/issues. If you are reporting a bug, please include: * Your operating system name and version. * Any details about your local setup that might be helpful in troubleshooting. * Detailed steps to reproduce the bug. Fix Bugs ~~~~~~~~ Look through the GitHub issues for bugs. Anything tagged with "bug" is open to whoever wants to implement it. Implement Features ~~~~~~~~~~~~~~~~~~ Look through the GitHub issues for features. Anything tagged with "feature" is open to whoever wants to implement it. Write Documentation ~~~~~~~~~~~~~~~~~~~ pipreqs could always use more documentation, whether as part of the official pipreqs docs, in docstrings, or even on the web in blog posts, articles, and such. Submit Feedback ~~~~~~~~~~~~~~~ The best way to send feedback is to file an issue at https://github.com/bndr/pipreqs/issues. If you are proposing a feature: * Explain in detail how it would work. * Keep the scope as narrow as possible, to make it easier to implement. * Remember that this is a volunteer-driven project, and that contributions are welcome :) Get Started! ------------ Ready to contribute? Here's how to set up `pipreqs` for local development. 1. Fork the `pipreqs` repo on GitHub. 2. Clone your fork locally:: $ git clone git@github.com:your_name_here/pipreqs.git $ cd pipreqs/ 3. Pipreqs is developed using Poetry. Refer to the `documentation `_ to install Poetry in your local environment. Next, you should install pipreqs's dependencies:: $ poetry install --with dev 4. Create a branch for local development:: $ git checkout -b name-of-your-bugfix-or-feature Now you can make your changes locally. 5. When you're done making changes, check that your changes pass flake8 and the tests, including testing other Python versions with tox:: $ poetry run flake8 pipreqs tests $ poetry run python -m unittest discover $ poetry run tox To test all versions of python using tox you need to have them installed and for this two options are recommended: `pyenv` or `asdf`. 6. Commit your changes and push your branch to GitHub:: $ git add . $ git commit -m "Your detailed description of your changes." $ git push origin name-of-your-bugfix-or-feature 7. Submit a pull request through the GitHub website. Pull Request Guidelines ----------------------- Before you submit a pull request, check that it meets these guidelines: 1. The pull request should include tests. 2. If the pull request adds functionality, the docs should be updated. Put your new functionality into a function with a docstring, and add the feature to the list in README.rst. 3. The pull request should work for currently supported Python and PyPy versions. Check https://travis-ci.org/bndr/pipreqs/pull_requests and make sure that the tests pass for all supported Python versions. Tips ---- To run a subset of tests:: $ poetry run python -m unittest tests.test_pipreqs ================================================ FILE: HISTORY.rst ================================================ .. :changelog: History ------- 0.4.11 (2020-03-29) -------------------- * Implement '--mode' (Jake Teo, Jerome Chan) 0.4.8 (2017-06-30) -------------------- * Implement '--clean' and '--diff' (kxrd) * Exclude concurrent{,.futures} from stdlib if py2 (kxrd) 0.4.7 (2017-04-20) -------------------- * BUG: remove package/version duplicates * Style: pep8 0.4.5 (2016-12-13) --------------------- * Fixed the --pypi-server option 0.4.4 (2016-07-14) --------------------- * Remove Spaces in output * Add package to output even without version 0.4.2 (2016-02-10) --------------------- * Fix duplicated lines in requirements.txt (Dmitry Pribysh) 0.4.1 (2016-02-05) --------------------- * Added ignore option (Nick Rhinehart) 0.4.0 (2016-01-28) --------------------- * Walk Abstract Syntax Tree to find imports (Kay Sackey) 0.3.9 (2016-01-20) --------------------- * Fix regex for docstring comments (#35) 0.3.8 (2016-01-12) --------------------- * Add more package mapping * fix(pipreqs/mapping): remove pylab reference to matplotlib * Remove comments """ before going through imports * Update proxy documentation 0.3.1 (2015-10-20) --------------------- * fixed lint warnings (EJ Lee) * add --encoding parameter for open() (EJ Lee) * support windows directory separator (EJ Lee) 0.3.0 (2015-09-29) --------------------- * Add --proxy option * Add --pypi-server option 0.2.9 (2015-09-24) --------------------- * Ignore irreverent directory when generating requirement.txt (Lee Wei) * Modify logging level of "Requirement.txt already exists" to warning (Lee Wei) 0.2.8 (2015-05-11) --------------------- * Add --force option as a protection for overwrites 0.2.6 (2015-05-11) --------------------- * Fix exception when 'import' is used inside package name #17 * Add more tests 0.2.5 (2015-05-11) --------------------- * Fix exception when 'import' is used in comments #17 * Fix duplicate entries in requirements.txt 0.2.4 (2015-05-10) --------------------- * Refactoring * fix "import as" 0.2.3 (2015-05-09) --------------------- * Fix multiple alias imports on the same line (Tiago Costa) * More package mappings 0.2.2 (2015-05-08) --------------------- * Add ImportName -> PackageName mapping * More tests 0.2.1 (2015-05-08) --------------------- * Fix for TypeError for implicit conversion 0.2.0 (2015-05-06) --------------------- * Add --use-local option * Exclude relative imports. (Dongwon Shin) * Use "latest_release_id" instead of "release_ids[-1]" (Dongwon Shin) 0.1.9 (2015-05-01) --------------------- * Output tuning (Harri Berglund) * Use str.partition() to simplify the logic (cclaus) 0.1.8 (2015-04-26) --------------------- * Fixed problems with local imports (Dongwon Shin) * Fixed problems with imports with 'as' (Dongwon Shin) * Fix indentation, pep8 Styling. (Michael Borisov) * Optimize imports and adding missing import for sys module. (Michael Borisov) 0.1.7 (2015-04-24) --------------------- * Add more assertions in tests * Add more verbose output * Add recursive delete to Makefile clean * Update Readme 0.1.6 (2015-04-22) --------------------- * py3 print function 0.1.5 (2015-04-22) --------------------- * Add Readme, Add Examples * Add Stdlib into package 0.1.1 (2015-04-22) --------------------- * Fix regex matching for imports * Release on Pypi 0.1.0 (2015-04-22) --------------------- * First release on Github. ================================================ FILE: LICENSE ================================================ Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "{}" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright {yyyy} {name of copyright owner} Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ================================================ FILE: Makefile ================================================ .PHONY: clean-pyc clean-build docs clean help: @echo "clean - remove all build, test, coverage and Python artifacts" @echo "clean-build - remove build artifacts" @echo "clean-pyc - remove Python file artifacts" @echo "clean-test - remove test and coverage artifacts" @echo "lint - check style with flake8" @echo "test - run tests quickly using the default Python" @echo "test-all - run tests on every Python version with tox" @echo "coverage - check code coverage quickly with the default Python" @echo "docs - generate Sphinx HTML documentation, including API docs" @echo "publish - package and upload a release" @echo "publish-to-test - package and upload a release to test-pypi" @echo "build - build the package" @echo "install - install the dependencies into the Poetry virtual environment" clean: clean-build clean-pyc clean-test clean-build: rm -fr build/ rm -fr dist/ rm -fr .eggs/ find . -name '*.egg-info' -exec rm -fr {} + find . -name '*.egg' -exec rm -rf {} + clean-pyc: find . -name '*.pyc' -exec rm -f {} + find . -name '*.pyo' -exec rm -f {} + find . -name '*~' -exec rm -f {} + find . -name '__pycache__' -exec rm -fr {} + clean-test: rm -fr .tox/ rm -f .coverage rm -fr htmlcov/ lint: poetry run flake8 pipreqs tests test: poetry run python -m unittest discover test-all: poetry run tox coverage: coverage run --source pipreqs setup.py test coverage report -m coverage html open htmlcov/index.html docs: rm -f docs/pipreqs.rst rm -f docs/modules.rst sphinx-apidoc -o docs/ pipreqs $(MAKE) -C docs clean $(MAKE) -C docs html open docs/_build/html/index.html publish: build poetry publish publish-to-test: build poetry publish --repository test-pypi build: clean poetry build install: clean poetry install --with dev ================================================ FILE: README.rst ================================================ ============================================================================= ``pipreqs`` - Generate requirements.txt file for any project based on imports ============================================================================= .. image:: https://github.com/bndr/pipreqs/actions/workflows/tests.yml/badge.svg :target: https://github.com/bndr/pipreqs/actions/workflows/tests.yml .. image:: https://img.shields.io/pypi/v/pipreqs.svg :target: https://pypi.python.org/pypi/pipreqs .. image:: https://codecov.io/gh/bndr/pipreqs/branch/master/graph/badge.svg?token=0rfPfUZEAX :target: https://codecov.io/gh/bndr/pipreqs .. image:: https://img.shields.io/pypi/l/pipreqs.svg :target: https://pypi.python.org/pypi/pipreqs Installation ------------ .. code-block:: sh pip install pipreqs Obs.: if you don't want support for jupyter notebooks, you can install pipreqs without the dependencies that give support to it. To do so, run: .. code-block:: sh pip install --no-deps pipreqs pip install yarg==0.1.9 docopt==0.6.2 Usage ----- :: Usage: pipreqs [options] [] Arguments: The path to the directory containing the application files for which a requirements file should be generated (defaults to the current working directory) Options: --use-local Use ONLY local package info instead of querying PyPI --pypi-server Use custom PyPi server --proxy Use Proxy, parameter will be passed to requests library. You can also just set the environments parameter in your terminal: $ export HTTP_PROXY="http://10.10.1.10:3128" $ export HTTPS_PROXY="https://10.10.1.10:1080" --debug Print debug information --ignore ... Ignore extra directories, each separated by a comma --no-follow-links Do not follow symbolic links in the project --ignore-errors Ignore errors while scanning files --encoding Use encoding parameter for file open --savepath Save the list of requirements in the given file --print Output the list of requirements in the standard output --force Overwrite existing requirements.txt --diff Compare modules in requirements.txt to project imports --clean Clean up requirements.txt by removing modules that are not imported in project --mode Enables dynamic versioning with , or schemes | e.g. Flask~=1.1.2 | e.g. Flask>=1.1.2 | e.g. Flask --scan-notebooks Look for imports in jupyter notebook files. Example ------- :: $ pipreqs /home/project/location Successfully saved requirements file in /home/project/location/requirements.txt Contents of requirements.txt :: wheel==0.23.0 Yarg==0.1.9 docopt==0.6.2 Why not pip freeze? ------------------- - ``pip freeze`` only saves the packages that are installed with ``pip install`` in your environment. - ``pip freeze`` saves all packages in the environment including those that you don't use in your current project (if you don't have ``virtualenv``). - and sometimes you just need to create ``requirements.txt`` for a new project without installing modules. ================================================ FILE: docs/Makefile ================================================ # Makefile for Sphinx documentation # # You can set these variables from the command line. SPHINXOPTS = SPHINXBUILD = sphinx-build PAPER = BUILDDIR = _build # User-friendly check for sphinx-build ifeq ($(shell which $(SPHINXBUILD) >/dev/null 2>&1; echo $$?), 1) $(error The '$(SPHINXBUILD)' command was not found. Make sure you have Sphinx installed, then set the SPHINXBUILD environment variable to point to the full path of the '$(SPHINXBUILD)' executable. Alternatively you can add the directory with the executable to your PATH. If you don't have Sphinx installed, grab it from http://sphinx-doc.org/) endif # Internal variables. PAPEROPT_a4 = -D latex_paper_size=a4 PAPEROPT_letter = -D latex_paper_size=letter ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . # the i18n builder cannot share the environment and doctrees with the others I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . .PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest gettext help: @echo "Please use \`make ' where is one of" @echo " html to make standalone HTML files" @echo " dirhtml to make HTML files named index.html in directories" @echo " singlehtml to make a single large HTML file" @echo " pickle to make pickle files" @echo " json to make JSON files" @echo " htmlhelp to make HTML files and a HTML help project" @echo " qthelp to make HTML files and a qthelp project" @echo " devhelp to make HTML files and a Devhelp project" @echo " epub to make an epub" @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter" @echo " latexpdf to make LaTeX files and run them through pdflatex" @echo " latexpdfja to make LaTeX files and run them through platex/dvipdfmx" @echo " text to make text files" @echo " man to make manual pages" @echo " texinfo to make Texinfo files" @echo " info to make Texinfo files and run them through makeinfo" @echo " gettext to make PO message catalogs" @echo " changes to make an overview of all changed/added/deprecated items" @echo " xml to make Docutils-native XML files" @echo " pseudoxml to make pseudoxml-XML files for display purposes" @echo " linkcheck to check all external links for integrity" @echo " doctest to run all doctests embedded in the documentation (if enabled)" clean: rm -rf $(BUILDDIR)/* html: $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html @echo @echo "Build finished. The HTML pages are in $(BUILDDIR)/html." dirhtml: $(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml @echo @echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml." singlehtml: $(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml @echo @echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml." pickle: $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle @echo @echo "Build finished; now you can process the pickle files." json: $(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json @echo @echo "Build finished; now you can process the JSON files." htmlhelp: $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp @echo @echo "Build finished; now you can run HTML Help Workshop with the" \ ".hhp project file in $(BUILDDIR)/htmlhelp." qthelp: $(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp @echo @echo "Build finished; now you can run "qcollectiongenerator" with the" \ ".qhcp project file in $(BUILDDIR)/qthelp, like this:" @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/pipreqs.qhcp" @echo "To view the help file:" @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/pipreqs.qhc" devhelp: $(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp @echo @echo "Build finished." @echo "To view the help file:" @echo "# mkdir -p $$HOME/.local/share/devhelp/pipreqs" @echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/pipreqs" @echo "# devhelp" epub: $(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub @echo @echo "Build finished. The epub file is in $(BUILDDIR)/epub." latex: $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex @echo @echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex." @echo "Run \`make' in that directory to run these through (pdf)latex" \ "(use \`make latexpdf' here to do that automatically)." latexpdf: $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex @echo "Running LaTeX files through pdflatex..." $(MAKE) -C $(BUILDDIR)/latex all-pdf @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex." latexpdfja: $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex @echo "Running LaTeX files through platex and dvipdfmx..." $(MAKE) -C $(BUILDDIR)/latex all-pdf-ja @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex." text: $(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text @echo @echo "Build finished. The text files are in $(BUILDDIR)/text." man: $(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man @echo @echo "Build finished. The manual pages are in $(BUILDDIR)/man." texinfo: $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo @echo @echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo." @echo "Run \`make' in that directory to run these through makeinfo" \ "(use \`make info' here to do that automatically)." info: $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo @echo "Running Texinfo files through makeinfo..." make -C $(BUILDDIR)/texinfo info @echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo." gettext: $(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale @echo @echo "Build finished. The message catalogs are in $(BUILDDIR)/locale." changes: $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes @echo @echo "The overview file is in $(BUILDDIR)/changes." linkcheck: $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck @echo @echo "Link check complete; look for any errors in the above output " \ "or in $(BUILDDIR)/linkcheck/output.txt." doctest: $(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest @echo "Testing of doctests in the sources finished, look at the " \ "results in $(BUILDDIR)/doctest/output.txt." xml: $(SPHINXBUILD) -b xml $(ALLSPHINXOPTS) $(BUILDDIR)/xml @echo @echo "Build finished. The XML files are in $(BUILDDIR)/xml." pseudoxml: $(SPHINXBUILD) -b pseudoxml $(ALLSPHINXOPTS) $(BUILDDIR)/pseudoxml @echo @echo "Build finished. The pseudo-XML files are in $(BUILDDIR)/pseudoxml." ================================================ FILE: docs/authors.rst ================================================ .. include:: ../AUTHORS.rst ================================================ FILE: docs/conf.py ================================================ #!/usr/bin/env python # -*- coding: utf-8 -*- # # pipreqs documentation build configuration file, created by # sphinx-quickstart on Tue Jul 9 22:26:36 2013. # # This file is execfile()d with the current directory set to its # containing dir. # # Note that not all possible configuration values are present in this # autogenerated file. # # All configuration values have a default; values that are commented out # serve to show the default. import sys import os # If extensions (or modules to document with autodoc) are in another # directory, add these directories to sys.path here. If the directory is # relative to the documentation root, use os.path.abspath to make it # absolute, like shown here. #sys.path.insert(0, os.path.abspath('.')) # Get the project root dir, which is the parent dir of this cwd = os.getcwd() project_root = os.path.dirname(cwd) # Insert the project root dir as the first element in the PYTHONPATH. # This lets us ensure that the source package is imported, and that its # version is used. sys.path.insert(0, project_root) import pipreqs # -- General configuration --------------------------------------------- # If your documentation needs a minimal Sphinx version, state it here. #needs_sphinx = '1.0' # Add any Sphinx extension module names here, as strings. They can be # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones. extensions = ['sphinx.ext.autodoc', 'sphinx.ext.viewcode'] # Add any paths that contain templates here, relative to this directory. templates_path = ['_templates'] # The suffix of source filenames. source_suffix = '.rst' # The encoding of source files. #source_encoding = 'utf-8-sig' # The master toctree document. master_doc = 'index' # General information about the project. project = u'pipreqs' copyright = u'2015, Vadim Kravcenko' # The version info for the project you're documenting, acts as replacement # for |version| and |release|, also used in various other places throughout # the built documents. # # The short X.Y version. version = pipreqs.__version__ # The full version, including alpha/beta/rc tags. release = pipreqs.__version__ # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. #language = None # There are two options for replacing |today|: either, you set today to # some non-false value, then it is used: #today = '' # Else, today_fmt is used as the format for a strftime call. #today_fmt = '%B %d, %Y' # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. exclude_patterns = ['_build'] # The reST default role (used for this markup: `text`) to use for all # documents. #default_role = None # If true, '()' will be appended to :func: etc. cross-reference text. #add_function_parentheses = True # If true, the current module name will be prepended to all description # unit titles (such as .. function::). #add_module_names = True # If true, sectionauthor and moduleauthor directives will be shown in the # output. They are ignored by default. #show_authors = False # The name of the Pygments (syntax highlighting) style to use. pygments_style = 'sphinx' # A list of ignored prefixes for module index sorting. #modindex_common_prefix = [] # If true, keep warnings as "system message" paragraphs in the built # documents. #keep_warnings = False # -- Options for HTML output ------------------------------------------- # The theme to use for HTML and HTML Help pages. See the documentation for # a list of builtin themes. html_theme = 'default' # Theme options are theme-specific and customize the look and feel of a # theme further. For a list of options available for each theme, see the # documentation. #html_theme_options = {} # Add any paths that contain custom themes here, relative to this directory. #html_theme_path = [] # The name for this set of Sphinx documents. If None, it defaults to # " v documentation". #html_title = None # A shorter title for the navigation bar. Default is the same as # html_title. #html_short_title = None # The name of an image file (relative to this directory) to place at the # top of the sidebar. #html_logo = None # The name of an image file (within the static path) to use as favicon # of the docs. This file should be a Windows icon file (.ico) being # 16x16 or 32x32 pixels large. #html_favicon = None # Add any paths that contain custom static files (such as style sheets) # here, relative to this directory. They are copied after the builtin # static files, so a file named "default.css" will overwrite the builtin # "default.css". html_static_path = ['_static'] # If not '', a 'Last updated on:' timestamp is inserted at every page # bottom, using the given strftime format. #html_last_updated_fmt = '%b %d, %Y' # If true, SmartyPants will be used to convert quotes and dashes to # typographically correct entities. #html_use_smartypants = True # Custom sidebar templates, maps document names to template names. #html_sidebars = {} # Additional templates that should be rendered to pages, maps page names # to template names. #html_additional_pages = {} # If false, no module index is generated. #html_domain_indices = True # If false, no index is generated. #html_use_index = True # If true, the index is split into individual pages for each letter. #html_split_index = False # If true, links to the reST sources are added to the pages. #html_show_sourcelink = True # If true, "Created using Sphinx" is shown in the HTML footer. # Default is True. #html_show_sphinx = True # If true, "(C) Copyright ..." is shown in the HTML footer. # Default is True. #html_show_copyright = True # If true, an OpenSearch description file will be output, and all pages # will contain a tag referring to it. The value of this option # must be the base URL from which the finished HTML is served. #html_use_opensearch = '' # This is the file name suffix for HTML files (e.g. ".xhtml"). #html_file_suffix = None # Output file base name for HTML help builder. htmlhelp_basename = 'pipreqsdoc' # -- Options for LaTeX output ------------------------------------------ latex_elements = { # The paper size ('letterpaper' or 'a4paper'). #'papersize': 'letterpaper', # The font size ('10pt', '11pt' or '12pt'). #'pointsize': '10pt', # Additional stuff for the LaTeX preamble. #'preamble': '', } # Grouping the document tree into LaTeX files. List of tuples # (source start file, target name, title, author, documentclass # [howto/manual]). latex_documents = [ ('index', 'pipreqs.tex', u'pipreqs Documentation', u'Vadim Kravcenko', 'manual'), ] # The name of an image file (relative to this directory) to place at # the top of the title page. #latex_logo = None # For "manual" documents, if this is true, then toplevel headings # are parts, not chapters. #latex_use_parts = False # If true, show page references after internal links. #latex_show_pagerefs = False # If true, show URL addresses after external links. #latex_show_urls = False # Documents to append as an appendix to all manuals. #latex_appendices = [] # If false, no module index is generated. #latex_domain_indices = True # -- Options for manual page output ------------------------------------ # One entry per manual page. List of tuples # (source start file, name, description, authors, manual section). man_pages = [ ('index', 'pipreqs', u'pipreqs Documentation', [u'Vadim Kravcenko'], 1) ] # If true, show URL addresses after external links. #man_show_urls = False # -- Options for Texinfo output ---------------------------------------- # Grouping the document tree into Texinfo files. List of tuples # (source start file, target name, title, author, # dir menu entry, description, category) texinfo_documents = [ ('index', 'pipreqs', u'pipreqs Documentation', u'Vadim Kravcenko', 'pipreqs', 'One line description of project.', 'Miscellaneous'), ] # Documents to append as an appendix to all manuals. #texinfo_appendices = [] # If false, no module index is generated. #texinfo_domain_indices = True # How to display URL addresses: 'footnote', 'no', or 'inline'. #texinfo_show_urls = 'footnote' # If true, do not generate a @detailmenu in the "Top" node's menu. #texinfo_no_detailmenu = False ================================================ FILE: docs/contributing.rst ================================================ .. include:: ../CONTRIBUTING.rst ================================================ FILE: docs/history.rst ================================================ .. include:: ../HISTORY.rst ================================================ FILE: docs/index.rst ================================================ .. pipreqs documentation master file, created by sphinx-quickstart on Tue Jul 9 22:26:36 2013. You can adapt this file completely to your liking, but it should at least contain the root `toctree` directive. Welcome to pipreqs's documentation! ====================================== Contents: .. toctree:: :maxdepth: 2 readme installation usage contributing authors history Indices and tables ================== * :ref:`genindex` * :ref:`modindex` * :ref:`search` ================================================ FILE: docs/installation.rst ================================================ ============ Installation ============ At the command line:: $ easy_install pipreqs Or, if you have virtualenvwrapper installed:: $ mkvirtualenv pipreqs $ pip install pipreqs ================================================ FILE: docs/make.bat ================================================ @ECHO OFF REM Command file for Sphinx documentation if "%SPHINXBUILD%" == "" ( set SPHINXBUILD=sphinx-build ) set BUILDDIR=_build set ALLSPHINXOPTS=-d %BUILDDIR%/doctrees %SPHINXOPTS% . set I18NSPHINXOPTS=%SPHINXOPTS% . if NOT "%PAPER%" == "" ( set ALLSPHINXOPTS=-D latex_paper_size=%PAPER% %ALLSPHINXOPTS% set I18NSPHINXOPTS=-D latex_paper_size=%PAPER% %I18NSPHINXOPTS% ) if "%1" == "" goto help if "%1" == "help" ( :help echo.Please use `make ^` where ^ is one of echo. html to make standalone HTML files echo. dirhtml to make HTML files named index.html in directories echo. singlehtml to make a single large HTML file echo. pickle to make pickle files echo. json to make JSON files echo. htmlhelp to make HTML files and a HTML help project echo. qthelp to make HTML files and a qthelp project echo. devhelp to make HTML files and a Devhelp project echo. epub to make an epub echo. latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter echo. text to make text files echo. man to make manual pages echo. texinfo to make Texinfo files echo. gettext to make PO message catalogs echo. changes to make an overview over all changed/added/deprecated items echo. xml to make Docutils-native XML files echo. pseudoxml to make pseudoxml-XML files for display purposes echo. linkcheck to check all external links for integrity echo. doctest to run all doctests embedded in the documentation if enabled goto end ) if "%1" == "clean" ( for /d %%i in (%BUILDDIR%\*) do rmdir /q /s %%i del /q /s %BUILDDIR%\* goto end ) %SPHINXBUILD% 2> nul if errorlevel 9009 ( echo. echo.The 'sphinx-build' command was not found. Make sure you have Sphinx echo.installed, then set the SPHINXBUILD environment variable to point echo.to the full path of the 'sphinx-build' executable. Alternatively you echo.may add the Sphinx directory to PATH. echo. echo.If you don't have Sphinx installed, grab it from echo.http://sphinx-doc.org/ exit /b 1 ) if "%1" == "html" ( %SPHINXBUILD% -b html %ALLSPHINXOPTS% %BUILDDIR%/html if errorlevel 1 exit /b 1 echo. echo.Build finished. The HTML pages are in %BUILDDIR%/html. goto end ) if "%1" == "dirhtml" ( %SPHINXBUILD% -b dirhtml %ALLSPHINXOPTS% %BUILDDIR%/dirhtml if errorlevel 1 exit /b 1 echo. echo.Build finished. The HTML pages are in %BUILDDIR%/dirhtml. goto end ) if "%1" == "singlehtml" ( %SPHINXBUILD% -b singlehtml %ALLSPHINXOPTS% %BUILDDIR%/singlehtml if errorlevel 1 exit /b 1 echo. echo.Build finished. The HTML pages are in %BUILDDIR%/singlehtml. goto end ) if "%1" == "pickle" ( %SPHINXBUILD% -b pickle %ALLSPHINXOPTS% %BUILDDIR%/pickle if errorlevel 1 exit /b 1 echo. echo.Build finished; now you can process the pickle files. goto end ) if "%1" == "json" ( %SPHINXBUILD% -b json %ALLSPHINXOPTS% %BUILDDIR%/json if errorlevel 1 exit /b 1 echo. echo.Build finished; now you can process the JSON files. goto end ) if "%1" == "htmlhelp" ( %SPHINXBUILD% -b htmlhelp %ALLSPHINXOPTS% %BUILDDIR%/htmlhelp if errorlevel 1 exit /b 1 echo. echo.Build finished; now you can run HTML Help Workshop with the ^ .hhp project file in %BUILDDIR%/htmlhelp. goto end ) if "%1" == "qthelp" ( %SPHINXBUILD% -b qthelp %ALLSPHINXOPTS% %BUILDDIR%/qthelp if errorlevel 1 exit /b 1 echo. echo.Build finished; now you can run "qcollectiongenerator" with the ^ .qhcp project file in %BUILDDIR%/qthelp, like this: echo.^> qcollectiongenerator %BUILDDIR%\qthelp\pipreqs.qhcp echo.To view the help file: echo.^> assistant -collectionFile %BUILDDIR%\qthelp\pipreqs.ghc goto end ) if "%1" == "devhelp" ( %SPHINXBUILD% -b devhelp %ALLSPHINXOPTS% %BUILDDIR%/devhelp if errorlevel 1 exit /b 1 echo. echo.Build finished. goto end ) if "%1" == "epub" ( %SPHINXBUILD% -b epub %ALLSPHINXOPTS% %BUILDDIR%/epub if errorlevel 1 exit /b 1 echo. echo.Build finished. The epub file is in %BUILDDIR%/epub. goto end ) if "%1" == "latex" ( %SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex if errorlevel 1 exit /b 1 echo. echo.Build finished; the LaTeX files are in %BUILDDIR%/latex. goto end ) if "%1" == "latexpdf" ( %SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex cd %BUILDDIR%/latex make all-pdf cd %BUILDDIR%/.. echo. echo.Build finished; the PDF files are in %BUILDDIR%/latex. goto end ) if "%1" == "latexpdfja" ( %SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex cd %BUILDDIR%/latex make all-pdf-ja cd %BUILDDIR%/.. echo. echo.Build finished; the PDF files are in %BUILDDIR%/latex. goto end ) if "%1" == "text" ( %SPHINXBUILD% -b text %ALLSPHINXOPTS% %BUILDDIR%/text if errorlevel 1 exit /b 1 echo. echo.Build finished. The text files are in %BUILDDIR%/text. goto end ) if "%1" == "man" ( %SPHINXBUILD% -b man %ALLSPHINXOPTS% %BUILDDIR%/man if errorlevel 1 exit /b 1 echo. echo.Build finished. The manual pages are in %BUILDDIR%/man. goto end ) if "%1" == "texinfo" ( %SPHINXBUILD% -b texinfo %ALLSPHINXOPTS% %BUILDDIR%/texinfo if errorlevel 1 exit /b 1 echo. echo.Build finished. The Texinfo files are in %BUILDDIR%/texinfo. goto end ) if "%1" == "gettext" ( %SPHINXBUILD% -b gettext %I18NSPHINXOPTS% %BUILDDIR%/locale if errorlevel 1 exit /b 1 echo. echo.Build finished. The message catalogs are in %BUILDDIR%/locale. goto end ) if "%1" == "changes" ( %SPHINXBUILD% -b changes %ALLSPHINXOPTS% %BUILDDIR%/changes if errorlevel 1 exit /b 1 echo. echo.The overview file is in %BUILDDIR%/changes. goto end ) if "%1" == "linkcheck" ( %SPHINXBUILD% -b linkcheck %ALLSPHINXOPTS% %BUILDDIR%/linkcheck if errorlevel 1 exit /b 1 echo. echo.Link check complete; look for any errors in the above output ^ or in %BUILDDIR%/linkcheck/output.txt. goto end ) if "%1" == "doctest" ( %SPHINXBUILD% -b doctest %ALLSPHINXOPTS% %BUILDDIR%/doctest if errorlevel 1 exit /b 1 echo. echo.Testing of doctests in the sources finished, look at the ^ results in %BUILDDIR%/doctest/output.txt. goto end ) if "%1" == "xml" ( %SPHINXBUILD% -b xml %ALLSPHINXOPTS% %BUILDDIR%/xml if errorlevel 1 exit /b 1 echo. echo.Build finished. The XML files are in %BUILDDIR%/xml. goto end ) if "%1" == "pseudoxml" ( %SPHINXBUILD% -b pseudoxml %ALLSPHINXOPTS% %BUILDDIR%/pseudoxml if errorlevel 1 exit /b 1 echo. echo.Build finished. The pseudo-XML files are in %BUILDDIR%/pseudoxml. goto end ) :end ================================================ FILE: docs/readme.rst ================================================ .. include:: ../README.rst ================================================ FILE: docs/usage.rst ================================================ ======== Usage ======== To use pipreqs in a project:: import pipreqs ================================================ FILE: pipreqs/__init__.py ================================================ __author__ = 'Vadim Kravcenko' __email__ = 'vadim.kravcenko@gmail.com' __version__ = '0.4.13' ================================================ FILE: pipreqs/mapping ================================================ AFQ:pyAFQ AG_fft_tools:agpy ANSI:pexpect Adafruit:Adafruit_Libraries App:Zope2 Asterisk:py_Asterisk BB_jekyll_hook:bitbucket_jekyll_hook Banzai:Banzai_NGS BeautifulSoupTests:BeautifulSoup BioSQL:biopython BuildbotStatusShields:BuildbotEightStatusShields ComputedAttribute:ExtensionClass constraint:python-constraint Crypto:pycryptodome Cryptodome:pycryptodomex FSM:pexpect FiftyOneDegrees:51degrees_mobile_detector_v3_wrapper functional:pyfunctional GeoBaseMain:GeoBasesDev GeoBases:GeoBasesDev Globals:Zope2 HelpSys:Zope2 IPython:ipython Kittens:astro_kittens Levenshtein:python_Levenshtein Lifetime:Zope2 MethodObject:ExtensionClass MySQLdb:MySQL-python OFS:Zope2 OpenGL:PyOpenGL OpenSSL:pyOpenSSL PIL:Pillow Products:Zope2 PyWCSTools:astLib Pyxides:astro_pyxis QtCore:PySide S3:s3cmd SCons:pystick speech_recognition:SpeechRecognition Shared:Zope2 Signals:Zope2 Stemmer:PyStemmer Testing:Zope2 TopZooTools:topzootools TreeDisplay:DocumentTemplate WorkingWithDocumentConversion:aspose_pdf_java_for_python ZPublisher:Zope2 ZServer:Zope2 ZTUtils:Zope2 aadb:auto_adjust_display_brightness abakaffe:abakaffe_cli abiosgaming:abiosgaming.py abiquo:abiquo_api abl:abl.cssprocessor abl:abl.robot abl:abl.util abl:abl.vpath abo:abo_generator abris_transform:abris abstract:abstract.jwrotator abu:abu.admin ac_flask:AC_Flask_HipChat acg:anikom15 acme:acme.dchat acme:acme.hello acted:acted.projects action:ActionServer actionbar:actionbar.panel activehomed:afn activepapers:ActivePapers.Py address_book:address_book_lansry adi:adi.commons adi:adi.devgen adi:adi.fullscreen adi:adi.init adi:adi.playlist adi:adi.samplecontent adi:adi.slickstyle adi:adi.suite adi:adi.trash adict:aDict2 aditam:aditam.agent aditam:aditam.core adiumsh:adium_sh adjector:AdjectorClient adjector:AdjectorTracPlugin adkit:Banner_Ad_Toolkit admin_tools:django_admin_tools adminishcategories:adminish_categories adminsortable:django_admin_sortable adspygoogle:adspygoogle.adwords advancedcaching:agtl adytum:Adytum_PyMonitor affinitic:affinitic.docpyflakes affinitic:affinitic.recipe.fakezope2eggs affinitic:affinitic.simplecookiecuttr affinitic:affinitic.verifyinterface affinitic:affinitic.zamqp afpy:afpy.xap agatesql:agate_sql ageliaco:ageliaco.recipe.csvconfig agent_http:agent.http agora:Agora_Client agora:Agora_Fountain agora:Agora_Fragment agora:Agora_Planner agora:Agora_Service_Provider agoraplex:agoraplex.themes.sphinx agsci:agsci.blognewsletter agx:agx.core agx:agx.dev agx:agx.generator.buildout agx:agx.generator.dexterity agx:agx.generator.generator agx:agx.generator.plone agx:agx.generator.pyegg agx:agx.generator.sql agx:agx.generator.uml agx:agx.generator.zca agx:agx.transform.uml2fs agx:agx.transform.xmi2uml aimes:aimes.bundle aimes:aimes.skeleton aio:aio.app aio:aio.config aio:aio.core aio:aio.signals aiohs2:aio_hs2 aioroutes:aio_routes aios3:aio_s3 airbrake:airbrake_flask airship:airship_icloud airship:airship_steamcloud airflow:apache-airflow akamai:edgegrid_python alation:alation_api alba_client:alba_client_python alburnum:alburnum_maas_client alchemist:alchemist.audit alchemist:alchemist.security alchemist:alchemist.traversal alchemist:alchemist.ui alchemyapi:alchemyapi_python alerta:alerta_server alexandria_upload:Alexandria_Upload_Utils alibaba:alibaba_python_sdk aliyun:aliyun_python_sdk aliyuncli:alicloudcli aliyunsdkacs:aliyun_python_sdk_acs aliyunsdkbatchcompute:aliyun_python_sdk_batchcompute aliyunsdkbsn:aliyun_python_sdk_bsn aliyunsdkbss:aliyun_python_sdk_bss aliyunsdkcdn:aliyun_python_sdk_cdn aliyunsdkcms:aliyun_python_sdk_cms aliyunsdkcore:aliyun_python_sdk_core aliyunsdkcrm:aliyun_python_sdk_crm aliyunsdkcs:aliyun_python_sdk_cs aliyunsdkdrds:aliyun_python_sdk_drds aliyunsdkecs:aliyun_python_sdk_ecs aliyunsdkess:aliyun_python_sdk_ess aliyunsdkft:aliyun_python_sdk_ft aliyunsdkmts:aliyun_python_sdk_mts aliyunsdkocs:aliyun_python_sdk_ocs aliyunsdkoms:aliyun_python_sdk_oms aliyunsdkossadmin:aliyun_python_sdk_ossadmin aliyunsdkr-kvstore:aliyun_python_sdk_r_kvstore aliyunsdkram:aliyun_python_sdk_ram aliyunsdkrds:aliyun_python_sdk_rds aliyunsdkrisk:aliyun_python_sdk_risk aliyunsdkros:aliyun_python_sdk_ros aliyunsdkslb:aliyun_python_sdk_slb aliyunsdksts:aliyun_python_sdk_sts aliyunsdkubsms:aliyun_python_sdk_ubsms aliyunsdkyundun:aliyun_python_sdk_yundun allattachments:AllAttachmentsMacro allocine:allocine_wrapper allowedsites:django_allowedsites alm:alm.solrindex aloft:aloft.py alpacalib:alpaca alphabetic:alphabetic_simple alphasms:alphasms_client altered:altered.states alterootheme:alterootheme.busycity alterootheme:alterootheme.intensesimplicity alterootheme:alterootheme.lazydays alurinium:alurinium_image_processing alxlib:alx amara3:amara3_iri amara3:amara3_xml amazon:AmazonAPIWrapper amazon:python_amazon_simple_product_api ambikesh1349-1:ambikesh1349_1 ambilight:AmbilightParty amifs:amifs_core amiorganizer:ami_organizer amitu:amitu.lipy amitu:amitu_putils amitu:amitu_websocket_client amitu:amitu_zutils amltlearn:AMLT_learn amocrm:amocrm_api amqpdispatcher:amqp_dispatcher amqpstorm:AMQP_Storm analytics:analytics_python analyzedir:AnalyzeDirectory ancientsolutions:ancientsolutions_crypttools anderson_paginator:anderson.paginator android_clean_app:android_resource_remover anel_power_control:AnelPowerControl angus:angus_sdk_python annalist_root:Annalist annogesiclib:ANNOgesic ansible-role-apply:ansible_role_apply ansibledebugger:ansible_playbook_debugger ansibledocgen:ansible_docgen ansibleflow:ansible_flow ansibleinventorygrapher:ansible_inventory_grapher ansiblelint:ansible_lint ansiblerolesgraph:ansible_roles_graph ansibletools:ansible_tools anthill:anthill.exampletheme anthill:anthill.skinner anthill:anthill.tal.macrorenderer anthrax:AnthraxDojoFrontend anthrax:AnthraxHTMLInput anthrax:AnthraxImage antisphinx:antiweb antispoofing:antispoofing.evaluation antlr4:antlr4_python2_runtime antlr4:antlr4_python3_runtime antlr4:antlr4_python_alt anybox:anybox.buildbot.openerp anybox:anybox.nose.odoo anybox:anybox.paster.odoo anybox:anybox.paster.openerp anybox:anybox.recipe.sysdeps anybox:anybox.scripts.odoo apiclient:google_api_python_client apitools:google_apitools apm:arpm app_data:django_appdata appconf:django_appconf appd:AppDynamicsDownloader appd:AppDynamicsREST appdynamics_bindeps:appdynamics_bindeps_linux_x64 appdynamics_bindeps:appdynamics_bindeps_linux_x86 appdynamics_bindeps:appdynamics_bindeps_osx_x64 appdynamics_proxysupport:appdynamics_proxysupport_linux_x64 appdynamics_proxysupport:appdynamics_proxysupport_linux_x86 appdynamics_proxysupport:appdynamics_proxysupport_osx_x64 appium:Appium_Python_Client appliapps:applibase appserver:broadwick archetypes:archetypes.kss archetypes:archetypes.multilingual archetypes:archetypes.schemaextender arm:ansible_role_manager armor:armor_api armstrong:armstrong.apps.related_content armstrong:armstrong.apps.series armstrong:armstrong.cli armstrong:armstrong.core.arm_access armstrong:armstrong.core.arm_layout armstrong:armstrong.core.arm_sections armstrong:armstrong.core.arm_wells armstrong:armstrong.dev armstrong:armstrong.esi armstrong:armstrong.hatband armstrong:armstrong.templates.standard armstrong:armstrong.utils.backends armstrong:armstrong.utils.celery arstecnica:arstecnica.raccoon.autobahn arstecnica:arstecnica.sqlalchemy.async article-downloader:article_downloader artifactcli:artifact_cli arvados:arvados_python_client arvados_cwl:arvados_cwl_runner arvnodeman:arvados_node_manager asana_to_github:AsanaToGithub asciibinary:AsciiBinaryConverter asd:AdvancedSearchDiscovery askbot:askbot_tuan askbot:askbot_tuanpa asnhistory:asnhistory_redis aspen_jinja2_renderer:aspen_jinja2 aspen_tornado_engine:aspen_tornado asprise_ocr_api:asprise_ocr_sdk_python_api aspy:aspy.refactor_imports aspy:aspy.yaml asterisk:asterisk_ami asts:add_asts asymmetricbase:asymmetricbase.enum asymmetricbase:asymmetricbase.fields asymmetricbase:asymmetricbase.logging asymmetricbase:asymmetricbase.utils asyncirc:asyncio_irc asyncmongoorm:asyncmongoorm_je asyncssh:asyncssh_unofficial athletelist:athletelistyy atm:automium atmosphere:atmosphere_python_client atom:gdata atomic:AtomicWrite atomisator:atomisator.db atomisator:atomisator.enhancers atomisator:atomisator.feed atomisator:atomisator.indexer atomisator:atomisator.outputs atomisator:atomisator.parser atomisator:atomisator.readers atreal:atreal.cmfeditions.unlocker atreal:atreal.filestorage.common atreal:atreal.layouts atreal:atreal.mailservices atreal:atreal.massloader atreal:atreal.monkeyplone atreal:atreal.override.albumview atreal:atreal.richfile.preview atreal:atreal.richfile.qualifier atreal:atreal.usersinout atsim:atsim.potentials attractsdk:attract_sdk audio:audio.bitstream audio:audio.coders audio:audio.filters audio:audio.fourier audio:audio.frames audio:audio.lp audio:audio.psychoacoustics audio:audio.quantizers audio:audio.shrink audio:audio.wave aufrefer:auf_refer auslfe:auslfe.formonline.content auspost:auspost_apis auth0:auth0_python auth_server_client:AuthServerClient authorize:AuthorizeSauce authzpolicy:AuthzPolicyPlugin autobahn:autobahn_rce avatar:geonode_avatar awebview:android_webview azure:azure_common azure:azure_mgmt_common azure:azure_mgmt_compute azure:azure_mgmt_network azure:azure_mgmt_nspkg azure:azure_mgmt_resource azure:azure_mgmt_storage azure:azure_nspkg azure:azure_servicebus azure:azure_servicemanagement_legacy azure:azure_storage b2gcommands:b2g_commands b2gperf:b2gperf_v1.3 b2gperf:b2gperf_v1.4 b2gperf:b2gperf_v2.0 b2gperf:b2gperf_v2.1 b2gperf:b2gperf_v2.2 b2gpopulate:b2gpopulate_v1.3 b2gpopulate:b2gpopulate_v1.4 b2gpopulate:b2gpopulate_v2.0 b2gpopulate:b2gpopulate_v2.1 b2gpopulate:b2gpopulate_v2.2 b3j0f:b3j0f.annotation b3j0f:b3j0f.aop b3j0f:b3j0f.conf b3j0f:b3j0f.sync b3j0f:b3j0f.utils babel:Babel babelglade:BabelGladeExtractor backplane:backplane2_pyclient backport_abcoll:backport_collections backports:backports.functools_lru_cache backports:backports.inspect backports:backports.pbkdf2 backports:backports.shutil_get_terminal_size backports:backports.socketpair backports:backports.ssl backports:backports.ssl_match_hostname backports:backports.statistics badgekit:badgekit_api_client badlinks:BadLinksPlugin bael:bael.project baidu:baidupy balrog:buildtools baluhn:baluhn_redux bamboo:bamboo.pantrybell bamboo:bamboo.scaffold bamboo:bamboo.setuptools_version bamboo:bamboo_data bamboo:bamboo_server bambu:bambu_codemirror bambu:bambu_dataportability bambu:bambu_enqueue bambu:bambu_faq bambu:bambu_ffmpeg bambu:bambu_grids bambu:bambu_international bambu:bambu_jwplayer bambu:bambu_minidetect bambu:bambu_navigation bambu:bambu_notifications bambu:bambu_payments bambu:bambu_pusher bambu:bambu_saas bambu:bambu_sites banana:Bananas banana:banana.maya bang:bangtext barcode:barcode_generator bark:bark_ssg barking_owl:BarkingOwl bart:bart_py basalt:basalt_tasks base62:base_62 basemap:basemap_Jim bash:bash_toolbelt bashutils:Python_Bash_Utils basic_http:BasicHttp basil:basil_daq batchapps:azure_batch_apps bcrypt:python_bcrypt beaker:Beaker beetsplug:beets begin:begins benchit:bench_it beproud:beproud.utils bfillings:burrito_fillings bigjob:BigJob billboard:billboard.py binstar_build_client:anaconda_build binstar_client:anaconda_client biocommons:biocommons.dev birdhousebuilder:birdhousebuilder.recipe.conda birdhousebuilder:birdhousebuilder.recipe.docker birdhousebuilder:birdhousebuilder.recipe.redis birdhousebuilder:birdhousebuilder.recipe.supervisor blender26-meshio:pymeshio bootstrap:BigJob borg:borg.localrole bow:bagofwords bpdb:bpython bqapi:bisque_api braces:django_braces briefscaster:briefs_caster brisa_media_server/plugins:brisa_media_server_plugins brkt_requests:brkt_sdk broadcastlogging:broadcast_logging brocadetool:brocade_tool bronto:bronto_python brownie:Brownie browsermobproxy:browsermob_proxy brubeckmysql:brubeck_mysql brubeckoauth:brubeck_oauth brubeckservice:brubeck_service brubeckuploader:brubeck_uploader bs4:beautifulsoup4 bson:pymongo bst:bst.pygasus.core bst:bst.pygasus.datamanager bst:bst.pygasus.demo bst:bst.pygasus.i18n bst:bst.pygasus.resources bst:bst.pygasus.scaffolding bst:bst.pygasus.security bst:bst.pygasus.session bst:bst.pygasus.wsgi btable:btable_py btapi:bananatag_api btceapi:btce_api btcebot:btce_bot btsync:btsync.py buck:buck.pprint bud:bud.nospam budy:budy_api buffer:buffer_alpaca buggd:bug.gd bugle:bugle_sites bugspots:bug_spots bugzilla:python_bugzilla bugzscout:bugzscout_py buildTools:ajk_ios_buildTools buildnotifylib:BuildNotify buildout:buildout.bootstrap buildout:buildout.disablessl buildout:buildout.dumppickedversions buildout:buildout.dumppickedversions2 buildout:buildout.dumprequirements buildout:buildout.eggnest buildout:buildout.eggscleaner buildout:buildout.eggsdirectories buildout:buildout.eggtractor buildout:buildout.extensionscripts buildout:buildout.locallib buildout:buildout.packagename buildout:buildout.recipe.isolation buildout:buildout.removeaddledeggs buildout:buildout.requirements buildout:buildout.sanitycheck buildout:buildout.sendpickedversions buildout:buildout.threatlevel buildout:buildout.umask buildout:buildout.variables buildslave:buildbot_slave builtins:pies2overrides bumper:bumper_lib bumple:bumple_downloader bundesliga:bundesliga_cli bundlemaker:bundlemanager burpui:burp_ui busyflow:busyflow.pivotal buttercms-django:buttercms_django buzz:buzz_python_client bvc:buildout_versions_checker bvggrabber:bvg_grabber byond:BYONDTools bzETL:Bugzilla_ETL bzlib:bugzillatools bzrlib:bzr bzrlib:bzr_automirror bzrlib:bzr_bash_completion bzrlib:bzr_colo bzrlib:bzr_killtrailing bzrlib:bzr_pqm c2c:c2c.cssmin c2c:c2c.recipe.closurecompile c2c:c2c.recipe.cssmin c2c:c2c.recipe.jarfile c2c:c2c.recipe.msgfmt c2c:c2c.recipe.pkgversions c2c:c2c.sqlalchemy.rest c2c:c2c.versions c2c_recipe_facts:c2c.recipe.facts cabalgata:cabalgata_silla_de_montar cabalgata:cabalgata_zookeeper cache_utils:django_cache_utils captcha:django_recaptcha cartridge:Cartridge cassandra:cassandra_driver cassandralauncher:CassandraLauncher cc42:42qucc cerberus:Cerberus cfnlint:cfn-lint chameleon:Chameleon charmtools:charm_tools chef:PyChef chip8:c8d cjson:python_cjson classytags:django_classy_tags cloghandler:ConcurrentLogHandler clonevirtualenv:virtualenv_clone cloud-insight:al_cloudinsight cloud_admin:adminapi cloudservers:python_cloudservers clusterconsole:cerebrod clustersitter:cerebrod cms:django_cms colander:ba_colander colors:ansicolors compile:bf_lc3 compose:docker_compose compressor:django_compressor concurrent:futures configargparse:ConfigArgParse configparser:pies2overrides contracts:PyContracts coordination:BigJob copyreg:pies2overrides corebio:weblogo couchapp:Couchapp couchdb:CouchDB couchdbcurl:couchdb_python_curl courseradownloader:coursera_dl cow:cow_framework creole:python_creole creoleparser:Creoleparser crispy_forms:django_crispy_forms cronlog:python_crontab crontab:python_crontab ctff:tff cups:pycups curator:elasticsearch_curator curl:pycurl cv2:opencv-python daemon:python_daemon dare:DARE dateutil:python_dateutil dawg:DAWG deb822:python_debian debian:python_debian decouple:python-decouple demo:webunit demosongs:PySynth deployer:juju_deployer depot:filedepot devtools:tg.devtools dgis:2gis dhtmlparser:pyDHTMLParser digitalocean:python_digitalocean discord:discord.py distribute_setup:ez_setup distutils2:Distutils2 django:Django django_hstore:amitu_hstore djangobower:django_bower djcelery:django_celery djkombu:django_kombu djorm_pgarray:djorm_ext_pgarray dns:dnspython docgen:ansible_docgenerator docker:docker_py dogpile:dogpile.cache dogpile:dogpile.core dogshell:dogapi dot_parser:pydot dot_parser:pydot2 dot_parser:pydot3k dotenv:python-dotenv dpkt:dpkt_fix dsml:python_ldap durationfield:django_durationfield dzclient:datazilla easybuild:easybuild_framework editor:python_editor elasticluster:azure_elasticluster elasticluster:azure_elasticluster_current elftools:pyelftools elixir:Elixir em:empy emlib:empy enchant:pyenchant encutils:cssutils engineio:python_engineio enum:enum34 ephem:pyephem errorreporter:abl.errorreporter esplot:beaker_es_plot example:adrest examples:tweepy ez_setup:pycassa fabfile:Fabric fabric:Fabric faker:Faker fdpexpect:pexpect fedora:python_fedora fias:ailove_django_fias fiftyone_degrees:51degrees_mobile_detector five:five.customerize five:five.globalrequest five:five.intid five:five.localsitemanager five:five.pt flasher:android_flasher flask:Flask flask_frozen:Frozen_Flask flask_redis:Flask_And_Redis flaskext:Flask_Bcrypt flvscreen:vnc2flv followit:django_followit forge:pyforge formencode:FormEncode formtools:django_formtools fourch:4ch franz:allegrordf freetype:freetype_py frontmatter:python_frontmatter ftpcloudfs:ftp_cloudfs funtests:librabbitmq fuse:fusepy fuzzy:Fuzzy gabbi:tiddlyweb gen_3dwallet:3d_wallet_generator gendimen:android_gendimen genshi:Genshi geohash:python_geohash geonode:GeoNode geoserver:gsconfig geraldo:Geraldo getenv:django_getenv geventwebsocket:gevent_websocket gflags:python_gflags git:GitPython github:PyGithub github3:github3.py gitpy:git_py globusonline:globusonline_transfer_api_client google:protobuf googleapiclient:google_api_python_client grace-dizmo:grace_dizmo grammar:anovelmous_grammar grapheneapi:graphenelib greplin:scales gridfs:pymongo grokcore:grokcore.component gslib:gsutil hamcrest:PyHamcrest harpy:HARPy hawk:PyHawk_with_a_single_extra_commit haystack:django_haystack hgext:mercurial hggit:hg_git hglib:python_hglib ho:pisa hola:amarokHola hoover:Hoover hostlist:python_hostlist html:pies2overrides htmloutput:nosehtmloutput http:pies2overrides hvad:django_hvad hydra:hydra-core i99fix:199Fix igraph:python_igraph imdb:IMDbPY impala:impyla inmemorystorage:ambition_inmemorystorage ipaddress:backport_ipaddress jaraco:jaraco.timing jaraco:jaraco.util jinja2:Jinja2 jiracli:jira_cli johnny:johnny_cache jose:python_jose jpgrid:python_geohash jpiarea:python_geohash jpype:JPype1 jpypex:JPype1 jsonfield:django_jsonfield jstools:aino_jstools jupyterpip:jupyter_pip jwt:PyJWT kazoo:asana_kazoo kernprof:line_profiler keyczar:python_keyczar keyedcache:django_keyedcache keystoneclient:python_keystoneclient kickstarter:kickstart krbv:krbV kss:kss.core kuyruk:Kuyruk langconv:AdvancedLangConv lava:lava_utils_interface lazr:lazr.authentication lazr:lazr.restfulclient lazr:lazr.uri ldap:python_ldap ldaplib:adpasswd ldapurl:python_ldap ldif:python_ldap lib2or3:2or3 lib3to2:3to2 libaito:Aito libbe:bugs_everywhere libbucket:bucket libcloud:apache_libcloud libfuturize:future libgenerateDS:generateDS libmproxy:mitmproxy libpasteurize:future libsvm:7lk_ocr_deploy lisa:lisa_server loadingandsaving:aspose_words_java_for_python locust:locustio logbook:Logbook logentries:buildbot_status_logentries logilab:logilab_mtconverter machineconsole:cerebrod machinesitter:cerebrod magic:python_magic mako:Mako manifestparser:ManifestDestiny marionette:marionette_client markdown:Markdown marks:pytest_marks markupsafe:MarkupSafe mavnative:pymavlink memcache:python_memcached mesonpy:meson-python metacomm:AllPairs metaphone:Metafone metlog:metlog_py mezzanine:Mezzanine migrate:sqlalchemy_migrate mimeparse:python_mimeparse minitage:minitage.paste minitage:minitage.recipe.common missingdrawables:android_missingdrawables mixfiles:PySynth mkfreq:PySynth mkrst_themes:2lazy2rest mockredis:mockredispy modargs:python_modargs model_utils:django_model_utils models:asposebarcode models:asposestorage moksha:moksha.common moksha:moksha.hub moksha:moksha.wsgi moneyed:py_moneyed mongoalchemy:MongoAlchemy monthdelta:MonthDelta mopidy:Mopidy mopytools:MoPyTools mptt:django_mptt mpv:python-mpv mrbob:mr.bob msgpack:msgpack_python mutations:aino_mutations mws:amazon_mws mysql:mysql_connector_repackaged native_tags:django_native_tags ndg:ndg_httpsclient nereid:trytond_nereid nested:baojinhuan nester:Amauri nester:abofly nester:bssm_pythonSig novaclient:python_novaclient oauth2_provider:alauda_django_oauth oauth2client:oauth2client odf:odfpy ometa:Parsley openid:python_openid opensearchsdk:ali_opensearch oslo_i18n:oslo.i18n oslo_serialization:oslo.serialization oslo_utils:oslo.utils oss:alioss oss:aliyun_python_sdk_oss oss:aliyunoss output:cashew owslib:OWSLib packetdiag:nwdiag paho:paho_mqtt paintstore:django_paintstore parler:django_parler past:future paste:PasteScript path:forked_path path:path.py patricia:patricia-trie paver:Paver peak:ProxyTypes picasso:anderson.picasso picklefield:django-picklefield pilot:BigJob pivotal:pivotal_py play_wav:PySynth playhouse:peewee plivoxml:plivo plone:plone.alterego plone:plone.api plone:plone.app.blob plone:plone.app.collection plone:plone.app.content plone:plone.app.contentlisting plone:plone.app.contentmenu plone:plone.app.contentrules plone:plone.app.contenttypes plone:plone.app.controlpanel plone:plone.app.customerize plone:plone.app.dexterity plone:plone.app.discussion plone:plone.app.event plone:plone.app.folder plone:plone.app.i18n plone:plone.app.imaging plone:plone.app.intid plone:plone.app.layout plone:plone.app.linkintegrity plone:plone.app.locales plone:plone.app.lockingbehavior plone:plone.app.multilingual plone:plone.app.portlets plone:plone.app.querystring plone:plone.app.redirector plone:plone.app.registry plone:plone.app.relationfield plone:plone.app.textfield plone:plone.app.theming plone:plone.app.users plone:plone.app.uuid plone:plone.app.versioningbehavior plone:plone.app.viewletmanager plone:plone.app.vocabularies plone:plone.app.widgets plone:plone.app.workflow plone:plone.app.z3cform plone:plone.autoform plone:plone.batching plone:plone.behavior plone:plone.browserlayer plone:plone.caching plone:plone.contentrules plone:plone.dexterity plone:plone.event plone:plone.folder plone:plone.formwidget.namedfile plone:plone.formwidget.recurrence plone:plone.i18n plone:plone.indexer plone:plone.intelligenttext plone:plone.keyring plone:plone.locking plone:plone.memoize plone:plone.namedfile plone:plone.outputfilters plone:plone.portlet.collection plone:plone.portlet.static plone:plone.portlets plone:plone.protect plone:plone.recipe.zope2install plone:plone.registry plone:plone.resource plone:plone.resourceeditor plone:plone.rfc822 plone:plone.scale plone:plone.schema plone:plone.schemaeditor plone:plone.session plone:plone.stringinterp plone:plone.subrequest plone:plone.supermodel plone:plone.synchronize plone:plone.theme plone:plone.transformchain plone:plone.uuid plone:plone.z3cform plonetheme:plonetheme.barceloneta png:pypng polymorphic:django_polymorphic postmark:python_postmark powerprompt:bash_powerprompt prefetch:django-prefetch printList:AndrewList progressbar:progressbar2 progressbar:progressbar33 provider:django_oauth2_provider puresasl:pure_sasl pwiz:peewee pxssh:pexpect py7zlib:pylzma pyAMI:pyAMI_core pyarsespyder:arsespyder pyasdf:asdf pyaspell:aspell_python_ctypes pybb:pybbm pybloomfilter:pybloomfiltermmap pyccuracy:Pyccuracy pyck:PyCK pycrfsuite:python_crfsuite pydispatch:PyDispatcher pygeolib:pygeocoder pygments:Pygments pygraph:python_graph_core pyjon:pyjon.utils pyjsonrpc:python_jsonrpc pykka:Pykka pylogo:PyLogo pylons:adhocracy_Pylons pymagic:libmagic pymycraawler:Amalwebcrawler pynma:AbakaffeNotifier pyphen:Pyphen pyrimaa:AEI pysideuic:PySide pysqlite2:adhocracy_pysqlite pysqlite2:pysqlite pysynth_b:PySynth pysynth_beeper:PySynth pysynth_c:PySynth pysynth_d:PySynth pysynth_e:PySynth pysynth_p:PySynth pysynth_s:PySynth pysynth_samp:PySynth pythongettext:python_gettext pythonjsonlogger:python_json_logger pyutilib:PyUtilib pywintypes:pywin32 pyximport:Cython qs:qserve quadtree:python_geohash queue:future quickapi:django_quickapi quickunit:nose_quickunit rackdiag:nwdiag radical:radical.pilot radical:radical.utils reStructuredText:Zope2 readability:readability_lxml readline:gnureadline recaptcha_works:django_recaptcha_works relstorage:RelStorage reportapi:django_reportapi reprlib:pies2overrides requests:Requests requirements:requirements_parser rest_framework:djangorestframework restclient:py_restclient retrial:async_retrial reversion:django_reversion rhaptos2:rhaptos2.common robot:robotframework robots:django_robots rosdep2:rosdep rsbackends:RSFile ruamel:ruamel.base s2repoze:pysaml2 saga:saga_python saml2:pysaml2 samtranslator:aws-sam-translator sass:libsass sassc:libsass sasstests:libsass sassutils:libsass sayhi:alex_sayhi scalrtools:scalr scikits:scikits.talkbox scratch:scratchpy screen:pexpect scss:pyScss sdict:dict.sorted sdk_updater:android_sdk_updater sekizai:django_sekizai sendfile:pysendfile serial:pyserial setuputils:astor shapefile:pyshp shapely:Shapely sika:ahonya_sika singleton:pysingleton sittercommon:cerebrod skbio:scikit_bio sklearn:scikit_learn slack:slackclient slugify:unicode_slugify slugify:python-slugify smarkets:smk_python_sdk snappy:ctypes_snappy socketio:python-socketio socketserver:pies2overrides sockjs:sockjs_tornado socks:SocksiPy_branch solr:solrpy solution:Solution sorl:sorl_thumbnail south:South sphinx:Sphinx sphinx_pypi_upload:ATD_document sphinxcontrib:sphinxcontrib_programoutput sqlalchemy:SQLAlchemy src:atlas src:auto_mix_prep stats_toolkit:bw_stats_toolkit statsd:dogstatsd_python stdnum:python_stdnum stoneagehtml:StoneageHTML storages:django_storages stubout:mox suds:suds_jurko swiftclient:python_swiftclient sx:pisa tabix:pytabix taggit:django_taggit tasksitter:cerebrod tastypie:django_tastypie teamcity:teamcity_messages telebot:pyTelegramBotAPI telegram:python-telegram-bot tempita:Tempita tenjin:Tenjin termstyle:python_termstyle test:pytabix thclient:treeherder_client threaded_multihost:django_threaded_multihost threecolor:3color_Press tidylib:pytidylib tkinter:future tlw:3lwg toredis:toredis_fork tornadoredis:tornado_redis tower_cli:ansible_tower_cli trac:Trac tracopt:Trac translation_helper:android_localization_helper treebeard:django_treebeard trytond:trytond_stock tsuru:tsuru_circus tvrage:python_tvrage tw2:tw2.core tw2:tw2.d3 tw2:tw2.dynforms tw2:tw2.excanvas tw2:tw2.forms tw2:tw2.jit tw2:tw2.jqplugins.flot tw2:tw2.jqplugins.gritter tw2:tw2.jqplugins.ui tw2:tw2.jquery tw2:tw2.sqla twisted:Twisted twitter:python_twitter txclib:transifex_client u115:115wangpan unidecode:Unidecode universe:ansible_universe usb:pyusb useless:useless.pipes userpass:auth_userpass utilities:automakesetup.py utkik:aino_utkik uwsgidecorators:uWSGI valentine:ab validate:configobj version:chartio virtualenvapi:ar_virtualenv_api vyatta:brocade_plugins webdav:Zope2 weblogolib:weblogo webob:WebOb websocket:websocket_client webtest:WebTest werkzeug:Werkzeug wheezy:wheezy.caching wheezy:wheezy.core wheezy:wheezy.http wikklytext:tiddlywebwiki winreg:future winrm:pywinrm workflow:Alfred_Workflow wsmeext:WSME wtforms:WTForms wtfpeewee:wtf_peewee xdg:pyxdg xdist:pytest_xdist xmldsig:pysaml2 xmlenc:pysaml2 xmlrpc:pies2overrides xmpp:xmpppy xstatic:XStatic_Font_Awesome xstatic:XStatic_jQuery xstatic:XStatic_jquery_ui yaml:PyYAML z3c:z3c.autoinclude z3c:z3c.caching z3c:z3c.form z3c:z3c.formwidget.query z3c:z3c.objpath z3c:z3c.pt z3c:z3c.relationfield z3c:z3c.traverser z3c:z3c.zcmlhook zmq:pyzmq zopyx:zopyx.textindexng3 ================================================ FILE: pipreqs/pipreqs.py ================================================ #!/usr/bin/env python """pipreqs - Generate pip requirements.txt file based on imports Usage: pipreqs [options] [] Arguments: The path to the directory containing the application files for which a requirements file should be generated (defaults to the current working directory). Options: --use-local Use ONLY local package info instead of querying PyPI. --pypi-server Use custom PyPi server. --proxy Use Proxy, parameter will be passed to requests library. You can also just set the environments parameter in your terminal: $ export HTTP_PROXY="http://10.10.1.10:3128" $ export HTTPS_PROXY="https://10.10.1.10:1080" --debug Print debug information --ignore ... Ignore extra directories, each separated by a comma --ignore-errors Ignore errors while scanning files --no-follow-links Do not follow symbolic links in the project --encoding Use encoding parameter for file open --savepath Save the list of requirements in the given file --print Output the list of requirements in the standard output --force Overwrite existing requirements.txt --diff Compare modules in requirements.txt to project imports --clean Clean up requirements.txt by removing modules that are not imported in project --mode Enables dynamic versioning with , or schemes. | e.g. Flask~=1.1.2 | e.g. Flask>=1.1.2 | e.g. Flask --scan-notebooks Look for imports in jupyter notebook files. """ from contextlib import contextmanager import os import sys import re import logging import ast import traceback from docopt import docopt import requests from yarg import json2package from yarg.exceptions import HTTPError from pipreqs import __version__ REGEXP = [re.compile(r"^import (.+)$"), re.compile(r"^from ((?!\.+).*?) import (?:.*)$")] DEFAULT_EXTENSIONS = [".py", ".pyw"] scan_noteboooks = False class NbconvertNotInstalled(ImportError): default_message = ( "In order to scan jupyter notebooks, please install the nbconvert and ipython libraries" ) def __init__(self, message=default_message): super().__init__(message) @contextmanager def _open(filename=None, mode="r"): """Open a file or ``sys.stdout`` depending on the provided filename. Args: filename (str): The path to the file that should be opened. If ``None`` or ``'-'``, ``sys.stdout`` or ``sys.stdin`` is returned depending on the desired mode. Defaults to ``None``. mode (str): The mode that should be used to open the file. Yields: A file handle. """ if not filename or filename == "-": if not mode or "r" in mode: file = sys.stdin elif "w" in mode: file = sys.stdout else: raise ValueError("Invalid mode for file: {}".format(mode)) else: file = open(filename, mode) try: yield file finally: if file not in (sys.stdin, sys.stdout): file.close() def get_all_imports(path, encoding="utf-8", extra_ignore_dirs=None, follow_links=True, ignore_errors=False): imports = set() raw_imports = set() candidates = [] ignore_dirs = [ ".hg", ".svn", ".git", ".tox", "__pycache__", "env", "venv", ".venv", ".ipynb_checkpoints", ] if extra_ignore_dirs: ignore_dirs_parsed = [] for e in extra_ignore_dirs: ignore_dirs_parsed.append(os.path.basename(os.path.realpath(e))) ignore_dirs.extend(ignore_dirs_parsed) extensions = get_file_extensions() walk = os.walk(path, followlinks=follow_links) for root, dirs, files in walk: dirs[:] = [d for d in dirs if d not in ignore_dirs] candidates.append(os.path.basename(root)) py_files = [file for file in files if file_ext_is_allowed(file, DEFAULT_EXTENSIONS)] candidates.extend([os.path.splitext(filename)[0] for filename in py_files]) files = [fn for fn in files if file_ext_is_allowed(fn, extensions)] for file_name in files: file_name = os.path.join(root, file_name) try: contents = read_file_content(file_name, encoding) tree = ast.parse(contents) for node in ast.walk(tree): if isinstance(node, ast.Import): for subnode in node.names: raw_imports.add(subnode.name) elif isinstance(node, ast.ImportFrom): raw_imports.add(node.module) except Exception as exc: if ignore_errors: traceback.print_exc() logging.warning("Failed on file: %s" % file_name) continue else: logging.error("Failed on file: %s" % file_name) raise exc # Clean up imports for name in [n for n in raw_imports if n]: # Sanity check: Name could have been None if the import # statement was as ``from . import X`` # Cleanup: We only want to first part of the import. # Ex: from django.conf --> django.conf. But we only want django # as an import. cleaned_name, _, _ = name.partition(".") imports.add(cleaned_name) packages = imports - (set(candidates) & imports) logging.debug("Found packages: {0}".format(packages)) with open(join("stdlib"), "r") as f: data = {x.strip() for x in f} return list(packages - data) def get_file_extensions(): return DEFAULT_EXTENSIONS + [".ipynb"] if scan_noteboooks else DEFAULT_EXTENSIONS def read_file_content(file_name: str, encoding="utf-8"): if file_ext_is_allowed(file_name, DEFAULT_EXTENSIONS): with open(file_name, "r", encoding=encoding) as f: contents = f.read() elif file_ext_is_allowed(file_name, [".ipynb"]) and scan_noteboooks: contents = ipynb_2_py(file_name, encoding=encoding) return contents def file_ext_is_allowed(file_name, acceptable): return os.path.splitext(file_name)[1] in acceptable def ipynb_2_py(file_name, encoding="utf-8"): """ Args: file_name (str): notebook file path to parse as python script encoding (str): encoding of file Returns: str: parsed string """ exporter = PythonExporter() (body, _) = exporter.from_filename(file_name) return body.encode(encoding) def generate_requirements_file(path, imports, symbol): with _open(path, "w") as out_file: logging.debug( "Writing {num} requirements: {imports} to {file}".format( num=len(imports), file=path, imports=", ".join([x["name"] for x in imports]) ) ) fmt = "{name}" + symbol + "{version}" out_file.write( "\n".join( fmt.format(**item) if item["version"] else "{name}".format(**item) for item in imports ) + "\n" ) def output_requirements(imports, symbol): generate_requirements_file("-", imports, symbol) def get_imports_info(imports, pypi_server="https://pypi.python.org/pypi/", proxy=None): result = [] for item in imports: try: logging.warning( 'Import named "%s" not found locally. ' "Trying to resolve it at the PyPI server.", item, ) response = requests.get("{0}{1}/json".format(pypi_server, item), proxies=proxy) if response.status_code == 200: if hasattr(response.content, "decode"): data = json2package(response.content.decode()) else: data = json2package(response.content) elif response.status_code >= 300: raise HTTPError(status_code=response.status_code, reason=response.reason) except HTTPError: logging.warning('Package "%s" does not exist or network problems', item) continue logging.warning( 'Import named "%s" was resolved to "%s:%s" package (%s).\n' "Please, verify manually the final list of requirements.txt " "to avoid possible dependency confusions.", item, data.name, data.latest_release_id, data.pypi_url, ) result.append({"name": item, "version": data.latest_release_id}) return result def get_locally_installed_packages(encoding="utf-8"): packages = [] ignore = ["tests", "_tests", "egg", "EGG", "info"] for path in sys.path: for root, dirs, files in os.walk(path): for item in files: if "top_level" in item: item = os.path.join(root, item) with open(item, "r", encoding=encoding) as f: package = root.split(os.sep)[-1].split("-") try: top_level_modules = f.read().strip().split("\n") except: # NOQA # TODO: What errors do we intend to suppress here? continue # filter off explicitly ignored top-level modules # such as test, egg, etc. filtered_top_level_modules = list() for module in top_level_modules: if (module not in ignore) and (package[0] not in ignore): # append exported top level modules to the list filtered_top_level_modules.append(module) version = None if len(package) > 1: version = package[1].replace(".dist", "").replace(".egg", "") # append package: top_level_modules pairs # instead of top_level_module: package pairs packages.append( { "name": package[0], "version": version, "exports": filtered_top_level_modules, } ) return packages def get_import_local(imports, encoding="utf-8"): local = get_locally_installed_packages() result = [] for item in imports: # search through local packages for package in local: # if candidate import name matches export name # or candidate import name equals to the package name # append it to the result if item in package["exports"] or item == package["name"]: result.append(package) # removing duplicates of package/version # had to use second method instead of the previous one, # because we have a list in the 'exports' field # https://stackoverflow.com/questions/9427163/remove-duplicate-dict-in-list-in-python result_unique = [i for n, i in enumerate(result) if i not in result[n + 1:]] return result_unique def get_pkg_names(pkgs): """Get PyPI package names from a list of imports. Args: pkgs (List[str]): List of import names. Returns: List[str]: The corresponding PyPI package names. """ result = set() with open(join("mapping"), "r") as f: data = dict(x.strip().split(":") for x in f) for pkg in pkgs: # Look up the mapped requirement. If a mapping isn't found, # simply use the package name. result.add(data.get(pkg, pkg)) # Return a sorted list for backward compatibility. return sorted(result, key=lambda s: s.lower()) def get_name_without_alias(name): if "import " in name: match = REGEXP[0].match(name.strip()) if match: name = match.groups(0)[0] return name.partition(" as ")[0].partition(".")[0].strip() def join(f): return os.path.join(os.path.dirname(__file__), f) def parse_requirements(file_): """Parse a requirements formatted file. Traverse a string until a delimiter is detected, then split at said delimiter, get module name by element index, create a dict consisting of module:version, and add dict to list of parsed modules. If file ´file_´ is not found in the system, the program will print a helpful message and end its execution immediately. Args: file_: File to parse. Raises: OSerror: If there's any issues accessing the file. Returns: list: The contents of the file, excluding comments. """ modules = [] # For the dependency identifier specification, see # https://www.python.org/dev/peps/pep-0508/#complete-grammar delim = ["<", ">", "=", "!", "~"] try: f = open(file_, "r") except FileNotFoundError: print(f"File {file_} was not found. Please, fix it and run again.") sys.exit(1) except OSError as error: logging.error(f"There was an error opening the file {file_}: {str(error)}") raise error else: try: data = [x.strip() for x in f.readlines() if x != "\n"] finally: f.close() data = [x for x in data if x[0].isalpha()] for x in data: # Check for modules w/o a specifier. if not any([y in x for y in delim]): modules.append({"name": x, "version": None}) for y in x: if y in delim: module = x.split(y) module_name = module[0] module_version = module[-1].replace("=", "") module = {"name": module_name, "version": module_version} if module not in modules: modules.append(module) break return modules def compare_modules(file_, imports): """Compare modules in a file to imported modules in a project. Args: file_ (str): File to parse for modules to be compared. imports (tuple): Modules being imported in the project. Returns: set: The modules not imported in the project, but do exist in the specified file. """ modules = parse_requirements(file_) imports = [imports[i]["name"] for i in range(len(imports))] modules = [modules[i]["name"] for i in range(len(modules))] modules_not_imported = set(modules) - set(imports) return modules_not_imported def diff(file_, imports): """Display the difference between modules in a file and imported modules.""" # NOQA modules_not_imported = compare_modules(file_, imports) logging.info( "The following modules are in {} but do not seem to be imported: " "{}".format(file_, ", ".join(x for x in modules_not_imported)) ) def clean(file_, imports): """Remove modules that aren't imported in project from file.""" modules_not_imported = compare_modules(file_, imports) if len(modules_not_imported) == 0: logging.info("Nothing to clean in " + file_) return re_remove = re.compile("|".join(modules_not_imported)) to_write = [] try: f = open(file_, "r+") except OSError: logging.error("Failed on file: {}".format(file_)) raise else: try: for i in f.readlines(): if re_remove.match(i) is None: to_write.append(i) f.seek(0) f.truncate() for i in to_write: f.write(i) finally: f.close() logging.info("Successfully cleaned up requirements in " + file_) def dynamic_versioning(scheme, imports): """Enables dynamic versioning with , or schemes.""" if scheme == "no-pin": imports = [{"name": item["name"], "version": ""} for item in imports] symbol = "" elif scheme == "gt": symbol = ">=" elif scheme == "compat": symbol = "~=" return imports, symbol def handle_scan_noteboooks(): if not scan_noteboooks: logging.info("Not scanning for jupyter notebooks.") return try: global PythonExporter from nbconvert import PythonExporter except ImportError: raise NbconvertNotInstalled() def init(args): global scan_noteboooks encoding = args.get("--encoding") extra_ignore_dirs = args.get("--ignore") follow_links = not args.get("--no-follow-links") ignore_errors = args.get("--ignore-errors") scan_noteboooks = args.get("--scan-notebooks", False) handle_scan_noteboooks() input_path = args[""] if encoding is None: encoding = "utf-8" if input_path is None: input_path = os.path.abspath(os.curdir) if extra_ignore_dirs: extra_ignore_dirs = extra_ignore_dirs.split(",") path = ( args["--savepath"] if args["--savepath"] else os.path.join(input_path, "requirements.txt") ) if ( not args["--print"] and not args["--savepath"] and not args["--force"] and os.path.exists(path) ): logging.warning("requirements.txt already exists, " "use --force to overwrite it") return candidates = get_all_imports( input_path, encoding=encoding, extra_ignore_dirs=extra_ignore_dirs, follow_links=follow_links, ignore_errors=ignore_errors, ) candidates = get_pkg_names(candidates) logging.debug("Found imports: " + ", ".join(candidates)) pypi_server = "https://pypi.python.org/pypi/" proxy = None if args["--pypi-server"]: pypi_server = args["--pypi-server"] if args["--proxy"]: proxy = {"http": args["--proxy"], "https": args["--proxy"]} if args["--use-local"]: logging.debug("Getting package information ONLY from local installation.") imports = get_import_local(candidates, encoding=encoding) else: logging.debug("Getting packages information from Local/PyPI") local = get_import_local(candidates, encoding=encoding) # check if candidate name is found in # the list of exported modules, installed locally # and the package name is not in the list of local module names # it add to difference difference = [ x for x in candidates if # aggregate all export lists into one # flatten the list # check if candidate is in exports x.lower() not in [y for x in local for y in x["exports"]] and # check if candidate is package names x.lower() not in [x["name"] for x in local] ] imports = local + get_imports_info(difference, proxy=proxy, pypi_server=pypi_server) # sort imports based on lowercase name of package, similar to `pip freeze`. imports = sorted(imports, key=lambda x: x["name"].lower()) if args["--diff"]: diff(args["--diff"], imports) return if args["--clean"]: clean(args["--clean"], imports) return if args["--mode"]: scheme = args.get("--mode") if scheme in ["compat", "gt", "no-pin"]: imports, symbol = dynamic_versioning(scheme, imports) else: raise ValueError( "Invalid argument for mode flag, " "use 'compat', 'gt' or 'no-pin' instead" ) else: symbol = "==" if args["--print"]: output_requirements(imports, symbol) logging.info("Successfully output requirements") else: generate_requirements_file(path, imports, symbol) logging.info("Successfully saved requirements file in " + path) def main(): # pragma: no cover args = docopt(__doc__, version=__version__) log_level = logging.DEBUG if args["--debug"] else logging.INFO logging.basicConfig(level=log_level, format="%(levelname)s: %(message)s") try: init(args) except KeyboardInterrupt: sys.exit(0) if __name__ == "__main__": main() # pragma: no cover ================================================ FILE: pipreqs/stdlib ================================================ _abc abc aifc _aix_support antigravity argparse array _ast ast asynchat _asyncio asyncio asyncio.base_events asyncio.base_futures asyncio.base_subprocess asyncio.base_tasks asyncio.constants asyncio.coroutines asyncio.events asyncio.exceptions asyncio.format_helpers asyncio.futures asyncio.locks asyncio.log asyncio.__main__ asyncio.proactor_events asyncio.protocols asyncio.queues asyncio.runners asyncio.selector_events asyncio.sslproto asyncio.staggered asyncio.streams asyncio.subprocess asyncio.tasks asyncio.threads asyncio.transports asyncio.trsock asyncio.unix_events asyncio.windows_events asyncio.windows_utils asyncore atexit audioop base64 bdb binascii binhex _bisect bisect _blake2 _bootlocale _bootsubprocess builtins _bz2 bz2 calendar cgi cgitb chunk cmath cmd code _codecs codecs _codecs_cn _codecs_hk _codecs_iso2022 _codecs_jp _codecs_kr _codecs_tw codeop _collections collections _collections_abc collections.abc colorsys _compat_pickle compileall _compression concurrent concurrent.futures concurrent.futures._base concurrent.futures.process concurrent.futures.thread configparser contextlib _contextvars contextvars copy copyreg cProfile _crypt crypt _csv csv _ctypes ctypes ctypes._aix ctypes._endian ctypes.macholib ctypes.macholib.dyld ctypes.macholib.dylib ctypes.macholib.framework _ctypes_test ctypes.test ctypes.test.__main__ ctypes.test.test_anon ctypes.test.test_array_in_pointer ctypes.test.test_arrays ctypes.test.test_as_parameter ctypes.test.test_bitfields ctypes.test.test_buffers ctypes.test.test_bytes ctypes.test.test_byteswap ctypes.test.test_callbacks ctypes.test.test_cast ctypes.test.test_cfuncs ctypes.test.test_checkretval ctypes.test.test_delattr ctypes.test.test_errno ctypes.test.test_find ctypes.test.test_frombuffer ctypes.test.test_funcptr ctypes.test.test_functions ctypes.test.test_incomplete ctypes.test.test_init ctypes.test.test_internals ctypes.test.test_keeprefs ctypes.test.test_libc ctypes.test.test_loading ctypes.test.test_macholib ctypes.test.test_memfunctions ctypes.test.test_numbers ctypes.test.test_objects ctypes.test.test_parameters ctypes.test.test_pep3118 ctypes.test.test_pickling ctypes.test.test_pointers ctypes.test.test_prototypes ctypes.test.test_python_api ctypes.test.test_random_things ctypes.test.test_refcounts ctypes.test.test_repr ctypes.test.test_returnfuncptrs ctypes.test.test_simplesubclasses ctypes.test.test_sizes ctypes.test.test_slicing ctypes.test.test_stringptr ctypes.test.test_strings ctypes.test.test_struct_fields ctypes.test.test_structures ctypes.test.test_unaligned_structures ctypes.test.test_unicode ctypes.test.test_values ctypes.test.test_varsize_struct ctypes.test.test_win32 ctypes.test.test_wintypes ctypes.util ctypes.wintypes _curses curses curses.ascii curses.has_key _curses_panel curses.panel curses.textpad dataclasses _datetime datetime _dbm dbm dbm.dumb dbm.gnu dbm.ndbm _decimal decimal difflib dis distutils distutils.archive_util distutils.bcppcompiler distutils.ccompiler distutils.cmd distutils.command distutils.command.bdist distutils.command.bdist_dumb distutils.command.bdist_msi distutils.command.bdist_packager distutils.command.bdist_rpm distutils.command.bdist_wininst distutils.command.build distutils.command.build_clib distutils.command.build_ext distutils.command.build_py distutils.command.build_scripts distutils.command.check distutils.command.clean distutils.command.config distutils.command.install distutils.command.install_data distutils.command.install_egg_info distutils.command.install_headers distutils.command.install_lib distutils.command.install_scripts distutils.command.register distutils.command.sdist distutils.command.upload distutils.config distutils.core distutils.cygwinccompiler distutils.debug distutils.dep_util distutils.dir_util distutils.dist distutils.errors distutils.extension distutils.fancy_getopt distutils.filelist distutils.file_util distutils.log distutils.msvc9compiler distutils._msvccompiler distutils.msvccompiler distutils.spawn distutils.sysconfig distutils.tests distutils.tests.support distutils.tests.test_archive_util distutils.tests.test_bdist distutils.tests.test_bdist_dumb distutils.tests.test_bdist_msi distutils.tests.test_bdist_rpm distutils.tests.test_bdist_wininst distutils.tests.test_build distutils.tests.test_build_clib distutils.tests.test_build_ext distutils.tests.test_build_py distutils.tests.test_build_scripts distutils.tests.test_check distutils.tests.test_clean distutils.tests.test_cmd distutils.tests.test_config distutils.tests.test_config_cmd distutils.tests.test_core distutils.tests.test_cygwinccompiler distutils.tests.test_dep_util distutils.tests.test_dir_util distutils.tests.test_dist distutils.tests.test_extension distutils.tests.test_filelist distutils.tests.test_file_util distutils.tests.test_install distutils.tests.test_install_data distutils.tests.test_install_headers distutils.tests.test_install_lib distutils.tests.test_install_scripts distutils.tests.test_log distutils.tests.test_msvc9compiler distutils.tests.test_msvccompiler distutils.tests.test_register distutils.tests.test_sdist distutils.tests.test_spawn distutils.tests.test_sysconfig distutils.tests.test_text_file distutils.tests.test_unixccompiler distutils.tests.test_upload distutils.tests.test_util distutils.tests.test_version distutils.tests.test_versionpredicate distutils.text_file distutils.unixccompiler distutils.util distutils.version distutils.versionpredicate doctest _dummy_thread dummy_threading _elementtree email email.base64mime email.charset email.contentmanager email._encoded_words email.encoders email.errors email.feedparser email.generator email.header email.headerregistry email._header_value_parser email.iterators email.message email.mime email.mime.application email.mime.audio email.mime.base email.mime.image email.mime.message email.mime.multipart email.mime.nonmultipart email.mime.text email._parseaddr email.parser email.policy email._policybase email.quoprimime email.utils encodings encodings.aliases encodings.ascii encodings.base64_codec encodings.big5 encodings.big5hkscs encodings.bz2_codec encodings.charmap encodings.cp037 encodings.cp1006 encodings.cp1026 encodings.cp1125 encodings.cp1140 encodings.cp1250 encodings.cp1251 encodings.cp1252 encodings.cp1253 encodings.cp1254 encodings.cp1255 encodings.cp1256 encodings.cp1257 encodings.cp1258 encodings.cp273 encodings.cp424 encodings.cp437 encodings.cp500 encodings.cp720 encodings.cp737 encodings.cp775 encodings.cp850 encodings.cp852 encodings.cp855 encodings.cp856 encodings.cp857 encodings.cp858 encodings.cp860 encodings.cp861 encodings.cp862 encodings.cp863 encodings.cp864 encodings.cp865 encodings.cp866 encodings.cp869 encodings.cp874 encodings.cp875 encodings.cp932 encodings.cp949 encodings.cp950 encodings.euc_jis_2004 encodings.euc_jisx0213 encodings.euc_jp encodings.euc_kr encodings.gb18030 encodings.gb2312 encodings.gbk encodings.hex_codec encodings.hp_roman8 encodings.hz encodings.idna encodings.iso2022_jp encodings.iso2022_jp_1 encodings.iso2022_jp_2 encodings.iso2022_jp_2004 encodings.iso2022_jp_3 encodings.iso2022_jp_ext encodings.iso2022_kr encodings.iso8859_1 encodings.iso8859_10 encodings.iso8859_11 encodings.iso8859_13 encodings.iso8859_14 encodings.iso8859_15 encodings.iso8859_16 encodings.iso8859_2 encodings.iso8859_3 encodings.iso8859_4 encodings.iso8859_5 encodings.iso8859_6 encodings.iso8859_7 encodings.iso8859_8 encodings.iso8859_9 encodings.johab encodings.koi8_r encodings.koi8_t encodings.koi8_u encodings.kz1048 encodings.latin_1 encodings.mac_arabic encodings.mac_centeuro encodings.mac_croatian encodings.mac_cyrillic encodings.mac_farsi encodings.mac_greek encodings.mac_iceland encodings.mac_latin2 encodings.mac_roman encodings.mac_romanian encodings.mac_turkish encodings.mbcs encodings.oem encodings.palmos encodings.ptcp154 encodings.punycode encodings.quopri_codec encodings.raw_unicode_escape encodings.rot_13 encodings.shift_jis encodings.shift_jis_2004 encodings.shift_jisx0213 encodings.tis_620 encodings.undefined encodings.unicode_escape encodings.utf_16 encodings.utf_16_be encodings.utf_16_le encodings.utf_32 encodings.utf_32_be encodings.utf_32_le encodings.utf_7 encodings.utf_8 encodings.utf_8_sig encodings.uu_codec encodings.zlib_codec ensurepip ensurepip._bundled ensurepip.__main__ ensurepip._uninstall enum errno faulthandler fcntl filecmp fileinput fnmatch formatter fractions _frozen_importlib _frozen_importlib_external ftplib _functools functools __future__ gc _gdbm genericpath getopt getpass gettext glob graphlib grp gzip _hashlib hashlib _heapq heapq hmac html html.entities html.parser http http.client http.cookiejar http.cookies http.server idlelib idlelib.autocomplete idlelib.autocomplete_w idlelib.autoexpand idlelib.browser idlelib.calltip idlelib.calltip_w idlelib.codecontext idlelib.colorizer idlelib.config idlelib.configdialog idlelib.config_key idlelib.debugger idlelib.debugger_r idlelib.debugobj idlelib.debugobj_r idlelib.delegator idlelib.dynoption idlelib.editor idlelib.filelist idlelib.format idlelib.grep idlelib.help idlelib.help_about idlelib.history idlelib.hyperparser idlelib.idle idlelib.idle_test idlelib.idle_test.htest idlelib.idle_test.mock_idle idlelib.idle_test.mock_tk idlelib.idle_test.template idlelib.idle_test.test_autocomplete idlelib.idle_test.test_autocomplete_w idlelib.idle_test.test_autoexpand idlelib.idle_test.test_browser idlelib.idle_test.test_calltip idlelib.idle_test.test_calltip_w idlelib.idle_test.test_codecontext idlelib.idle_test.test_colorizer idlelib.idle_test.test_config idlelib.idle_test.test_configdialog idlelib.idle_test.test_config_key idlelib.idle_test.test_debugger idlelib.idle_test.test_debugger_r idlelib.idle_test.test_debugobj idlelib.idle_test.test_debugobj_r idlelib.idle_test.test_delegator idlelib.idle_test.test_editmenu idlelib.idle_test.test_editor idlelib.idle_test.test_filelist idlelib.idle_test.test_format idlelib.idle_test.test_grep idlelib.idle_test.test_help idlelib.idle_test.test_help_about idlelib.idle_test.test_history idlelib.idle_test.test_hyperparser idlelib.idle_test.test_iomenu idlelib.idle_test.test_macosx idlelib.idle_test.test_mainmenu idlelib.idle_test.test_multicall idlelib.idle_test.test_outwin idlelib.idle_test.test_parenmatch idlelib.idle_test.test_pathbrowser idlelib.idle_test.test_percolator idlelib.idle_test.test_pyparse idlelib.idle_test.test_pyshell idlelib.idle_test.test_query idlelib.idle_test.test_redirector idlelib.idle_test.test_replace idlelib.idle_test.test_rpc idlelib.idle_test.test_run idlelib.idle_test.test_runscript idlelib.idle_test.test_scrolledlist idlelib.idle_test.test_search idlelib.idle_test.test_searchbase idlelib.idle_test.test_searchengine idlelib.idle_test.test_sidebar idlelib.idle_test.test_squeezer idlelib.idle_test.test_stackviewer idlelib.idle_test.test_statusbar idlelib.idle_test.test_text idlelib.idle_test.test_textview idlelib.idle_test.test_tooltip idlelib.idle_test.test_tree idlelib.idle_test.test_undo idlelib.idle_test.test_warning idlelib.idle_test.test_window idlelib.idle_test.test_zoomheight idlelib.iomenu idlelib.macosx idlelib.__main__ idlelib.mainmenu idlelib.multicall idlelib.outwin idlelib.parenmatch idlelib.pathbrowser idlelib.percolator idlelib.pyparse idlelib.pyshell idlelib.query idlelib.redirector idlelib.replace idlelib.rpc idlelib.run idlelib.runscript idlelib.scrolledlist idlelib.search idlelib.searchbase idlelib.searchengine idlelib.sidebar idlelib.squeezer idlelib.stackviewer idlelib.statusbar idlelib.textview idlelib.tooltip idlelib.tree idlelib.undo idlelib.window idlelib.zoomheight idlelib.zzdummy imaplib imghdr _imp imp importlib importlib.abc importlib._bootstrap importlib._bootstrap_external importlib._common importlib.machinery importlib.metadata importlib.resources importlib.util inspect _io io ipaddress itertools _json json json.decoder json.encoder json.scanner json.tool keyword lib2to3 lib2to3.btm_matcher lib2to3.btm_utils lib2to3.fixer_base lib2to3.fixer_util lib2to3.fixes lib2to3.fixes.fix_apply lib2to3.fixes.fix_asserts lib2to3.fixes.fix_basestring lib2to3.fixes.fix_buffer lib2to3.fixes.fix_dict lib2to3.fixes.fix_except lib2to3.fixes.fix_exec lib2to3.fixes.fix_execfile lib2to3.fixes.fix_exitfunc lib2to3.fixes.fix_filter lib2to3.fixes.fix_funcattrs lib2to3.fixes.fix_future lib2to3.fixes.fix_getcwdu lib2to3.fixes.fix_has_key lib2to3.fixes.fix_idioms lib2to3.fixes.fix_import lib2to3.fixes.fix_imports lib2to3.fixes.fix_imports2 lib2to3.fixes.fix_input lib2to3.fixes.fix_intern lib2to3.fixes.fix_isinstance lib2to3.fixes.fix_itertools lib2to3.fixes.fix_itertools_imports lib2to3.fixes.fix_long lib2to3.fixes.fix_map lib2to3.fixes.fix_metaclass lib2to3.fixes.fix_methodattrs lib2to3.fixes.fix_ne lib2to3.fixes.fix_next lib2to3.fixes.fix_nonzero lib2to3.fixes.fix_numliterals lib2to3.fixes.fix_operator lib2to3.fixes.fix_paren lib2to3.fixes.fix_print lib2to3.fixes.fix_raise lib2to3.fixes.fix_raw_input lib2to3.fixes.fix_reduce lib2to3.fixes.fix_reload lib2to3.fixes.fix_renames lib2to3.fixes.fix_repr lib2to3.fixes.fix_set_literal lib2to3.fixes.fix_standarderror lib2to3.fixes.fix_sys_exc lib2to3.fixes.fix_throw lib2to3.fixes.fix_tuple_params lib2to3.fixes.fix_types lib2to3.fixes.fix_unicode lib2to3.fixes.fix_urllib lib2to3.fixes.fix_ws_comma lib2to3.fixes.fix_xrange lib2to3.fixes.fix_xreadlines lib2to3.fixes.fix_zip lib2to3.main lib2to3.__main__ lib2to3.patcomp lib2to3.pgen2 lib2to3.pgen2.conv lib2to3.pgen2.driver lib2to3.pgen2.grammar lib2to3.pgen2.literals lib2to3.pgen2.parse lib2to3.pgen2.pgen lib2to3.pgen2.token lib2to3.pgen2.tokenize lib2to3.pygram lib2to3.pytree lib2to3.refactor lib2to3.tests lib2to3.tests.data.bom lib2to3.tests.data.crlf lib2to3.tests.data.different_encoding lib2to3.tests.data.false_encoding lib2to3.tests.data.fixers.bad_order lib2to3.tests.data.fixers.myfixes lib2to3.tests.data.fixers.myfixes.fix_explicit lib2to3.tests.data.fixers.myfixes.fix_first lib2to3.tests.data.fixers.myfixes.fix_last lib2to3.tests.data.fixers.myfixes.fix_parrot lib2to3.tests.data.fixers.myfixes.fix_preorder lib2to3.tests.data.fixers.no_fixer_cls lib2to3.tests.data.fixers.parrot_example lib2to3.tests.data.infinite_recursion lib2to3.tests.data.py2_test_grammar lib2to3.tests.data.py3_test_grammar lib2to3.tests.__main__ lib2to3.tests.pytree_idempotency lib2to3.tests.support lib2to3.tests.test_all_fixers lib2to3.tests.test_fixers lib2to3.tests.test_main lib2to3.tests.test_parser lib2to3.tests.test_pytree lib2to3.tests.test_refactor lib2to3.tests.test_util lib.libpython3 linecache _locale locale logging logging.config logging.handlers _lsprof _lzma lzma mailbox mailcap __main__ _markupbase marshal math _md5 mimetypes mmap modulefinder msilib msvcrt _multibytecodec _multiprocessing multiprocessing multiprocessing.connection multiprocessing.context multiprocessing.dummy multiprocessing.dummy.connection multiprocessing.forkserver multiprocessing.heap multiprocessing.managers multiprocessing.pool multiprocessing.popen_fork multiprocessing.popen_forkserver multiprocessing.popen_spawn_posix multiprocessing.popen_spawn_win32 multiprocessing.process multiprocessing.queues multiprocessing.reduction multiprocessing.resource_sharer multiprocessing.resource_tracker multiprocessing.sharedctypes multiprocessing.shared_memory multiprocessing.spawn multiprocessing.synchronize multiprocessing.util netrc nis nntplib ntpath nturl2path numbers _opcode opcode _operator operator optparse os os.path ossaudiodev _osx_support parser pathlib pdb __phello__.foo _pickle pickle pickletools pipes pkgutil platform plistlib poplib posix posixpath _posixshmem _posixsubprocess pprint profile pstats pty pwd _py_abc pyclbr py_compile _pydecimal pydoc pydoc_data pydoc_data.topics pyexpat _pyio _queue queue quopri _random random re readline reprlib resource rlcompleter runpy sched secrets select selectors _sha1 _sha256 _sha3 _sha512 shelve shlex shutil _signal signal site _sitebuiltins smtpd smtplib sndhdr _socket socket socketserver spwd _sqlite3 sqlite3 sqlite3.dbapi2 sqlite3.dump sqlite3.test sqlite3.test.backup sqlite3.test.dbapi sqlite3.test.dump sqlite3.test.factory sqlite3.test.hooks sqlite3.test.regression sqlite3.test.transactions sqlite3.test.types sqlite3.test.userfunctions _sre sre_compile sre_constants sre_parse _ssl ssl _stat stat _statistics statistics _string string stringprep _strptime _struct struct subprocess sunau symbol _symtable symtable sys sysconfig _sysconfigdata_x86_64_conda_cos6_linux_gnu _sysconfigdata_x86_64_conda_linux_gnu syslog tabnanny tarfile telnetlib tempfile termios test test.ann_module test.ann_module2 test.ann_module3 test.audiotests test.autotest test.bad_coding test.bad_coding2 test.bad_getattr test.bad_getattr2 test.bad_getattr3 test.badsyntax_3131 test.badsyntax_future10 test.badsyntax_future3 test.badsyntax_future4 test.badsyntax_future5 test.badsyntax_future6 test.badsyntax_future7 test.badsyntax_future8 test.badsyntax_future9 test.badsyntax_pep3120 test.bisect_cmd _testbuffer test.bytecode_helper _testcapi test.coding20731 test.curses_tests test.dataclass_module_1 test.dataclass_module_1_str test.dataclass_module_2 test.dataclass_module_2_str test.datetimetester test.dis_module test.doctest_aliases test.double_const test.dtracedata.call_stack test.dtracedata.gc test.dtracedata.instance test.dtracedata.line test.eintrdata.eintr_tester test.encoded_modules test.encoded_modules.module_iso_8859_1 test.encoded_modules.module_koi8_r test.final_a test.final_b test.fork_wait test.future_test1 test.future_test2 test.gdb_sample test.good_getattr test.imp_dummy _testimportmultiple test.inspect_fodder test.inspect_fodder2 _testinternalcapi test.libregrtest test.libregrtest.cmdline test.libregrtest.main test.libregrtest.pgo test.libregrtest.refleak test.libregrtest.runtest test.libregrtest.runtest_mp test.libregrtest.save_env test.libregrtest.setup test.libregrtest.utils test.libregrtest.win_utils test.list_tests test.lock_tests test.__main__ test.make_ssl_certs test.mapping_tests test.memory_watchdog test.mock_socket test.mod_generics_cache test.mp_fork_bomb test.mp_preload test.multibytecodec_support _testmultiphase test.outstanding_bugs test.pickletester test.profilee test.pyclbr_input test.pydocfodder test.pydoc_mod test.pythoninfo test.regrtest test.relimport test.reperf test.re_tests test.sample_doctest test.sample_doctest_no_docstrings test.sample_doctest_no_doctests test.seq_tests test.signalinterproctester test.sortperf test.ssl_servers test.ssltests test.string_tests test.subprocessdata.fd_status test.subprocessdata.input_reader test.subprocessdata.qcat test.subprocessdata.qgrep test.subprocessdata.sigchild_ignore test.support test.support.bytecode_helper test.support.hashlib_helper test.support.logging_helper test.support.script_helper test.support.socket_helper test.support.testresult test.test_abc test.test_abstract_numbers test.test_aifc test.test___all__ test.test_argparse test.test_array test.test_asdl_parser test.test_ast test.test_asyncgen test.test_asynchat test.test_asyncio test.test_asyncio.echo test.test_asyncio.echo2 test.test_asyncio.echo3 test.test_asyncio.functional test.test_asyncio.__main__ test.test_asyncio.test_base_events test.test_asyncio.test_buffered_proto test.test_asyncio.test_context test.test_asyncio.test_events test.test_asyncio.test_futures test.test_asyncio.test_locks test.test_asyncio.test_pep492 test.test_asyncio.test_proactor_events test.test_asyncio.test_protocols test.test_asyncio.test_queues test.test_asyncio.test_runners test.test_asyncio.test_selector_events test.test_asyncio.test_sendfile test.test_asyncio.test_server test.test_asyncio.test_sock_lowlevel test.test_asyncio.test_sslproto test.test_asyncio.test_streams test.test_asyncio.test_subprocess test.test_asyncio.test_tasks test.test_asyncio.test_transports test.test_asyncio.test_unix_events test.test_asyncio.test_windows_events test.test_asyncio.test_windows_utils test.test_asyncio.utils test.test_asyncore test.test_atexit test.test_audioop test.test_audit test.test_augassign test.test_base64 test.test_baseexception test.test_bdb test.test_bigaddrspace test.test_bigmem test.test_binascii test.test_binhex test.test_binop test.test_bisect test.test_bool test.test_buffer test.test_bufio test.test_builtin test.test_bytes test.test_bz2 test.test_calendar test.test_call test.test_capi test.test_cgi test.test_cgitb test.test_charmapcodec test.test_class test.test_clinic test.test_c_locale_coercion test.test_cmath test.test_cmd test.test_cmd_line test.test_cmd_line_script test.test_code test.testcodec test.test_codeccallbacks test.test_codecencodings_cn test.test_codecencodings_hk test.test_codecencodings_iso2022 test.test_codecencodings_jp test.test_codecencodings_kr test.test_codecencodings_tw test.test_codecmaps_cn test.test_codecmaps_hk test.test_codecmaps_jp test.test_codecmaps_kr test.test_codecmaps_tw test.test_codecs test.test_code_module test.test_codeop test.test_collections test.test_colorsys test.test_compare test.test_compile test.test_compileall test.test_complex test.test_concurrent_futures test.test_configparser test.test_contains test.test_context test.test_contextlib test.test_contextlib_async test.test_copy test.test_copyreg test.test_coroutines test.test_cprofile test.test_crashers test.test_crypt test.test_csv test.test_ctypes test.test_curses test.test_dataclasses test.test_datetime test.test_dbm test.test_dbm_dumb test.test_dbm_gnu test.test_dbm_ndbm test.test_decimal test.test_decorators test.test_defaultdict test.test_deque test.test_descr test.test_descrtut test.test_devpoll test.test_dict test.test_dictcomps test.test_dict_version test.test_dictviews test.test_difflib test.test_dis test.test_distutils test.test_doctest test.test_doctest2 test.test_docxmlrpc test.test_dtrace test.test_dummy_thread test.test_dummy_threading test.test_dynamic test.test_dynamicclassattribute test.test_eintr test.test_email test.test_email.__main__ test.test_email.test_asian_codecs test.test_email.test_contentmanager test.test_email.test_defect_handling test.test_email.test_email test.test_email.test__encoded_words test.test_email.test_generator test.test_email.test_headerregistry test.test_email.test__header_value_parser test.test_email.test_inversion test.test_email.test_message test.test_email.test_parser test.test_email.test_pickleable test.test_email.test_policy test.test_email.test_utils test.test_email.torture_test test.test_embed test.test_ensurepip test.test_enum test.test_enumerate test.test_eof test.test_epoll test.test_errno test.test_exception_hierarchy test.test_exceptions test.test_exception_variations test.test_extcall test.test_faulthandler test.test_fcntl test.test_file test.test_filecmp test.test_file_eintr test.test_fileinput test.test_fileio test.test_finalization test.test_float test.test_flufl test.test_fnmatch test.test_fork1 test.test_format test.test_fractions test.test_frame test.test_frozen test.test_fstring test.test_ftplib test.test_funcattrs test.test_functools test.test___future__ test.test_future test.test_future3 test.test_future4 test.test_future5 test.test_gc test.test_gdb test.test_generators test.test_generator_stop test.test_genericclass test.test_genericpath test.test_genexps test.test_getargs2 test.test_getopt test.test_getpass test.test_gettext test.test_glob test.test_global test.test_grammar test.test_grp test.test_gzip test.test_hash test.test_hashlib test.test_heapq test.test_hmac test.test_html test.test_htmlparser test.test_http_cookiejar test.test_http_cookies test.test_httplib test.test_httpservers test.test_idle test.test_imaplib test.test_imghdr test.test_imp test.test_import test.test_import.data.circular_imports.basic test.test_import.data.circular_imports.basic2 test.test_import.data.circular_imports.binding test.test_import.data.circular_imports.binding2 test.test_import.data.circular_imports.from_cycle1 test.test_import.data.circular_imports.from_cycle2 test.test_import.data.circular_imports.indirect test.test_import.data.circular_imports.rebinding test.test_import.data.circular_imports.rebinding2 test.test_import.data.circular_imports.source test.test_import.data.circular_imports.subpackage test.test_import.data.circular_imports.subpkg.subpackage2 test.test_import.data.circular_imports.subpkg.util test.test_import.data.circular_imports.use test.test_import.data.circular_imports.util test.test_import.data.package test.test_import.data.package2.submodule1 test.test_import.data.package2.submodule2 test.test_import.data.package.submodule test.test_importlib test.test_importlib.abc test.test_importlib.builtin test.test_importlib.builtin.__main__ test.test_importlib.builtin.test_finder test.test_importlib.builtin.test_loader test.test_importlib.data test.test_importlib.data01 test.test_importlib.data01.subdirectory test.test_importlib.data02 test.test_importlib.data02.one test.test_importlib.data02.two test.test_importlib.data03 test.test_importlib.data03.namespace.portion1 test.test_importlib.data03.namespace.portion2 test.test_importlib.extension test.test_importlib.extension.__main__ test.test_importlib.extension.test_case_sensitivity test.test_importlib.extension.test_finder test.test_importlib.extension.test_loader test.test_importlib.extension.test_path_hook test.test_importlib.fixtures test.test_importlib.frozen test.test_importlib.frozen.__main__ test.test_importlib.frozen.test_finder test.test_importlib.frozen.test_loader test.test_importlib.import_ test.test_importlib.import_.__main__ test.test_importlib.import_.test_api test.test_importlib.import_.test_caching test.test_importlib.import_.test_fromlist test.test_importlib.import_.test___loader__ test.test_importlib.import_.test_meta_path test.test_importlib.import_.test___package__ test.test_importlib.import_.test_packages test.test_importlib.import_.test_path test.test_importlib.import_.test_relative_imports test.test_importlib.__main__ test.test_importlib.namespace_pkgs.both_portions.foo.one test.test_importlib.namespace_pkgs.both_portions.foo.two test.test_importlib.namespace_pkgs.module_and_namespace_package.a_test test.test_importlib.namespace_pkgs.not_a_namespace_pkg.foo test.test_importlib.namespace_pkgs.not_a_namespace_pkg.foo.one test.test_importlib.namespace_pkgs.portion1.foo.one test.test_importlib.namespace_pkgs.portion2.foo.two test.test_importlib.namespace_pkgs.project1.parent.child.one test.test_importlib.namespace_pkgs.project2.parent.child.two test.test_importlib.namespace_pkgs.project3.parent.child.three test.test_importlib.source test.test_importlib.source.__main__ test.test_importlib.source.test_case_sensitivity test.test_importlib.source.test_file_loader test.test_importlib.source.test_finder test.test_importlib.source.test_path_hook test.test_importlib.source.test_source_encoding test.test_importlib.test_abc test.test_importlib.test_api test.test_importlib.test_lazy test.test_importlib.test_locks test.test_importlib.test_main test.test_importlib.test_metadata_api test.test_importlib.test_namespace_pkgs test.test_importlib.test_open test.test_importlib.test_path test.test_importlib.test_read test.test_importlib.test_resource test.test_importlib.test_spec test.test_importlib.test_util test.test_importlib.test_windows test.test_importlib.test_zip test.test_importlib.util test.test_importlib.zipdata01 test.test_importlib.zipdata02 test.test_import.__main__ test.test_index test.test_inspect test.test_int test.test_int_literal test.test_io test.test_ioctl test.test_ipaddress test.test_isinstance test.test_iter test.test_iterlen test.test_itertools test.test_json test.test_json.__main__ test.test_json.test_decode test.test_json.test_default test.test_json.test_dump test.test_json.test_encode_basestring_ascii test.test_json.test_enum test.test_json.test_fail test.test_json.test_float test.test_json.test_indent test.test_json.test_pass1 test.test_json.test_pass2 test.test_json.test_pass3 test.test_json.test_recursion test.test_json.test_scanstring test.test_json.test_separators test.test_json.test_speedups test.test_json.test_tool test.test_json.test_unicode test.test_keyword test.test_keywordonlyarg test.test_kqueue test.test_largefile test.test_lib2to3 test.test_linecache test.test_list test.test_listcomps test.test_lltrace test.test__locale test.test_locale test.test_logging test.test_long test.test_longexp test.test_lzma test.test_mailbox test.test_mailcap test.test_marshal test.test_math test.test_memoryio test.test_memoryview test.test_metaclass test.test_mimetypes test.test_minidom test.test_mmap test.test_module test.test_modulefinder test.test_msilib test.test_multibytecodec test._test_multiprocessing test.test_multiprocessing_fork test.test_multiprocessing_forkserver test.test_multiprocessing_main_handling test.test_multiprocessing_spawn test.test_named_expressions test.test_netrc test.test_nis test.test_nntplib test.test_normalization test.test_ntpath test.test_numeric_tower test.test__opcode test.test_opcodes test.test_openpty test.test_operator test.test_optparse test.test_ordered_dict test.test_os test.test_ossaudiodev test.test_osx_env test.test__osx_support test.test_parser test.test_pathlib test.test_pdb test.test_peepholer test.test_pickle test.test_picklebuffer test.test_pickletools test.test_pipes test.test_pkg test.test_pkgimport test.test_pkgutil test.test_platform test.test_plistlib test.test_poll test.test_popen test.test_poplib test.test_positional_only_arg test.test_posix test.test_posixpath test.test_pow test.test_pprint test.test_print test.test_profile test.test_property test.test_pstats test.test_pty test.test_pulldom test.test_pwd test.test_pyclbr test.test_py_compile test.test_pydoc test.test_pyexpat test.test_queue test.test_quopri test.test_raise test.test_random test.test_range test.test_re test.test_readline test.test_regrtest test.test_repl test.test_reprlib test.test_resource test.test_richcmp test.test_rlcompleter test.test_robotparser test.test_runpy test.test_sax test.test_sched test.test_scope test.test_script_helper test.test_secrets test.test_select test.test_selectors test.test_set test.test_setcomps test.test_shelve test.test_shlex test.test_shutil test.test_signal test.test_site test.test_slice test.test_smtpd test.test_smtplib test.test_smtpnet test.test_sndhdr test.test_socket test.test_socketserver test.test_sort test.test_source_encoding test.test_spwd test.test_sqlite test.test_ssl test.test_startfile test.test_stat test.test_statistics test.test_strftime test.test_string test.test_string_literals test.test_stringprep test.test_strptime test.test_strtod test.test_struct test.test_structmembers test.test_structseq test.test_subclassinit test.test_subprocess test.test_sunau test.test_sundry test.test_super test.test_support test.test_symbol test.test_symtable test.test_syntax test.test_sys test.test_sysconfig test.test_syslog test.test_sys_setprofile test.test_sys_settrace test.test_tabnanny test.test_tarfile test.test_tcl test.test_telnetlib test.test_tempfile test.test_textwrap test.test_thread test.test_threaded_import test.test_threadedtempfile test.test_threading test.test_threading_local test.test_threadsignals test.test_time test.test_timeit test.test_timeout test.test_tix test.test_tk test.test_tokenize test.test_tools test.test_tools.__main__ test.test_tools.test_fixcid test.test_tools.test_gprof2html test.test_tools.test_i18n test.test_tools.test_lll test.test_tools.test_md5sum test.test_tools.test_pathfix test.test_tools.test_pdeps test.test_tools.test_pindent test.test_tools.test_reindent test.test_tools.test_sundry test.test_tools.test_unparse test.test_trace test.test_traceback test.test_tracemalloc test.test_ttk_guionly test.test_ttk_textonly test.test_tuple test.test_turtle test.test_typechecks test.test_type_comments test.test_types test.test_typing test.test_ucn test.test_unary test.test_unicode test.test_unicodedata test.test_unicode_file test.test_unicode_file_functions test.test_unicode_identifiers test.test_unittest test.test_univnewlines test.test_unpack test.test_unpack_ex test.test_urllib test.test_urllib2 test.test_urllib2_localnet test.test_urllib2net test.test_urllibnet test.test_urllib_response test.test_urlparse test.test_userdict test.test_userlist test.test_userstring test.test_utf8_mode test.test_utf8source test.test_uu test.test_uuid test.test_venv test.test_wait3 test.test_wait4 test.test_warnings test.test_warnings.data.import_warning test.test_warnings.data.stacklevel test.test_warnings.__main__ test.test_wave test.test_weakref test.test_weakset test.test_webbrowser test.test_winconsoleio test.test_winreg test.test_winsound test.test_with test.test_wsgiref test.test_xdrlib test.test_xml_dom_minicompat test.test_xml_etree test.test_xml_etree_c test.test_xmlrpc test.test_xmlrpc_net test.test__xxsubinterpreters test.test_xxtestfuzz test.test_yield_from test.test_zipapp test.test_zipfile test.test_zipfile64 test.test_zipimport test.test_zipimport_support test.test_zlib test.tf_inherit_check test.threaded_import_hangers test.time_hashlib test.tracedmodules test.tracedmodules.testmod test.win_console_handler test.xmltests test.ziptestdata.testdata_module_inside_zip textwrap this _thread threading _threading_local time timeit _tkinter tkinter tkinter.colorchooser tkinter.commondialog tkinter.constants tkinter.dialog tkinter.dnd tkinter.filedialog tkinter.font tkinter.__main__ tkinter.messagebox tkinter.scrolledtext tkinter.simpledialog tkinter.test tkinter.test.runtktests tkinter.test.support tkinter.test.test_tkinter tkinter.test.test_tkinter.test_font tkinter.test.test_tkinter.test_geometry_managers tkinter.test.test_tkinter.test_images tkinter.test.test_tkinter.test_loadtk tkinter.test.test_tkinter.test_misc tkinter.test.test_tkinter.test_text tkinter.test.test_tkinter.test_variables tkinter.test.test_tkinter.test_widgets tkinter.test.test_ttk tkinter.test.test_ttk.test_extensions tkinter.test.test_ttk.test_functions tkinter.test.test_ttk.test_style tkinter.test.test_ttk.test_widgets tkinter.test.widget_tests tkinter.tix tkinter.ttk token tokenize trace traceback _tracemalloc tracemalloc tty turtle turtledemo turtledemo.bytedesign turtledemo.chaos turtledemo.clock turtledemo.colormixer turtledemo.forest turtledemo.fractalcurves turtledemo.lindenmayer turtledemo.__main__ turtledemo.minimal_hanoi turtledemo.nim turtledemo.paint turtledemo.peace turtledemo.penrose turtledemo.planet_and_moon turtledemo.rosette turtledemo.round_dance turtledemo.sorting_animate turtledemo.tree turtledemo.two_canvases turtledemo.yinyang types typing typing.io typing.re unicodedata unittest unittest.async_case unittest.case unittest.loader unittest._log unittest.__main__ unittest.main unittest.mock unittest.result unittest.runner unittest.signals unittest.suite unittest.test unittest.test.dummy unittest.test.__main__ unittest.test.support unittest.test.test_assertions unittest.test.test_async_case unittest.test.test_break unittest.test.test_case unittest.test.test_discovery unittest.test.test_functiontestcase unittest.test.test_loader unittest.test.testmock unittest.test.testmock.__main__ unittest.test.testmock.support unittest.test.testmock.testasync unittest.test.testmock.testcallable unittest.test.testmock.testhelpers unittest.test.testmock.testmagicmethods unittest.test.testmock.testmock unittest.test.testmock.testpatch unittest.test.testmock.testsealable unittest.test.testmock.testsentinel unittest.test.testmock.testwith unittest.test.test_program unittest.test.test_result unittest.test.test_runner unittest.test.test_setups unittest.test.test_skipping unittest.test.test_suite unittest.test._test_warnings unittest.util urllib urllib.error urllib.parse urllib.request urllib.response urllib.robotparser uu _uuid uuid venv venv.__main__ _warnings warnings wave _weakref weakref _weakrefset webbrowser winreg winsound wsgiref wsgiref.handlers wsgiref.headers wsgiref.simple_server wsgiref.util wsgiref.validate xdrlib xml xml.dom xml.dom.domreg xml.dom.expatbuilder xml.dom.minicompat xml.dom.minidom xml.dom.NodeFilter xml.dom.pulldom xml.dom.xmlbuilder xml.etree xml.etree.cElementTree xml.etree.ElementInclude xml.etree.ElementPath xml.etree.ElementTree xml.parsers xml.parsers.expat xml.parsers.expat.errors xml.parsers.expat.model xmlrpc xmlrpc.client xmlrpc.server xml.sax xml.sax._exceptions xml.sax.expatreader xml.sax.handler xml.sax.saxutils xml.sax.xmlreader xxlimited _xxsubinterpreters xxsubtype _xxtestfuzz zipapp zipfile zipimport zlib zoneinfo zoneinfo._common zoneinfo._tzpath zoneinfo._zoneinfo ================================================ FILE: poetry.toml ================================================ [virtualenvs] prefer-active-python = true ================================================ FILE: pyproject.toml ================================================ [project] name = "pipreqs" version = "0.5.0" description = "Pip requirements.txt generator based on imports in project" authors = [ { name = "Vadim Kravcenko", email = "vadim.kravcenko@gmail.com" } ] maintainers = [ {name = "Jonas Eschle", email = "jonas.eschle@gmail.com"} ] license = "Apache-2.0" readme = "README.rst" packages = [{ include = "pipreqs" }] repository = "https://github.com/bndr/pipreqs" keywords = ["pip", "requirements", "imports"] classifiers = [ "Development Status :: 4 - Beta", "Intended Audience :: Developers", "License :: OSI Approved :: Apache Software License", "Natural Language :: English", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] requires-python = ">=3.9, <3.14" dependencies = [ "yarg>=0.1.9", "docopt>=0.6.2", "nbconvert>=7.11.0", "ipython>=8.12.3", ] [project.optional-dependencies] dev = [ "flake8>=6.1.0", "tox>=4.11.3", "coverage>=7.3.2", "sphinx>=7.2.6;python_version>='3.9'", ] [tool.poetry.group.dev.dependencies] # for legacy usage flake8 = "^6.1.0" tox = "^4.11.3" coverage = "^7.3.2" sphinx = { version = "^7.2.6", python = ">=3.9" } [project.scripts] pipreqs = "pipreqs.pipreqs:main" [build-system] requires = ["poetry-core>=2.0.0,<3.0.0"] build-backend = "poetry.core.masonry.api" ================================================ FILE: tests/__init__.py ================================================ # -*- coding: utf-8 -*- ================================================ FILE: tests/_data/empty.txt ================================================ ================================================ FILE: tests/_data/imports.txt ================================================ pandas==2.0.0 numpy>=1.2.3 torch<4.0.0 ================================================ FILE: tests/_data/imports_any_version.txt ================================================ numpy pandas==2.0.0 tensorflow torch<4.0.0 ================================================ FILE: tests/_data/imports_no_version.txt ================================================ pandas tensorflow torch ================================================ FILE: tests/_data/models.py ================================================ ================================================ FILE: tests/_data/test.py ================================================ """unused import""" # pylint: disable=undefined-all-variable, import-error, no-absolute-import, too-few-public-methods, missing-docstring import xml.etree # [unused-import] import xml.sax # [unused-import] import os.path as test # [unused-import] from sys import argv as test2 # [unused-import] from sys import flags # [unused-import] # +1:[unused-import,unused-import] from collections import deque, OrderedDict, Counter # All imports above should be ignored import requests # [unused-import] # setuptools import zipimport # command/easy_install.py # twisted from importlib import invalidate_caches # python/test/test_deprecate.py # astroid import zipimport # manager.py # IPython from importlib.machinery import all_suffixes # core/completerlib.py import importlib # html/notebookapp.py from IPython.utils.importstring import import_item # Many files # pyflakes # test/test_doctests.py from pyflakes.test.test_imports import Test as TestImports # Nose from nose.importer import Importer, add_path, remove_path # loader.py # see issue #88 import analytics import flask_seasurf import atexit from __future__ import print_function from docopt import docopt import curses, logging, sqlite3 import logging import os import sqlite3 import time import sys import signal import bs4 import nonexistendmodule import boto as b, peewee as p # import django import flask.ext.somext # # # from sqlalchemy import model try: import ujson as json except ImportError: import json import models def main(): pass import after_method_is_valid_even_if_not_pep8 ================================================ FILE: tests/_data_clean/test.py ================================================ """unused import""" # pylint: disable=undefined-all-variable, import-error, no-absolute-import, too-few-public-methods, missing-docstring import xml.etree # [unused-import] import xml.sax # [unused-import] import os.path as test # [unused-import] from sys import argv as test2 # [unused-import] from sys import flags # [unused-import] # +1:[unused-import,unused-import] from collections import deque, OrderedDict, Counter # All imports above should be ignored import requests # [unused-import] # setuptools import zipimport # command/easy_install.py # twisted from importlib import invalidate_caches # python/test/test_deprecate.py # astroid import zipimport # manager.py # IPython from importlib.machinery import all_suffixes # core/completerlib.py import importlib # html/notebookapp.py from IPython.utils.importstring import import_item # Many files # pyflakes # test/test_doctests.py from pyflakes.test.test_imports import Test as TestImports # Nose from nose.importer import Importer, add_path, remove_path # loader.py # see issue #88 import analytics import flask_seasurf import atexit from __future__ import print_function from docopt import docopt import curses, logging, sqlite3 import logging import os import sqlite3 import time import sys import signal import bs4 import nonexistendmodule import boto as b, peewee as p # import django import flask.ext.somext # # # # from sqlalchemy import model try: import ujson as json except ImportError: import json import models def main(): pass import after_method_is_valid_even_if_not_pep8 ================================================ FILE: tests/_data_duplicated_deps/db.py ================================================ import pymongo from bson.objectid import ObjectId # 'bson' package is mapped to 'pymongo'. # But running pipreqs should not result in two duplicated # lines 'pymongo==x.x.x'. ================================================ FILE: tests/_data_ignore/.ignore_second/ignored.py ================================================ # Everything in here should be ignored from pattern.web import Twitter, plaintext ================================================ FILE: tests/_data_ignore/.ignored_dir/ignored.py ================================================ # Everything in here should be ignored import click ================================================ FILE: tests/_data_ignore/test.py ================================================ """unused import""" # pylint: disable=undefined-all-variable, import-error, no-absolute-import, too-few-public-methods, missing-docstring import xml.etree # [unused-import] import xml.sax # [unused-import] import os.path as test # [unused-import] from sys import argv as test2 # [unused-import] from sys import flags # [unused-import] # +1:[unused-import,unused-import] from collections import deque, OrderedDict, Counter # All imports above should be ignored import requests # [unused-import] # setuptools import zipimport # command/easy_install.py # twisted from importlib import invalidate_caches # python/test/test_deprecate.py # astroid import zipimport # manager.py # IPython from importlib.machinery import all_suffixes # core/completerlib.py import importlib # html/notebookapp.py from IPython.utils.importstring import import_item # Many files # pyflakes # test/test_doctests.py from pyflakes.test.test_imports import Test as TestImports # Nose from nose.importer import Importer, add_path, remove_path # loader.py import atexit from __future__ import print_function from docopt import docopt import curses, logging, sqlite3 import logging import os import sqlite3 import time import sys import signal import bs4 import nonexistendmodule import boto as b, peewee as p # import django import flask.ext.somext # # # from sqlalchemy import model try: import ujson as json except ImportError: import json import models def main(): pass import after_method_is_valid_even_if_not_pep8 ================================================ FILE: tests/_data_notebook/magic_commands.ipynb ================================================ { "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Magic test" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "%automagic true" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "ls -la\n", "logstate" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "ls -la" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "%automagic false" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "ls -la" ] } ], "metadata": { "language_info": { "name": "python" }, "orig_nbformat": 4 }, "nbformat": 4, "nbformat_minor": 2 } ================================================ FILE: tests/_data_notebook/markdown_test.ipynb ================================================ { "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Markdown test\n", "import sklearn\n", "\n", "```python\n", "import FastAPI\n", "```" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.8.1" } }, "nbformat": 4, "nbformat_minor": 4 } ================================================ FILE: tests/_data_notebook/models.py ================================================ ================================================ FILE: tests/_data_notebook/test.ipynb ================================================ { "cells": [ { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "\"\"\"unused import\"\"\"\n", "# pylint: disable=undefined-all-variable, import-error, no-absolute-import, too-few-public-methods, missing-docstring\n", "import xml.etree # [unused-import]\n", "import xml.sax # [unused-import]\n", "import os.path as test # [unused-import]\n", "from sys import argv as test2 # [unused-import]\n", "from sys import flags # [unused-import]\n", "# +1:[unused-import,unused-import]\n", "from collections import deque, OrderedDict, Counter\n", "# All imports above should be ignored\n", "import requests # [unused-import]\n", "\n", "# setuptools\n", "import zipimport # command/easy_install.py\n", "\n", "# twisted\n", "from importlib import invalidate_caches # python/test/test_deprecate.py\n", "\n", "# astroid\n", "import zipimport # manager.py\n", "# IPython\n", "from importlib.machinery import all_suffixes # core/completerlib.py\n", "import importlib # html/notebookapp.py\n", "\n", "from IPython.utils.importstring import import_item # Many files\n", "\n", "# pyflakes\n", "# test/test_doctests.py\n", "from pyflakes.test.test_imports import Test as TestImports\n", "\n", "# Nose\n", "from nose.importer import Importer, add_path, remove_path # loader.py\n", "\n", "import atexit\n", "from __future__ import print_function\n", "from docopt import docopt\n", "import curses, logging, sqlite3\n", "import logging\n", "import os\n", "import sqlite3\n", "import time\n", "import sys\n", "import signal\n", "import bs4\n", "import nonexistendmodule\n", "import boto as b, peewee as p\n", "# import django\n", "import flask.ext.somext # # #\n", "from sqlalchemy import model" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "try:\n", " import ujson as json\n", "except ImportError:\n", " import json\n", "\n", "import models\n", "\n", "\n", "def main():\n", " pass\n", "\n", "import after_method_is_valid_even_if_not_pep8" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.8.1" } }, "nbformat": 4, "nbformat_minor": 4 } ================================================ FILE: tests/_data_pyw/py.py ================================================ import airflow import numpy airflow numpy ================================================ FILE: tests/_data_pyw/pyw.pyw ================================================ import matplotlib import pandas import tensorflow ================================================ FILE: tests/_invalid_data/invalid.py ================================================ import boto as b, import peewee as p, ================================================ FILE: tests/_invalid_data_notebook/invalid.ipynb ================================================ { "cells": [ { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "cd ." ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.6.4" } }, "nbformat": 4, "nbformat_minor": 4 } ================================================ FILE: tests/test_pipreqs.py ================================================ #!/usr/bin/env python # -*- coding: utf-8 -*- """ test_pipreqs ---------------------------------- Tests for `pipreqs` module. """ from io import StringIO import logging from unittest.mock import patch, Mock import unittest import os import requests import sys import warnings from pipreqs import pipreqs class TestPipreqs(unittest.TestCase): @classmethod def setUpClass(cls): # Disable all logs for not spamming the terminal when running tests. logging.disable(logging.CRITICAL) # Specific warning not covered by the above command: warnings.filterwarnings("ignore", category=DeprecationWarning, module="jupyter_client") cls.modules = [ "flask", "requests", "sqlalchemy", "docopt", "boto", "ipython", "pyflakes", "nose", "analytics", "flask_seasurf", "peewee", "ujson", "nonexistendmodule", "bs4", "after_method_is_valid_even_if_not_pep8", ] cls.modules2 = ["beautifulsoup4"] cls.local = ["docopt", "requests", "nose", "pyflakes", "ipython"] cls.project = os.path.join(os.path.dirname(__file__), "_data") cls.empty_filepath = os.path.join(cls.project, "empty.txt") cls.imports_filepath = os.path.join(cls.project, "imports.txt") cls.imports_no_version_filepath = os.path.join(cls.project, "imports_no_version.txt") cls.imports_any_version_filepath = os.path.join(cls.project, "imports_any_version.txt") cls.non_existent_filepath = os.path.join(cls.project, "non_existent_file.txt") cls.parsed_packages = [ {"name": "pandas", "version": "2.0.0"}, {"name": "numpy", "version": "1.2.3"}, {"name": "torch", "version": "4.0.0"}, ] cls.parsed_packages_no_version = [ {"name": "pandas", "version": None}, {"name": "tensorflow", "version": None}, {"name": "torch", "version": None}, ] cls.parsed_packages_any_version = [ {"name": "numpy", "version": None}, {"name": "pandas", "version": "2.0.0"}, {"name": "tensorflow", "version": None}, {"name": "torch", "version": "4.0.0"}, ] cls.project_clean = os.path.join(os.path.dirname(__file__), "_data_clean") cls.project_invalid = os.path.join(os.path.dirname(__file__), "_invalid_data") cls.project_with_ignore_directory = os.path.join(os.path.dirname(__file__), "_data_ignore") cls.project_with_duplicated_deps = os.path.join(os.path.dirname(__file__), "_data_duplicated_deps") cls.requirements_path = os.path.join(cls.project, "requirements.txt") cls.alt_requirement_path = os.path.join(cls.project, "requirements2.txt") cls.non_existing_filepath = "xpto" cls.project_with_notebooks = os.path.join(os.path.dirname(__file__), "_data_notebook") cls.project_with_invalid_notebooks = os.path.join(os.path.dirname(__file__), "_invalid_data_notebook") cls.python_path_same_imports = os.path.join(os.path.dirname(__file__), "_data/test.py") cls.notebook_path_same_imports = os.path.join(os.path.dirname(__file__), "_data_notebook/test.ipynb") def test_get_all_imports(self): imports = pipreqs.get_all_imports(self.project) self.assertEqual(len(imports), 15) for item in imports: self.assertTrue(item.lower() in self.modules, "Import is missing: " + item) self.assertFalse("time" in imports) self.assertFalse("logging" in imports) self.assertFalse("curses" in imports) self.assertFalse("__future__" in imports) self.assertFalse("django" in imports) self.assertFalse("models" in imports) def test_deduplicate_dependencies(self): imports = pipreqs.get_all_imports(self.project_with_duplicated_deps) pkgs = pipreqs.get_pkg_names(imports) self.assertEqual(len(pkgs), 1) self.assertTrue("pymongo" in pkgs) def test_invalid_python(self): """ Test that invalid python files cannot be imported. """ self.assertRaises(SyntaxError, pipreqs.get_all_imports, self.project_invalid) def test_ignore_errors(self): """ Test that invalid python files do not raise an exception when ignore_errors is True. """ imports = pipreqs.get_all_imports(self.project_invalid, ignore_errors=True) self.assertEqual(len(imports), 0) def test_get_imports_info(self): """ Test to see that the right number of packages were found on PyPI """ imports = pipreqs.get_all_imports(self.project) with_info = pipreqs.get_imports_info(imports) # Should contain 10 items without the "nonexistendmodule" and # "after_method_is_valid_even_if_not_pep8" self.assertEqual(len(with_info), 13) for item in with_info: self.assertTrue( item["name"].lower() in self.modules, "Import item appears to be missing " + item["name"], ) def test_get_pkg_names(self): pkgs = ["jury", "Japan", "camel", "Caroline"] actual_output = pipreqs.get_pkg_names(pkgs) expected_output = ["camel", "Caroline", "Japan", "jury"] self.assertEqual(actual_output, expected_output) def test_get_use_local_only(self): """ Test without checking PyPI, check to see if names of local imports matches what we expect - Note even though pyflakes isn't in requirements.txt, It's added to locals since it is a development dependency for testing """ # should find only docopt and requests imports_with_info = pipreqs.get_import_local(self.modules) for item in imports_with_info: self.assertTrue(item["name"].lower() in self.local) def test_init(self): """ Test that all modules we will test upon are in requirements file """ pipreqs.init( { "": self.project, "--savepath": None, "--print": False, "--use-local": None, "--force": True, "--proxy": None, "--pypi-server": None, "--diff": None, "--clean": None, "--mode": None, } ) assert os.path.exists(self.requirements_path) == 1 with open(self.requirements_path, "r") as f: data = f.read().lower() for item in self.modules[:-3]: self.assertTrue(item.lower() in data) # It should be sorted based on names. data = data.strip().split("\n") self.assertEqual(data, sorted(data)) def test_init_local_only(self): """ Test that items listed in requirements.text are the same as locals expected """ pipreqs.init( { "": self.project, "--savepath": None, "--print": False, "--use-local": True, "--force": True, "--proxy": None, "--pypi-server": None, "--diff": None, "--clean": None, "--mode": None, } ) assert os.path.exists(self.requirements_path) == 1 with open(self.requirements_path, "r") as f: data = f.readlines() for item in data: item = item.strip().split("==") self.assertTrue(item[0].lower() in self.local) def test_init_savepath(self): """ Test that we can save requirements.txt correctly to a different path """ pipreqs.init( { "": self.project, "--savepath": self.alt_requirement_path, "--use-local": None, "--proxy": None, "--pypi-server": None, "--print": False, "--diff": None, "--clean": None, "--mode": None, } ) assert os.path.exists(self.alt_requirement_path) == 1 with open(self.alt_requirement_path, "r") as f: data = f.read().lower() for item in self.modules[:-3]: self.assertTrue(item.lower() in data) for item in self.modules2: self.assertTrue(item.lower() in data) def test_init_overwrite(self): """ Test that if requiremnts.txt exists, it will not be automatically overwritten """ with open(self.requirements_path, "w") as f: f.write("should_not_be_overwritten") pipreqs.init( { "": self.project, "--savepath": None, "--use-local": None, "--force": None, "--proxy": None, "--pypi-server": None, "--print": False, "--diff": None, "--clean": None, "--mode": None, } ) assert os.path.exists(self.requirements_path) == 1 with open(self.requirements_path, "r") as f: data = f.read().lower() self.assertEqual(data, "should_not_be_overwritten") def test_get_import_name_without_alias(self): """ Test that function get_name_without_alias() will work on a string. - Note: This isn't truly needed when pipreqs is walking the AST to find imports """ import_name_with_alias = "requests as R" expected_import_name_without_alias = "requests" import_name_without_aliases = pipreqs.get_name_without_alias(import_name_with_alias) self.assertEqual(import_name_without_aliases, expected_import_name_without_alias) def test_custom_pypi_server(self): """ Test that trying to get a custom pypi sever fails correctly """ self.assertRaises( requests.exceptions.MissingSchema, pipreqs.init, { "": self.project, "--savepath": None, "--print": False, "--use-local": None, "--force": True, "--proxy": None, "--pypi-server": "nonexistent", }, ) def test_ignored_directory(self): """ Test --ignore parameter """ pipreqs.init( { "": self.project_with_ignore_directory, "--savepath": None, "--print": False, "--use-local": None, "--force": True, "--proxy": None, "--pypi-server": None, "--ignore": ".ignored_dir,.ignore_second", "--diff": None, "--clean": None, "--mode": None, } ) with open(os.path.join(self.project_with_ignore_directory, "requirements.txt"), "r") as f: data = f.read().lower() for item in ["click", "getpass"]: self.assertFalse(item.lower() in data) def test_dynamic_version_no_pin_scheme(self): """ Test --mode=no-pin """ pipreqs.init( { "": self.project_with_ignore_directory, "--savepath": None, "--print": False, "--use-local": None, "--force": True, "--proxy": None, "--pypi-server": None, "--diff": None, "--clean": None, "--mode": "no-pin", } ) with open(os.path.join(self.project_with_ignore_directory, "requirements.txt"), "r") as f: data = f.read().lower() for item in ["beautifulsoup4", "boto"]: self.assertTrue(item.lower() in data) def test_dynamic_version_gt_scheme(self): """ Test --mode=gt """ pipreqs.init( { "": self.project_with_ignore_directory, "--savepath": None, "--print": False, "--use-local": None, "--force": True, "--proxy": None, "--pypi-server": None, "--diff": None, "--clean": None, "--mode": "gt", } ) with open(os.path.join(self.project_with_ignore_directory, "requirements.txt"), "r") as f: data = f.readlines() for item in data: symbol = ">=" message = "symbol is not in item" self.assertIn(symbol, item, message) def test_dynamic_version_compat_scheme(self): """ Test --mode=compat """ pipreqs.init( { "": self.project_with_ignore_directory, "--savepath": None, "--print": False, "--use-local": None, "--force": True, "--proxy": None, "--pypi-server": None, "--diff": None, "--clean": None, "--mode": "compat", } ) with open(os.path.join(self.project_with_ignore_directory, "requirements.txt"), "r") as f: data = f.readlines() for item in data: symbol = "~=" message = "symbol is not in item" self.assertIn(symbol, item, message) def test_clean(self): """ Test --clean parameter """ pipreqs.init( { "": self.project, "--savepath": None, "--print": False, "--use-local": None, "--force": True, "--proxy": None, "--pypi-server": None, "--diff": None, "--clean": None, "--mode": None, } ) assert os.path.exists(self.requirements_path) == 1 pipreqs.init( { "": self.project, "--savepath": None, "--print": False, "--use-local": None, "--force": None, "--proxy": None, "--pypi-server": None, "--diff": None, "--clean": self.requirements_path, "--mode": "non-pin", } ) with open(self.requirements_path, "r") as f: data = f.read().lower() for item in self.modules[:-3]: self.assertTrue(item.lower() in data) def test_clean_with_imports_to_clean(self): """ Test --clean parameter when there are imports to clean """ cleaned_module = "sqlalchemy" pipreqs.init( { "": self.project, "--savepath": None, "--print": False, "--use-local": None, "--force": True, "--proxy": None, "--pypi-server": None, "--diff": None, "--clean": None, "--mode": None, } ) assert os.path.exists(self.requirements_path) == 1 pipreqs.init( { "": self.project_clean, "--savepath": None, "--print": False, "--use-local": None, "--force": None, "--proxy": None, "--pypi-server": None, "--diff": None, "--clean": self.requirements_path, "--mode": "non-pin", } ) with open(self.requirements_path, "r") as f: data = f.read().lower() self.assertTrue(cleaned_module not in data) def test_compare_modules(self): test_cases = [ (self.empty_filepath, [], set()), # both empty (self.empty_filepath, self.parsed_packages, set()), # only file empty ( self.imports_filepath, [], set(package["name"] for package in self.parsed_packages), ), # only imports empty (self.imports_filepath, self.parsed_packages, set()), # no difference ( self.imports_filepath, self.parsed_packages[1:], set([self.parsed_packages[0]["name"]]), ), # common case ] for test_case in test_cases: with self.subTest(test_case): filename, imports, expected_modules_not_imported = test_case modules_not_imported = pipreqs.compare_modules(filename, imports) self.assertSetEqual(modules_not_imported, expected_modules_not_imported) def test_output_requirements(self): """ Test --print parameter It should print to stdout the same content as requeriments.txt """ capturedOutput = StringIO() sys.stdout = capturedOutput pipreqs.init( { "": self.project, "--savepath": None, "--print": True, "--use-local": None, "--force": None, "--proxy": None, "--pypi-server": None, "--diff": None, "--clean": None, "--mode": None, } ) pipreqs.init( { "": self.project, "--savepath": None, "--print": False, "--use-local": None, "--force": True, "--proxy": None, "--pypi-server": None, "--diff": None, "--clean": None, "--mode": None, } ) with open(self.requirements_path, "r") as f: file_content = f.read().lower() stdout_content = capturedOutput.getvalue().lower() self.assertTrue(file_content == stdout_content) def test_import_notebooks(self): """ Test the function get_all_imports() using .ipynb file """ self.mock_scan_notebooks() imports = pipreqs.get_all_imports(self.project_with_notebooks) for item in imports: self.assertTrue(item.lower() in self.modules, "Import is missing: " + item) not_desired_imports = ["time", "logging", "curses", "__future__", "django", "models", "FastAPI", "sklearn"] for not_desired_import in not_desired_imports: self.assertFalse( not_desired_import in imports, f"{not_desired_import} was imported, but it should not have been." ) def test_invalid_notebook(self): """ Test that invalid notebook files cannot be imported. """ self.mock_scan_notebooks() self.assertRaises(SyntaxError, pipreqs.get_all_imports, self.project_with_invalid_notebooks) def test_ipynb_2_py(self): """ Test the function ipynb_2_py() which converts .ipynb file to .py format """ python_imports = pipreqs.get_all_imports(self.python_path_same_imports) notebook_imports = pipreqs.get_all_imports(self.notebook_path_same_imports) self.assertEqual(python_imports, notebook_imports) def test_file_ext_is_allowed(self): """ Test the function file_ext_is_allowed() """ self.assertTrue(pipreqs.file_ext_is_allowed("main.py", [".py"])) self.assertTrue(pipreqs.file_ext_is_allowed("main.py", [".py", ".ipynb"])) self.assertFalse(pipreqs.file_ext_is_allowed("main.py", [".ipynb"])) def test_parse_requirements(self): """ Test parse_requirements function """ test_cases = [ (self.empty_filepath, []), # empty file (self.imports_filepath, self.parsed_packages), # imports with versions ( self.imports_no_version_filepath, self.parsed_packages_no_version, ), # imports without versions ( self.imports_any_version_filepath, self.parsed_packages_any_version, ), # imports with and without versions ] for test in test_cases: with self.subTest(test): filename, expected_parsed_requirements = test parsed_requirements = pipreqs.parse_requirements(filename) self.assertListEqual(parsed_requirements, expected_parsed_requirements) @patch("sys.exit") def test_parse_requirements_handles_file_not_found(self, exit_mock): captured_output = StringIO() sys.stdout = captured_output # This assertion is needed, because since "sys.exit" is mocked, the program won't end, # and the code that is after the except block will be run with self.assertRaises(UnboundLocalError): pipreqs.parse_requirements(self.non_existing_filepath) exit_mock.assert_called_once_with(1) printed_text = captured_output.getvalue().strip() sys.stdout = sys.__stdout__ self.assertEqual(printed_text, "File xpto was not found. Please, fix it and run again.") def test_ignore_notebooks(self): """ Test if notebooks are ignored when the scan-notebooks parameter is False """ notebook_requirement_path = os.path.join(self.project_with_notebooks, "requirements.txt") pipreqs.init( { "": self.project_with_notebooks, "--savepath": None, "--use-local": None, "--force": True, "--proxy": None, "--pypi-server": None, "--print": False, "--diff": None, "--clean": None, "--mode": None, "--scan-notebooks": False, } ) assert os.path.exists(notebook_requirement_path) == 1 assert os.path.getsize(notebook_requirement_path) == 1 # file only has a "\n", meaning it's empty def test_pipreqs_get_imports_from_pyw_file(self): pyw_test_dirpath = os.path.join(os.path.dirname(__file__), "_data_pyw") requirements_path = os.path.join(pyw_test_dirpath, "requirements.txt") pipreqs.init( { "": pyw_test_dirpath, "--savepath": None, "--print": False, "--use-local": None, "--force": True, "--proxy": None, "--pypi-server": None, "--diff": None, "--clean": None, "--mode": None, } ) self.assertTrue(os.path.exists(requirements_path)) expected_imports = [ "airflow", "matplotlib", "numpy", "pandas", "tensorflow", ] with open(requirements_path, "r") as f: imports_data = f.read().lower() for _import in expected_imports: self.assertTrue( _import.lower() in imports_data, f"'{_import}' import was expected but not found.", ) os.remove(requirements_path) def mock_scan_notebooks(self): pipreqs.scan_noteboooks = Mock(return_value=True) pipreqs.handle_scan_noteboooks() def tearDown(self): """ Remove requiremnts.txt files that were written """ try: os.remove(self.requirements_path) except OSError: pass try: os.remove(self.alt_requirement_path) except OSError: pass if __name__ == "__main__": unittest.main() ================================================ FILE: tox.ini ================================================ [tox] isolated_build = true envlist = py39, py310, py311, py312, py313, pypy3, flake8 [gh-actions] python = 3.9: py39 3.10: py310 3.11: py311 3.12: py312 3.13: py313 pypy-3.10: pypy3 [testenv] setenv = PYTHONPATH = {toxinidir}:{toxinidir}/pipreqs commands = python -m unittest discover [testenv:flake8] deps = flake8 commands = flake8 pipreqs tests [flake8] exclude = tests/_data/ tests/_data_clean/ tests/_data_duplicated_deps/ tests/_data_ignore/ tests/_invalid_data/ max-line-length = 120