{ "info": { "author": "Gabriel Reis", "author_email": "gabrielcnr@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7" ], "description": "# python-ls\nA better replacement for Python's built-in `dir` function with searching in mind.\n\nSometimes when you're developing using Python's interactive shell, or IPython, or working with a Jupyter Notebook or even debugging using pdb, you find yourself having to navigate through complex object structures. If you're not entirely familiar with the class in hand you usually have two options: resort to the documentation of the libraries and projects you're working with, or put the explorer's hat on and go down a trial-and-error route, using Python's builtin `dir` function to see which attributes and functions an object may have and then take a good guess on the next object you will be inspecting.\n\nThere must be a better way, right?\n\nWell, now yes, you have `ls` to help you with that task. If you have rough idea of what you're looking for, you can search for that \"thing\" by name (fingers crossed here: hopefully the developers of the APIs/libraries you're dealing with were careful enough about their naming conventions). Even if (often) your target object may be a few levels deep down the object structure.\n\n`ls` goes recursively through your object structure, it tries to visit attributes searching for the name you're looking for. It also considers dictionary keys if it stumbles across dictionaries, and in the end it prints out the matching occurrences and tells you their types too.\n\n```python\n>>> ls(ls, 'code', depth=3)\nfunc_code code\nfunc_code.co_code str 200\nfunc_code.co_code.decode() builtin_function_or_method\nfunc_code.co_code.encode() builtin_function_or_method\nfunc_code.co_filename.decode() builtin_function_or_method\nfunc_code.co_filename.encode() builtin_function_or_method\nfunc_code.co_lnotab.decode() builtin_function_or_method\nfunc_code.co_lnotab.encode() builtin_function_or_method\nfunc_code.co_name.decode() builtin_function_or_method\nfunc_code.co_name.encode() builtin_function_or_method\nfunc_globals['xdir'].func_code code\nfunc_globals['iter_ls'].func_code code\n```\n\n# Install\n\n`pip install python-ls`\n\n# `ls` available as builtin\n\n`python-ls` will inject the `ls` function in the `__builtin__` namespace at installation step.\n\nIt does this by using a `.pth` file which simply performs that injection.\n\n# Security\n\nIf you're running this against objects that have properties, lazy attributes or any other dynamic code, keep in mind that `ls` will try to fetch the value of the property/lazy attribute using `getattr()`. This will cause the body of the function to be executed, so you can imagine already the potential hazard here, right?\n\n**TODO: make a default `unsafe=False` kwarg and then only visit properties if `unsafe` is explicitly set to `True`.**\n\n# About the name `ls`\n\nPython has `dir` as a builtin. The equivalent of that command-line command in GNU/Linux world is `ls`. We had considered calling it `xdir`, which by the way is a function that works like `dir()` by returning a list of occurrences to you.\n\n# Contribute!\n\nPlease send your issues, bug reports and, even more welcome, your Pull Requests ;-)\n\nEnjoy!\n\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://github.com/gabrielcnr/python-ls", "keywords": "python dir ls search attributes", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "python-ls", "package_url": "https://pypi.org/project/python-ls/", "platform": "", "project_url": "https://pypi.org/project/python-ls/", "project_urls": { "Homepage": "http://github.com/gabrielcnr/python-ls" }, "release_url": "https://pypi.org/project/python-ls/0.1.5/", "requires_dist": null, "requires_python": "", "summary": "A better replacement for Python dir() builtin function", "version": "0.1.5" }, "last_serial": 4120727, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "2acb9ab4ee558227ed2e225cbb3b40d0", "sha256": "77b23e9fe87b29c7d88f21bb2a6e44a69c7e8e4c0e13d25fa1e1ec72026db1e1" }, "downloads": -1, "filename": "python_ls-0.1.0-py3-none-any.whl", "has_sig": false, "md5_digest": "2acb9ab4ee558227ed2e225cbb3b40d0", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 7531, "upload_time": "2018-07-26T22:21:01", "url": "https://files.pythonhosted.org/packages/da/b1/0c47513b8b10cfcd076d7a9cb44a722d8497d3d49f967d6503140a1589a7/python_ls-0.1.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "6e599a84e1857a84a0e9f523dc3d4188", "sha256": "c3197782ebc78c43726f0a5be6277a9919cb5c3639cf75ff76c26ca32a466a42" }, "downloads": -1, "filename": "python-ls-0.1.0.tar.gz", "has_sig": false, "md5_digest": "6e599a84e1857a84a0e9f523dc3d4188", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5774, "upload_time": "2018-07-26T22:21:02", "url": "https://files.pythonhosted.org/packages/60/9c/91626329fb77f30e059e0e9e1def9c76e4dea66996d7341f880544551d0a/python-ls-0.1.0.tar.gz" } ], "0.1.5": [ { "comment_text": "", "digests": { "md5": "7bd6a94c01a44bb3c6d16f486b46a6a3", "sha256": "321f2003fa8caa892cbc45fcbce4be8d1531fa5df8c7389fa1679ae56451deea" }, "downloads": -1, "filename": "python_ls-0.1.5-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "7bd6a94c01a44bb3c6d16f486b46a6a3", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 5424, "upload_time": "2018-07-31T15:24:44", "url": "https://files.pythonhosted.org/packages/ff/e6/741dc18e7eef8f3490499fe3f27dfe3035e5da38803841676864d8772cc4/python_ls-0.1.5-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "0ac1a6f6be8ea297babbe27dd4c54bf9", "sha256": "0df7b757db041e2cd50bebf2f3bb8403d72b0dc4d0fa36beeee216eb6231d1a2" }, "downloads": -1, "filename": "python-ls-0.1.5.tar.gz", "has_sig": false, "md5_digest": "0ac1a6f6be8ea297babbe27dd4c54bf9", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7030, "upload_time": "2018-07-31T15:24:45", "url": "https://files.pythonhosted.org/packages/45/79/301ce42fdc7ca19802c1a307d726cedf7bf42e74915397d0919eea02d33c/python-ls-0.1.5.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "7bd6a94c01a44bb3c6d16f486b46a6a3", "sha256": "321f2003fa8caa892cbc45fcbce4be8d1531fa5df8c7389fa1679ae56451deea" }, "downloads": -1, "filename": "python_ls-0.1.5-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "7bd6a94c01a44bb3c6d16f486b46a6a3", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 5424, "upload_time": "2018-07-31T15:24:44", "url": "https://files.pythonhosted.org/packages/ff/e6/741dc18e7eef8f3490499fe3f27dfe3035e5da38803841676864d8772cc4/python_ls-0.1.5-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "0ac1a6f6be8ea297babbe27dd4c54bf9", "sha256": "0df7b757db041e2cd50bebf2f3bb8403d72b0dc4d0fa36beeee216eb6231d1a2" }, "downloads": -1, "filename": "python-ls-0.1.5.tar.gz", "has_sig": false, "md5_digest": "0ac1a6f6be8ea297babbe27dd4c54bf9", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7030, "upload_time": "2018-07-31T15:24:45", "url": "https://files.pythonhosted.org/packages/45/79/301ce42fdc7ca19802c1a307d726cedf7bf42e74915397d0919eea02d33c/python-ls-0.1.5.tar.gz" } ] }