Tag Archives: python

How to get pypi statistics about package download

Tweet A while ago, I designed pypiview, a Python package used to fetch the number of downloads for a package hosted on pypi website. It used to work decently but according to pypi itself the values stored are not reliable … Continue reading

Posted in Python | Tagged , , , | Leave a comment

Difference between __repr__ and __str__ in Python

Tweet When implementing a class in Python, you usually implement the __repr__ and __str__ methods. __str__ should print a readable message __repr__ should print a message that is unambigous (e.g. name of an identifier, class name, etc). You can see … Continue reading

Posted in Python | Tagged , | 3 Comments

pytest-cov collects no data on Travis

Tweet I recently switched from nosetests to pytest and pytest-cov for one of my Python project (http://easydev-python.readthedocs.io). Locally, everything seemed to work fine and once on Travis, all tests passed as expected. Yet, before the coverage report, I noticed this … Continue reading

Posted in Python | Tagged , , | 10 Comments

Installing Python2.6 in a virtual environment

Tweet First, install python2.6 executable. see previous post if you have issues when compiling (gcc not found). Make sure you have installed python-dev with apt-get or yum. Then, following the instructions on the same topic but for Python 3 in … Continue reading

Posted in Python, Software development | Tagged , | 2 Comments

Installation of Python 2.6 error fixed

Tweet I wanted to install python2.6 in a virtual environment. The first step was to compile python 2.6 executable from the source code. Once the source are extracted, just type:

If you are lucky, everything is smooth and you … Continue reading

Posted in Python | Tagged , | 10 Comments

New software on pypi: pypiview

Tweet I’ve moved an old code into a new Pypi package and took the opportunity to play around with the badges. The new package called pypiview is now available on pypi. It allows one to easily look at the number … Continue reading

Posted in Software development | Tagged , , | Leave a comment

Python function chmod to change permission

Tweet I naively tried the function chmod from the standard python module called os to change the permission of a file:

Checking in the unix command line (ls -l), I got an unexpected result:

I expected indeed a … Continue reading

Posted in Python | Tagged | 2 Comments

Python : How to flush output of print

Tweet Using the sys module, just type:

Posted in Python | Tagged | Leave a comment

python argparse issues with the help argument (TypeError: %o format: a number is required, not dict)

Tweet Even though Python has a great documentation, once in a while you get stuck on a single problem more than expected. It happenned to me today with the argparse module, which I thought I knew enough to quickly code … Continue reading

Posted in Python | Tagged | 24 Comments

Starting to use Python Pandas library

Tweet Pandas is brilliant. If you are looking to manipulate data in Python, use it. I am refactoring most of my codes with this library. It provides many useful data structures to manipulate data in 2, 3, 4 dimensions and … Continue reading

Posted in Python | Tagged , | Leave a comment