I was looking for something similar to perl’s Dumper functionality in python. So after googling I found one which serves me well @ https://gist.github.com/1071857#file_dumper.pyamazon
So I downloaded and installed it and it works fine.
But then I came accross PyPI: http://pypi.python.org/pypi which looks like CPAN equivalent for python.
So I searched for the Dumper module there and I could not find it there. I was hoping that this seems like a very basic module and should have been listed in PyPI.
So my question is, if I have to install a python module, then should I search in PyPI first and if i do not find then look other places on google?
OR is there any other Python Module repository apart from PyPI?
I am learning python and hence this question.
thanks.
If you are using pip,
pip search package_namewould help you do the same as searching on the web interface provided by PyPi.Once located, installing a python package is of course as easy as
Some python libraries may be in development stage and may not directly be available on PyPi OR you may want a specific commit has (git) of that library and if you can find that library’s source on
github.comor onbitbucket.comfor example, you can doAnd regarding your question about perl Dumper, perl’s Dumper has two main uses iirc –
As far as I know, there’s no exact equivalent of perl’s Dumper in python.
However, I use
picklefor data persistence.And
pprintis useful for visually inspecting objects/debug.Both of which are standard, built-in modules in Python. There’s no necessity for 3rd party libraries for these functionalities.
If you want to use what is here – https://gist.github.com/1071857#file_dumper.pyamazon.
What you need to do is to copy the code and place it in a local file in your project directory. You can name the file something like
pydumper.py. Or any name you prefer really, but end it with suffix.py.In your project, you can import the functions and classes defined in
pydumper.pyby doingor if you want to be specific (which is preferred. it’s better to be explicit about what you are importing.)
and you can start using the Dumper class in your own code.