Python tutorials

Deploying a Python Flask Example Application Using Heroku

Welcome! Today we’re going to start building a Flask app that calculates word-frequency pairs based on the text from a given URL. This is a full-stack tutorial. Updates: 02/08/2020: Upgraded to Python version 3.8.1, and use python -m venv instead of pyvenv. 03/22/2016: Upgraded to Python version 3.5.1, and added autoenv version 1.0.0. 02/22/2015: Added Python 3 support. Part One: Set up a local development environment and then deploy both a staging and a production environment on Heroku. (current) Part […]

Read more

A Guide to Feature Engineering in NLP

Overview Feature engineering in NLP is understanding the context of the text. In this blog, we will look at some of the common feature engineering in NLP. We will compare the results of a classification task with and without doing feature engineering   Table of Content Introduction NLP task overview List of features with code Implementation Results comparison with and without doing feature engineering Conclusion Introduction   “If 80 percent of our work is data preparation, then ensuring data quality […]

Read more

Build a Python Directory Tree Generator for the Command Line

Creating applications with a user-friendly command-line interface (CLI) is a useful skill for a Python developer. With this skill, you can create tools to automate and speed up tasks in your working environment. In this tutorial, you’ll build a Python directory tree generator tool for your command line. The application will take a directory path as an argument at the command line and display a directory tree diagram on your screen. It’ll also provide other options to tweak the output. […]

Read more

Start Managing Multiple Python Versions With pyenv

Have you ever wanted to contribute to a project that supports multiple versions of Python but aren’t sure how you would easily test all the versions? Are you ever curious about the latest and greatest versions of Python? Maybe you’d like to try out these new features, but you don’t want to worry about messing up your development environment. Luckily, managing multiple versions of Python doesn’t have to be confusing if you use pyenv. This course will provide you with […]

Read more

Start Contributing to Python: Your First Steps

If you want to start contributing to open source, then Python is a great project to start with. You’ll not only be making your mark on one of the biggest projects out there, but you’ll also be doing it as part of a vibrant and welcoming community. Open source projects rely on contributions from volunteers like you to grow and evolve, so you’ll be making a real difference to the future of open source software. On top of that, contributing […]

Read more

The k-Nearest Neighbors (kNN) Algorithm in Python

In this tutorial, you’ll get a thorough introduction to the k-Nearest Neighbors (kNN) algorithm in Python. The kNN algorithm is one of the most famous machine learning algorithms and an absolute must-have in your machine learning toolbox. Python is the go-to programming language for machine learning, so what better way to discover kNN than with Python’s famous packages NumPy and scikit-learn! Below, you’ll explore the kNN algorithm both in theory and in practice. While many tutorials skip the theoretical part […]

Read more

Docker BuildKit: faster builds, new features, and now it’s stable

Building Docker images can be slow, and Docker’s build system is also missing some critical security features, in particular the ability to use build secrets without leaking them. So over the past few years the Docker developers have been working on a new backend for building images, BuildKit. With the release of Docker 20.10 in late 2020, BuildKit is finally marked as stable–and you don’t need to upgrade to use it, you can use it with existing Docker 19.03 installs. […]

Read more

Dying, fast and slow: out-of-memory crashes in Python

A segfaulting program might be the symptom of a bug in C code–or it might be that your process is running out of memory. Crashing is just one symptom of running out of memory. Your process might instead just run very slowly, your computer or VM might freeze, or your process might get silently killed. Sometimes if you’re lucky you might even get a nice traceback, but then again, you might not. So how do you identify out-of-memory problems? With […]

Read more

Speed up pip downloads in Docker with BuildKit’s new caching

Docker uses layer caching to speed up builds, but layer caching isn’t always enough. When you’re rapidly developing your Python application and therefore frequently changing the list of dependencies, you’re going to end up downloading the same packages. Over and over and over again. This is no fun when you depend on small packages. It’s extra no fun when you’re downloading machine learning libraries that take hundreds of megabytes. With the release of a stable Docker BuildKit, Docker now supports […]

Read more

All Pythons are slow, but some are faster than others

Python is not the fastest language around, so any performance boost helps, especially if you’re running at scale. It turns out that depending where you install Python from, its performance can vary quite a bit: choosing the wrong version of Python can cut your speed by 10-20%. Let’s look at some numbers. Comparing builds Python I ran three benchmarks from the pyperformance suite on four different builds of Python 3.9 (code is here): python:3.9-buster, the “official” Python Docker image. Ubuntu […]

Read more
1 122 123 124 125 126 181