print "Hello world!"
You now have a project!
Are you done? It depends…
Dependencies and versions can stop your users/readers from being able to run your code. For example: this code written in Python 2.7:
No longer works in Python 3!
File "/var/folders/96/r1yycxlj28958p1cdynhbyzw0000gn/T/Rtmpa0OGSM/chunk-code-b08d2b78904b.txt", line 1
print "Hello world!"
^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print("Hello world!")?
Instead, we write:
How far do you go towards reproducibility?
conda
and declare your dependencies in an environment.yml
file.renv
and package your dependencies in a lockfile.In the next slides we will elaborate on some other options as well, but honestly, just do this.
OK: declare (in your README) how your project works for you.
Better: prepare a file for a package manager:
conda
(python and R): generate an environment.yml
filepip
(python only): generate a requirements.txt
fileenvironment.yml
(for conda)conda
to create an environment populated by specific packages and languages.conda env export -f environment.yml
conda
environments.requirements.txt
(for pip)pip freeze > requirements.txt
pip install -r requirements.txt
renv
Install with:
Activate with:
Update with:
Load the contents of a lockfile with:
pipenv
Follow this brief tutorial to set up pipenv
for your project.
Add basic dependency information to your readme file:
Are you working with Python?
environment.yml
file in root.Are you working with R?
renv
, and initiate it to store the lock file in root.Be sure again to update your git repository:
Workshop Computational Reproducibility