Sharing Python environments is a crucial step in ensuring the reproducibility of your work and making it easy to collaborate with others in your research group. In this MetPy Monday, Unidata helps us understand how to create environment files that let you share your environment with almost no effort!

What is an Environment File?

Environment files contain a description of a programming environment including the language and packages to be installed. It is a lightweight text file formatted in YAML, an easily readable markup language. These files are generally operating system independent and can contain version restrictions on packages.

Why Share Your Python Environment?

Environment files make it easy to setup a copy of your environment. This can be useful for sharing your work with collaborators, others in your research group, and other programmers. It is also handy when your environment becomes damaged or your laptop dies! If you version control the file (which we consider a best practice), you also have a history of the tools used in your research to more easily track down any mysterious reproducibility issues.

Example Environment File

Be sure to watch the video for details on how to create environment files and use them, but here’s an example file that can be a good starting point when creating your own.

name: myenv
  - conda-forge
  - defaults
  - python
  - pip
  - metpy
  - siphon
  - matplotlib
  - pandas
  - xarray
  - pip:
    - cfgrib
John Leeman
Follow me