Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Description: |Build Status| |Coverage Status|
pystructure
===========
A tiny tool to help reading source code with showing structure of python
source code
Why
===
I use PyCharm as my python IDE, and sometimes I can use ``structure``
navigation view to check code structure easily, like below:
.. figure:: https://github.com/hanks/pystructure/blob/master/docs/images/pycharm-structure.jpg?raw=true
:alt: structure
structure
It is useful when you read some open source codes, and for me, I like to
write memo for code structure down in my note, but you can not copy the
structure information to text from PyCharm, so I create this tool to
help me easily to output text version of structure of python code.
Installation
============
``pip install pystructure``
Usage
=====
::
> pystructure
Usage:
pystructure.py SRC_PATH [-o FILE | --output=FILE]
::
> pystructure pystructure.py
v __VERSION__
c PYSymbol(object)
v GLOBAL_VAR
v FUNCTION
v CLASS
v METHOD
v ATTRIBUTE
v PRIVATE_METHOD
c PYStructureVisitor(object)
v PREFIX
v LITERAL_VALUE_PREFIX
f __init__(self)
f visit(self, node_list)
f visit_Assign(self, node)
f visit_ClassDef(self, node)
f visit_FunctionDef(self, node)
f visit_literal_Num(self, node)
f visit_literal_Name(self, node)
f visit_literal_Str(self, node)
f visit_literal_List(self, node)
f visit_literal_Tuple(self, node)
f visit_literal_Dict(self, node)
f _get_visit_result(self, node, prefix="PREFIX")
f _get_literal_value_list(self, node_list)
f _build_func_signature(self, func_name, args_list, default_list, kwarg, vararg)
f method_dict(self)
c StructureParser(object)
f __init__(self)
f accept(self, visitor)
f load(self, src)
f export(self)
f _format_structure(self, root, level=0, output=None)
f main()
Implementation
==============
- ast - Build-in python library, to do static analytic for the source
code
- docopt - A great tool to help to create beautiful CLI for you
Contribution
============
1. Fork the repository on GitHub.
2. Make a branch off of master and commit your changes to it.
3. Run the tests with tox
- Either use tox to build against all supported Python versions (if you
have them installed) or use tox -e py{version} to test against a
specific version, e.g., tox -e py27 or tox -e py33.
4. Submit a Pull Request to the master branch on GitHub.
If you’d like to have a development environment for ``pystructure``, you
should create a virtualenv and then do ``pip install -e .`` from within
the directory.
Lisence
=======
MIT Lisence
.. |Build Status| image:: https://travis-ci.org/hanks/pystructure.svg?branch=master
:target: https://travis-ci.org/hanks/pystructure
.. |Coverage Status| image:: https://coveralls.io/repos/github/hanks/pystructure/badge.svg?branch=master
:target: https://coveralls.io/github/hanks/pystructure?branch=master
Keywords: pystructure structure ast
Platform: UNKNOWN
Classifier: Topic :: Utilities
Classifier: Development Status :: 5 - Production/Stable
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 2
Classifier: Programming Language :: Python :: 2.6
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.3
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
Metadata
Release files for pystructure 1.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pystructure-1.1.0.tar.gz | 6.6 kB | Without provenance | Details for pystructure-1.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pystructure-1.1.0-py2.py3-none-any.whl | Python 2, Python 3 | none | any | Details for pystructure-1.1.0-py2.py3-none-any.whl |
Total release size: 15.7 kB
Release files / pystructure-1.1.0.tar.gz
| Download URL | pystructure-1.1.0.tar.gz |
|---|---|
| Size | 6.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4a7cfa84cd634fc56f7727e44434dac014bf2231c6c3917c8ae905d897dae39e
|
|
BLAKE2b-256 checksum How to use checksums |
8098e91bf580f99f11f39aece6e35392e159fd084281e6e17ca257b4eb48f43b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / pystructure-1.1.0-py2.py3-none-any.whl
| Download URL | pystructure-1.1.0-py2.py3-none-any.whl |
|---|---|
| Size | 9.1 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
0a4d12eca1dc0a5c4157ecb5c18ed5f86c27d349df76c8eeea213d7987271298
|
|
BLAKE2b-256 checksum How to use checksums |
931a563c2707e3f8eeca7b86da39d7e3189b666543871f7d887468154ef765ab
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for pystructure 1.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.