{ "cells": [ { "cell_type": "markdown", "id": "087ddcc9-1e73-4a91-8294-9cb505f1cc2b", "metadata": {}, "source": [ "# Pip Package Tree Navigation (to replace dying pipdeptree)" ] }, { "cell_type": "markdown", "id": "0575f000-abad-4d03-ab08-7cd62ccf24da", "metadata": {}, "source": [ "## Command line integration" ] }, { "cell_type": "code", "execution_count": 1, "id": "870f6d98-2355-40a9-8c49-267cd12ddaea", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ " pandas==1.4.3 ,\n", " python-dateutil==2.8.2 (>=2.8.1),\n", " six==1.16.0 (>=1.5)\n", " pytz==2022.1 (>=2020.1)\n", " numpy==1.22.4 (>=1.21.0)\n" ] } ], "source": [ "# packages need per pip install pandas, on 2 level of depth\n", "!wppm -p pandas" ] }, { "cell_type": "code", "execution_count": 2, "id": "90676376-a1bb-4a43-80cf-7ab625d56b4c", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ " pandas[test]==1.4.3 ,\n", " python-dateutil==2.8.2 (>=2.8.1),\n", " six==1.16.0 (>=1.5)\n", " pytz==2022.1 (>=2020.1)\n", " numpy==1.22.4 (>=1.21.0)\n", " hypothesis==6.46.9 (>=5.5.3),\n", " attrs==22.1.0 (>=19.2.0)\n", " sortedcontainers==2.4.0 (<3.0.0,>=2.1.0)\n", " pytest==7.1.1 (>=6.0),\n", " attrs==22.1.0 (>=19.2.0)\n", " iniconfig==1.1.1 \n", " packaging==21.3 \n", " pluggy==1.0.0 (<2.0,>=0.12)\n", " py==1.11.0 (>=1.8.2)\n", " tomli==2.0.1 (>=1.0.0)\n", " atomicwrites==1.4.0 (>=1.0)\n", " colorama==0.4.4 \n" ] } ], "source": [ "# packages need per pip install pandas[test], on 2 level of depth\n", "!wppm -p pandas[test]" ] }, { "cell_type": "code", "execution_count": 3, "id": "a16af092-ecde-4442-85c2-c768af1d38c3", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ " pandas[test]==1.4.3 ,\n", " python-dateutil==2.8.2 (>=2.8.1),\n", " six==1.16.0 (>=1.5)\n", " pytz==2022.1 (>=2020.1)\n", " numpy==1.22.4 (>=1.21.0)\n", " hypothesis==6.46.9 (>=5.5.3),\n", " attrs==22.1.0 (>=19.2.0)\n", " sortedcontainers==2.4.0 (<3.0.0,>=2.1.0)\n", " pytest==7.1.1 (>=6.0),\n", " attrs==22.1.0 (>=19.2.0)\n", " iniconfig==1.1.1 \n", " packaging==21.3 ,\n", " pyparsing==2.4.7 (!=3.0.5,>=2.0.2)\n", " pluggy==1.0.0 (<2.0,>=0.12)\n", " py==1.11.0 (>=1.8.2)\n", " tomli==2.0.1 (>=1.0.0)\n", " atomicwrites==1.4.0 (>=1.0)\n", " colorama==0.4.4 \n" ] } ], "source": [ "# packages need per pip install pandas[test], on 9 level of depth\n", "!wppm -l 9 -p pandas[test]" ] }, { "cell_type": "code", "execution_count": 4, "id": "c0007411-d94d-4b91-bf13-f0132ead4306", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ " pytest==7.1.1 ,\n", " nbval==0.9.6 [requires: pytest(>=2.8)]\n" ] } ], "source": [ "# packages needing pytest on 2 level of depth\n", "!wppm -r pytest" ] }, { "cell_type": "code", "execution_count": 5, "id": "86cb5d62-71f8-4c54-9928-702141d6259e", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ " pytest[test]==7.1.1 ,\n", " wheel==0.37.1 [requires: pytest(>=3.0.0)],\n", " validators==0.18.2 [requires: pytest(>=2.2.3)],\n", " tzlocal==4.2 [requires: pytest(>=4.3)],\n", " typer==0.4.2 [requires: pytest>=4.4.0,<5.4.0],\n", " traittypes==0.2.1 [requires: pytest],\n", " traitlets==5.3.0 [requires: pytest],\n", " tinycss2==1.1.1 [requires: pytest],\n", " three-merge==0.1.1 [requires: pytest],\n", " textdistance==4.2.2 [requires: pytest],\n", " sqlite-utils==3.26 [requires: pytest],\n", " sqlite-fts4==1.0.3 [requires: pytest],\n", " spyder==5.4.0.dev0 [requires: pytest(<7.0)],\n", " spyder-kernels==2.3.2 [requires: pytest],\n", " sphinxcontrib-serializinghtml==1.1.5 [requires: pytest],\n", " sphinxcontrib-qthelp==1.0.3 [requires: pytest],\n", " sphinxcontrib-jsmath==1.0.1 [requires: pytest],\n", " sphinxcontrib-htmlhelp==2.0.0 [requires: pytest],\n", " sphinxcontrib-devhelp==1.0.2 [requires: pytest],\n", " sphinxcontrib-applehelp==1.0.2 [requires: pytest],\n", " sphinx==5.0.2 [requires: pytest(>=4.6)],\n", " snuggs==1.4.7 [requires: pytest],\n", " smart-open==5.2.1 [requires: pytest],\n", " shapely==1.8.2 [requires: pytest],\n", " shap==0.40.0 [requires: pytest],\n", " scikit-image==0.19.3 [requires: pytest(>=5.2.0)],\n", " rasterio==1.2.10 [requires: pytest(>=2.8.2)],\n", " qtpy==2.2.0.dev0 [requires: pytest(!=7.0.0,!=7.0.1,>=6)],\n", " qtconsole==5.3.1 [requires: pytest],\n", " qstylizer==0.2.1 [requires: pytest(<7,>=6)],\n", " python-lsp-server==1.5.0 [requires: pytest],\n", " python-lsp-jsonrpc==1.0.0 [requires: pytest],\n", " pyerfa==2.0.0.1 [requires: pytest],\n", " pint==0.19.2 [requires: pytest],\n", " patsy==0.5.2+dev [requires: pytest],\n", " pathy==0.6.2 [requires: pytest],\n", " papermill==2.3.4 [requires: pytest(>=4.1)],\n", " pandas==1.4.3 [requires: pytest(>=6.0)],\n", " octave-kernel==0.34.1 [requires: pytest],\n", " oct2py==5.4.3 [requires: pytest],\n", " notebook==6.4.12 [requires: pytest],\n", " notebook-shim==0.1.0 [requires: pytest],\n", " networkx==2.8.5 [requires: pytest(>=7.1)],\n", " nbval==0.9.6 [requires: pytest(>=2.8)],\n", " nbformat==5.4.0 [requires: pytest],\n", " nbdime==3.1.1 [requires: pytest(>=3.6)],\n", " nbconvert==6.5.0 [requires: pytest],\n", " nbclient==0.6.6 [requires: pytest(>=4.1)],\n", " nbclassic==0.4.3 [requires: pytest],\n", " mpl-scatter-density==0.7 [requires: pytest],\n", " moviepy==1.0.3 [requires: pytest(<4.0,>=3.0.0)],\n", " metakernel==0.28.2 [requires: pytest],\n", " mercantile==1.2.1 [requires: pytest],\n", " jupyterlab==3.4.4 [requires: pytest(>=6.0)],\n", " jupyterlab-launcher==0.13.1 [requires: pytest],\n", " jupyter-server==1.18.1 [requires: pytest(>=6.0)],\n", " jupyter-server-proxy==3.2.1 [requires: pytest],\n", " jupyter-server-mathjax==0.2.6 [requires: pytest],\n", " jupyter-packaging==0.12.2 [requires: pytest],\n", " jupyter-core==4.11.1 [requires: pytest],\n", " jupyter-client==7.3.4 [requires: pytest],\n", " julia==0.5.7 [requires: pytest(>=4.4)],\n", " ipywidgets==7.7.1 [requires: pytest(>=3.6.0)],\n", " imageio==2.19.3 [requires: pytest],\n", " httpie==3.2.1 [requires: pytest],\n", " graphene==3.1 [requires: pytest(<7,>=6)],\n", " gpytorch==1.5.1 [requires: pytest],\n", " flask-restx==0.5.1 [requires: pytest(==5.4.1)],\n", " fiona==1.8.21 [requires: pytest(>=3)],\n", " fastapi==0.79.0 [requires: pytest>=6.2.4,<7.0.0],\n", " fast-histogram==0.11 [requires: pytest],\n", " datasette==0.61.1 [requires: pytest(<7.2.0,>=5.2.2)],\n", " datasette-graphql==2.0.2 [requires: pytest],\n", " dask==2022.8.0 [requires: pytest],\n", " dask-ml==2022.5.27 [requires: pytest],\n", " csvs-to-sqlite==1.3.1a0 [requires: pytest],\n", " cryptography==3.4.7 [requires: pytest(>=6.0)],\n", " botorch==0.4.0 [requires: pytest],\n", " astropy==5.0.4 [requires: pytest(>=7.0)],\n", " asteval==0.9.27 [requires: pytest],\n", " asgi-csrf==0.9 [requires: pytest],\n", " anyio==3.6.1 [requires: pytest(>=7.0)],\n", " affine==2.3.1 [requires: pytest(>=4.6)]\n" ] } ], "source": [ "# packages needing pytest on their [test] install on 1 level of depth\n", "!wppm -l 1 -r pytest[test]" ] }, { "cell_type": "markdown", "id": "16723e98-bb53-493a-aeb9-09583effc60e", "metadata": {}, "source": [ "## Python Code integration" ] }, { "cell_type": "code", "execution_count": 6, "id": "b9d79713-65b0-426a-ae04-91035da246a4", "metadata": {}, "outputs": [], "source": [ "from winpython import piptree" ] }, { "cell_type": "code", "execution_count": 7, "id": "31cca972-407d-4544-9f0b-83008bbdfdd6", "metadata": {}, "outputs": [], "source": [ "pip = piptree.pipdata()" ] }, { "cell_type": "code", "execution_count": 8, "id": "e9033534-1e9d-4966-b202-ff9226b99f55", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ " pandas[test]==1.4.3 ,\n", " python-dateutil==2.8.2 (>=2.8.1),\n", " six==1.16.0 (>=1.5)\n", " pytz==2022.1 (>=2020.1)\n", " numpy==1.22.4 (>=1.21.0)\n", " hypothesis==6.46.9 (>=5.5.3),\n", " attrs==22.1.0 (>=19.2.0)\n", " sortedcontainers==2.4.0 (<3.0.0,>=2.1.0)\n", " pytest==7.1.1 (>=6.0),\n", " attrs==22.1.0 (>=19.2.0)\n", " iniconfig==1.1.1 \n", " packaging==21.3 ,\n", " pyparsing==2.4.7 (!=3.0.5,>=2.0.2)\n", " pluggy==1.0.0 (<2.0,>=0.12)\n", " py==1.11.0 (>=1.8.2)\n", " tomli==2.0.1 (>=1.0.0)\n", " atomicwrites==1.4.0 (>=1.0)\n", " colorama==0.4.4 \n" ] } ], "source": [ "# packages need per pip install pandas[tes, on all level of depth\n", "pip.down('pandas', 'test')" ] }, { "cell_type": "code", "execution_count": 9, "id": "2c04f3cc-5787-44bf-8b73-1253d633c1ee", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "[['pandas[test]==1.4.3 ',\n", " ['python-dateutil==2.8.2 (>=2.8.1)', ['six==1.16.0 (>=1.5)']],\n", " ['pytz==2022.1 (>=2020.1)'],\n", " ['numpy==1.22.4 (>=1.21.0)'],\n", " ['hypothesis==6.46.9 (>=5.5.3)',\n", " ['attrs==22.1.0 (>=19.2.0)'],\n", " ['sortedcontainers==2.4.0 (<3.0.0,>=2.1.0)']],\n", " ['pytest==7.1.1 (>=6.0)',\n", " ['attrs==22.1.0 (>=19.2.0)'],\n", " ['iniconfig==1.1.1 '],\n", " ['packaging==21.3 ', ['pyparsing==2.4.7 (!=3.0.5,>=2.0.2)']],\n", " ['pluggy==1.0.0 (<2.0,>=0.12)'],\n", " ['py==1.11.0 (>=1.8.2)'],\n", " ['tomli==2.0.1 (>=1.0.0)'],\n", " ['atomicwrites==1.4.0 (>=1.0)'],\n", " ['colorama==0.4.4 ']]]]" ] }, "execution_count": 9, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# data version of pipdown\n", "pip._downraw('pandas', 'test')" ] }, { "cell_type": "code", "execution_count": 10, "id": "fc6c77a2-d1f2-477b-9b0e-ba26d344d525", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ " pytest==7.1.1 ,\n", " nbval==0.9.6 [requires: pytest(>=2.8)]\n" ] } ], "source": [ "# packages needing pytest on all level of depth\n", "pip.up('pytest') # collected data for packag" ] }, { "cell_type": "code", "execution_count": 11, "id": "0c851417-cac4-48f0-a2bd-d0733c24dc9a", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "['pytest==7.1.1 ', ['nbval==0.9.6 [requires: pytest(>=2.8)]']]" ] }, "execution_count": 11, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# data version of pipdown\n", "pip._upraw('pytest')" ] }, { "cell_type": "code", "execution_count": 12, "id": "8ff766e4-ba50-4add-b8f7-6b93b84011b4", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "{'name': 'sqlite-bro',\n", " 'version': '0.12.2',\n", " 'summary': 'a graphic SQLite Client in 1 Python file',\n", " 'requires_dist': [],\n", " 'wanted_per': [],\n", " 'description': \"sqlite_bro : a graphic SQLite browser in 1 Python file\\n======================================================\\n\\nsqlite_bro is a tool to browse SQLite databases with \\nany basic python installation.\\n\\n\\nFeatures\\n--------\\n\\n* Tabular browsing of a SQLite database \\n\\n* Import/Export of .csv files with auto-detection\\n\\n* Import/Export of .sql script\\n\\n* Export of database creation .sql script\\n\\n* Support of sql-embedded Python functions\\n\\n* support supports command-line scripting if Python>=3.2 (see sqlite_bro -h), with or without Graphic User Interface\\n\\n* Easy to distribute : 1 Python source file, Python and PyPy3 compatible\\n\\n* Easy to start : just launch sqlite_bro\\n\\n* Easy to learn : Welcome example, minimal interface\\n\\n* Easy to teach : Character size, SQL + SQL result export on a click\\n\\nInstallation\\n------------\\n\\nYou can install, upgrade, uninstall sqlite_bro.py with these commands::\\n\\n $ apt-get install python3-tk # apt-get install python-tk if you are using python2\\n $ pip install sqlite_bro\\n $ pip install --upgrade sqlite_bro\\n $ pip uninstall sqlite_bro\\n\\nor just launch latest version from IPython with %load https://raw.githubusercontent.com/stonebig/sqlite_bro/master/sqlite_bro/sqlite_bro.py\\nor just copy the file 'sqlite_bro.py' to any pc and type 'python sqlite_bro.py'\\n\\nExample usage \\n-------------\\n\\n::\\n\\n $ sqlite_bro\\n\\n::\\n\\n $ sqlite_bro -h\\n \\nScreenshots\\n-----------\\n\\n.. image:: https://raw.githubusercontent.com/stonebig/sqlite_bro/master/docs/sqlite_bro.GIF\\n\\n.. image:: https://raw.githubusercontent.com/stonebig/sqlite_bro/master/docs/sqlite_bro_command_line.GIF\\n\\n\\nLinks\\n-----\\n\\n* `Fork me on GitHub `_\\n\\n\\n\"}" ] }, "execution_count": 12, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# data details of 'sqlite-bro' package\n", "pip.distro['sqlite-bro']" ] }, { "cell_type": "code", "execution_count": 13, "id": "bbdaf35b-ead5-4064-84e8-086a9985385a", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\n", "IPython provides a rich toolkit to help you make the most out of using Python\n", "interactively. Its main components are:\n", "\n", "* A powerful interactive Python shell\n", "* A `Jupyter `_ kernel to work with Python code in Jupyter\n", " notebooks and other interactive frontends.\n", "\n", "The enhanced interactive Python shells have the following main features:\n", "\n", "* Comprehensive object introspection.\n", "\n", "* Input history, persistent across sessions.\n", "\n", "* Caching of output results during a session with automatically generated\n", " references.\n", "\n", "* Extensible tab completion, with support by default for completion of python\n", " variables and keywords, filenames and function keywords.\n", "\n", "* Extensible system of 'magic' commands for controlling the environment and\n", " performing many tasks related either to IPython or the operating system.\n", "\n", "* A rich configuration system with easy switching between different setups\n", " (simpler than changing $PYTHONSTARTUP environment variables every time).\n", "\n", "* Session logging and reloading.\n", "\n", "* Extensible syntax processing for special purpose situations.\n", "\n", "* Access to the system shell with user-extensible alias system.\n", "\n", "* Easily embeddable in other Python programs and GUIs.\n", "\n", "* Integrated access to the pdb debugger and the Python profiler.\n", "\n", "The latest development version is always available from IPython's `GitHub\n", "site `_.\n", "\n", "\n", "\n" ] } ], "source": [ "# description of ipythonpackage \n", "pip.description('ipython')" ] }, { "cell_type": "code", "execution_count": 14, "id": "f9f82e29-1d66-40b5-aa09-080aac253a33", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "adodbapi 2.6.1.3\n", "affine 2.3.1\n", "aiofiles 0.8.0\n", "aiohttp 3.8.1\n", "aiosignal 1.2.0\n", "aiosqlite 0.17.0\n", "alabaster 0.7.12\n", "alembic 1.8.0\n", "algopy 0.5.7\n", "altair 4.2.0\n", "altair-data-server 0.4.1\n", "altair-transform 0.2.0\n", "altair-widgets 0.2.2\n", "amply 0.1.5\n", "aniso8601 9.0.1\n", "ansiwrap 0.8.4\n", "anyio 3.6.1\n", "appdirs 1.4.4\n", "argon2-cffi 21.3.0\n", "argon2-cffi-bindings 21.2.0\n", "arrow 1.2.2\n", "asciitree 0.3.3\n", "asgi-csrf 0.9\n", "asgiref 3.5.2\n", "asn1crypto 1.4.0\n", "asteval 0.9.27\n", "astor 0.8.1\n", "astroid 2.11.5\n", "astroml 1.0.2.post1\n", "astropy 5.0.4\n", "async-generator 1.10\n", "async-timeout 4.0.2\n", "atomicwrites 1.4.0\n", "attrs 22.1.0\n", "autopep8 1.6.0\n", "babel 2.10.3\n", "backcall 0.2.0\n", "backports-abc 0.5\n", "baresql 0.7.6\n", "base58 2.1.1\n", "bcrypt 3.2.0\n", "beautifulsoup4 4.11.1\n" ] } ], "source": [ "# equivalent of pip list datas, limited to 42 first packages \n", "for p in pip.pip_list()[:42]:\n", " print(*p)" ] }, { "cell_type": "code", "execution_count": null, "id": "d8a800aa-72fa-497c-abb8-28c5bee1bf76", "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 3 (ipykernel)", "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.10.6" } }, "nbformat": 4, "nbformat_minor": 5 }