How to set up your Python environment with a single command

Python Environment Creation
As a Python developer, you’ve undoubtedly had to create your own development environment as a rite of passage when you initially started at a new company. More commonly, you’ve probably had to create a new dev environment for each project you’ve worked on, whether that’s within your own company, participating in an open source project, or just fooling around with some code you found on GitHub. 

Unfortunately, despite working in a high tech environment we often rely on the lowest-tech solution for creating the dev environment for our projects, namely the humble and forever-out-of-date Readme, which inevitably leads to:

  • Errors setting up your environment, which take time away from other team members to help you troubleshoot.
  • Building an environment that works for you, but differs from that of the rest of the team, leading to “works on my machine” issues.
  • Hoping to work on a weekend project, but spending all your time just getting the environment set up.

And even after finally getting your environment working, the ‘Readme’ rarely gets updated, perpetuating the problem.

This post discusses some of the ways to simplify dev environment setup (along with their pros and cons) so developers can spend more time focusing on coding rather than managing their environment.

Lessening The Pain of Python Project Setup

There are a number of workarounds and solutions that have evolved to replace the Readme over the years and help eliminate the frustration of environment setup, including:

  • Creating a requirements.txt, pipfile.lock, or similar configuration file that can help ensure consistent environment reproducibility.
    • Unfortunately, unless you also specify transitive dependencies (i.e., dependencies of dependencies) in the configuration file as well as OS dependencies they may shift over the years, invalidating the environment.
  • Create a container that provides a standard development environment for all users. 
    • Unfortunately, this really just kicks the can down the road since you still need to ensure that the environment gets built with the correct set of dependencies/ transitive dependencies every time the container is built.
  • Create a Virtual Machine (VM) that contains not only the development environment but also the application, as well. 
    • This is a good way to ensure that everything will work out of the box in perpetuity, but VMs tend to be too large to easily distribute, and are really only appropriate for a finished product rather than one under development.

While these solutions go a long way to eliminating user error and ensuring environment reproducibility, they all have their drawbacks. Luckily, there’s a better way.

The ActiveState Platform Automates Python Environment Setup

One of the key benefits of the ActiveState Platform is its shared environment approach to ensuring all members of a team are working in a consistent, reproducible way. Developers can create a single source of truth for their project’s runtime environment on the ActiveState Platform, and then share it with team members via a simple link. 

Moreover, if you use GitHub as your code repository, new team members will be able to install both the environment and your application code on their local system with a single command. See how it works:

The tradition of new team members spending days creating their dev environment is over. And if you’re an open source developer, using the ActiveState Platform to create your runtime environment/link your GitHub repo means contributors can spend more time coding and less time wrestling with environment setup.

Next steps:

The capabilities shown here are also available as a managed service, freeing up your developers to focus on coding and getting your product to market faster. Learn more about our Managed Builds service.

Contact Sales

Continue reading:

Recent Posts

Webinar - Securing Python and Open Source Ecosystems
Securing Python and Open Source Ecosystems

Dustin Ingram, Fellow at the Python Software Foundation (PSF), joins us to discuss trust and security for PyPI and other repositories in light of recent supply chain attacks, and steps being taken to secure the open source ecosystem.

Read More
Scroll to Top