On 21/04/20 9:40 AM, elisha hollander wrote:
I have a python library with a function.
This function call some other functions, classes and variable from the
library (and those functions and classes call other ones, etc)...
Can I automatically create a file with all of the dependencies (and nothing
else)?
(Already posted on stack overflow with no answer)

This is a good question (because it is one I often ask myself), but it is difficult to understand exactly what you seek.

- did you write this library
- is it part of the Python Standard Library, from Pypi, from ...
- are you intending to use the library from your own code
- do you want to "package" this library
???



The short answer is, that it should not be necessary to ask! Each Python module, function, etc, should have docstrings 'everywhere' anticipating exactly this sort of question!

If it is code you have 'acquired' from elsewhere, then that's already a suggestion that it might not be suitable for your use!


In the ?good, old days - and with other languages, we used to have tools for 'cross referencing'. Against every identifier, the utility would list each line (NR) of code where it was used.

These days, a decent editor/IDE will do much of that.


You may like to review: https://wiki.python.org/moin/DocumentationTools which mentions the likes of PyDoc which will go through a module and display all of its docstrings. https://docs.python.org/3/library/pydoc.html

The inspect module provides several useful functions to help get information about live objects such as modules, classes, methods, functions, tracebacks, frame objects, and code objects. For example, it can help you examine the contents of a class, retrieve the source code of a method, extract and format the argument list for a function, or get all the information you need to display a detailed traceback. https://docs.python.org/3/library/inspect.html


Let us know if there's an answer here. Alternately, please refine the question giving more, and specific detail...
--
Regards =dn
--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to