Give things meaningful names, break long functions to short-coded one-purpose methods, etc. Your awesome code is now available for everyone to use — but people are still unaware of your awesome code which is now available to them. Pro tip: You can make your life easier with a Bash script, which will build, check and deploy your package with a single command. And in a second, they’ll be available to the whole world. #2: Read-Me. For example, to install a specific package with pip from PyPI, run: pip allows for installation from multiple sources, and is not limited to installing packages maintained on the PyPI. For example, here’s how to make a request to Spotify (no authentication required): A status code in the 200’s indicates a success. Requests: The requests package is an HTTP library for Python. Share your story, so others will know how much effort you just saved them with your awesome code. Now, we create the two classes for our package. The package is simple, but can dramatically improve your Python experience when handling time-series data. Hands-on real-world examples, research, tutorials, and cutting-edge techniques delivered Monday to Thursday. 6. This widespread usage is enabled, in part, by an extensive standard library that offers a range of facilities designed to enhance the functionality and portability of Python. He has a Masters in Data Science, and continues to experiment with and find novel applications for machine learning algorithms. For example, in Python 3, iterating dictionary keys is done by: This code will successfully run on both Python 2 and 3. Setuptools: As mentioned previously, the packages in this list are not included in the standard distribution of Python. But why am I telling you all this? When placed in the top directory of your package, GitHub uses it as your package “landing-page”, being displayed to visitors as the first thing they see. It builds on the datetime module that is built into Python, and is simple and easy to use. The full list of features can be found here. Pip comes standard with every Python distribution, allowing you to accomplish installs, uninstalls, updates, etc from the command line. This means now it should look like this: You can leave the file empty as a starting point, but it has to be there in order to allow from your_package import module1. You get these 10 packages pre-compiled in a downloadable build! It also integrates a few other Python libraries in order to maximize functionality while still managing to minimize complexity. Another thing I assume is that you’re using some source-control, probably GitHub. For more information, consult our Privacy Policy. Additional examples can be found in the. For this, you’ll have to add a new file named setup.py, and rearrange your files in the following way: The setup file dictates everything Python installer needs to know when installing your package. Pandas: The pandas package introduces a novel data structure, the DataFrame, optimized for tabular, multidimensional, and heterogeneous data. For example, you can use __init__.py to shorten your API. In this article, I’ll highlight my Top 10 packages (all of which can all be found on PyPI), and provide some basic examples of how they’re typically used. I recommend deploying first to the PyPI test domain, so you can verify everything looks as you intended. While Python doesn’t support private methods, the convention is to mark private methods with an underscore prefix: def _private_function(). Docutils is a simple utility package with limited functionality; but necessary, considering the standard Python library does not provide any code with these capabilities. If you belong to the first type, you can skip ahead. To demonstrate interpolation, I first use NumPy to create some data points with an arbitrary function, then compare different interpolation methods: If you take an objective measure of the most popular packages on PyPI by download statistics alone, you’ll get a list of packages that are quite diverse in their functionality. A list of the most popular packages downloaded from the Python Package Index is available here. Pro tip: The code in __init__.py is executed once your package is being imported, and this allows you to do all sorts of cool stuff. You’ll probably want to use a common one like the MIT License or Apache 2.0 License. Read this). For example, to install a specific package with pip from, pip allows for installation from multiple sources, and is not limited to installing packages maintained on the, . The Documentation Utilities project exists to create a set of tools to easily process plaintext documents into more useful file formats such as HTML, XMS, or LaTeX. This is why they’re usually named README.md. It was about Categorical Correlations, and I honestly thought no-one will find it useful. The officially recommended tool to handle this is setuptools. So, first we create a directory named Animals. Be the person that assists other programmers — and let me show you how to accomplish this in just six steps. 9. In contrast, the packages I’ve included in my Top 10 list are useful regardless of your, data analysis, or developing ML-based models, All 10 packages are available on the ActiveState Platform for inclusion in your runtime environment, https://www.youtube.com/watch?v=J-b1WNf6FoU. From now on everyone can install your package using pip install. For more information, the documentation can be found here. If your code is made out of several modules (files), looking like this: You’ll need to add another file, __init__.py to your package in order to make Python interpret the your_package directory as a Python package. It is built on top of urllib3 (another HTTP client for Python), but has a much simpler and more elegant syntax. A list of the most popular packages downloaded from the Python Package Index is available, , pip is the standard way of installing and managing packages in Python. If code provenance is of value to your organization, the ActiveState platform can help lower the time and resources you spend sourcing and building your runtimes. And to concatenate two dataframes together: To perform a simple filtering operation, extracting the row that meets the logical condition: Further examples can be found in the documentation here. Satisfied? The requests package is an HTTP library for Python. It’s dist which we care about now, as it contains the installation files we want to deploy to PyPI. About two years ago I published my very first data-science related blogpost. Do this using: Go to test.pypi.org and check your new library. The first real step into turning your code into a package, is deciding how users should use it — and make it importable. Programmers are divided into two types: the ones which write readable code, and the ones which use variables named x, x1, x2, yx, etc. You’ll need it to upload your new library. Docutils: The Documentation Utilities project exists to create a set of tools to easily process plaintext documents into more useful file formats such as HTML, XMS, or LaTeX. Finally we create an __init__.py file inside the directory, to let Python know that the directory is a package. All 10 packages are available on the ActiveState Platform for inclusion in your runtime environment. How can you let them know? So how does one go about distributing a third-party package? 4. In today’s article, we will discuss Python Packages. 10. 2. Additional examples can be found in the documentation. Using urllib3 alone (or the built-in urllib and urllib2) allows for more customization and deeper control, but also requires more work on the side of the user. A good Read-Me file will have an overview of the package, installation information (such as requirements) and some Quick-Start examples, describing basic usage of your package. SciPy: The SciPy package builds on the NumPy package by providing functions and algorithms critical to scientific computation in technical fields. While this isn’t really required, it is more than recommended.