You probably know that the best way to practice Python is to build it into a daily habit — the same way you get good at anything. Continuing a daily practice is much easier if you learn a little about how habits form. The trick is to do things that enable the same processes that … Read more
Separating tests and source is not hard to do in Python, if you start your source directory at the root of the package structure. This is not hard in principle, but it trips up developers coming from other languages. We review how one popular library does it (which is in line with the pytest docs), … Read more
Python is popular because it is simple to learn and use, with a syntax that makes it as easy to understand as plain English. This ease of use together with highly optimized libraries written in C has made it a favorite in the scientific community, especially for data science and machine learning. Python is not … Read more
A Python package is simply a directory, usually containing Python modules (source files with the .py extension). It frequently will include a special marker file, __init__.py. Packages can easily be created and used locally, and published packages can be installed using pip. Learning to install public packages and create packages locally is not difficult, though … Read more
Yes, it’s true that Python is slower at runtime than some other languages, but it’s fast enough for the tasks for which it is commonly used. Yes, it’s true that Python is slower at runtime than some other languages, but it’s fast enough for the tasks for which it is commonly used. For the most common tasks, the popular libraries use well-optimized C code — but you don’t need to know C to use them. We separate the facts from the myths.
Is Python Free? Yes, it is, Python is free and open source and has been from the beginning. It’s also cross-platform, and works fine on Windows, Linux, and Mac. But the really cool thing about Python is that not only is the language free, many of the tools you will use are free as well. … Read more
Have you ever wondered about how to create a package like the ones you can install into your python environment using tools like pip or pipenv? This article starts with the complete source code plus a how-to guide to publishing a minimal Python package to PyPi. The source is also available on GitHub. Once we … Read more
Pipenv and pip are both excellent tools for installing and managing Python dependencies that are widely adopted and work extremely well.
Learning pip well first is the choice we recommend. Pip is established and widely known, so many teams prefer pip and venv to manage dependencies and virtual environments. Pipenv makes a few things simpler, but for every thing it simplifies, it makes other things more complex than they need to be.