... | ... | @@ -112,14 +112,27 @@ The `tags` section of this YAML file is important as it tells the Gitlab CI infr |
|
|
|
|
|
### Creating the `environment.yml` file
|
|
|
|
|
|
In order to ensure that the user of your source code can **exactly** reproduce your published experimental results, you want to ensure that they are working in the **same environment.** This means that the user should be working with the same versions of all the Python/Bob packages and package dependencies that you used when running your experiments. An easy way to achieve this is to **freeze** your working environment into an `environment.yml` file, from which the user can then re-create the same working environment. To do this, execute the following commands in your terminal, replacing `bob.paper.isba2018_entropy` with the name of your project and `bob.paper.isba2018_entropy.env` with the name of your conda environment:
|
|
|
In order to ensure that the user of your source code can **exactly** reproduce your published experimental results, you want to ensure that they are working in the **same environment.** This means that the user should be working with the same versions of all the Python/Bob packages and package dependencies that you used when running your experiments. An easy way to achieve this is to **freeze** your working environment into an `environment.yml` file, from which the user can then re-create the same working environment.
|
|
|
|
|
|
Before we look at how to freeze a working environment, let's first consider how we would initially create the environment in which we wish to work. Environment creation is based on conda and can vary depending on which packages you need. For example, the `bob.paper.isba2018_entropy.env` environment for the `bob.paper.isba2018_entropy` paper package was created by executing the following command in the terminal:
|
|
|
|
|
|
```sh
|
|
|
$ conda create -n bob.paper.isba2018_entropy.env --override-channels -c https://www.idiap.ch/software/bob/conda -c defaults python=2.7 bob-extras=2017.10.22 zc.buildout sphinx coverage nose
|
|
|
```
|
|
|
To work in this environment, you must then navigate to your working directory and activate the environment. Using the `bob.paper.isba2018_entropy` paper package as an example once again, this would be done by executing the following commands in your terminal:
|
|
|
|
|
|
```sh
|
|
|
$ cd bob.paper.isba2018_entropy
|
|
|
$ source activate bob.paper.isba2018_entropy.env
|
|
|
```
|
|
|
|
|
|
At this point, you are ready to freeze your environment with the following command:
|
|
|
|
|
|
```sh
|
|
|
$ conda env export > environment.yml
|
|
|
```
|
|
|
Now, open at your `environment.yml` file. If it contains `zc.buildout`, remove the corresponding version number so that, if we decide to upgrade the version, the user can still do `buildout` in their re-created environment. You can also feel free to remove any packages in `environment.yml` that you know **for sure** are not needed by your paper package (if you are not sure, it's best not to remove anything). Finally, remove the "prefix" section of your `environment.yml` file, since the user of your package does not need to know the path to your working directory (anyway, their path will be different).
|
|
|
|
|
|
Now, open at your `environment.yml` file. If it contains `zc.buildout`, remove the corresponding version number so that, if the version is upgraded at a later point, the user can still do `buildout` in their re-created environment. You can also feel free to remove any packages in `environment.yml` that you know **for sure** are not needed by your paper package (if you are not sure, it's best not to remove anything). Finally, remove the "prefix" section of your `environment.yml` file, since the user of your package does not need to know the path to your working directory (anyway, their path will be different).
|
|
|
|
|
|
And that's it! All you need to do now is to include `environment.yml` in your `MANIFEST.in` file to make sure that your environment file is packaged along with your source code (when creating a PyPI package).
|
|
|
|
... | ... | |