curl -LsSf https://astral.sh/uv/install.sh | sh
uv venv --python 3.11
uv init
uv add 'pandas==1.5.3'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?
OK: declare (in your README) how your project works for you.
Better: prepare a file for an environment manager:
requirements.txtenvironment.ymlpyproject.tomluv (for Python)
pyproject.tomlconda (for Python and R)
environment.ymlconda environments.renv (for R)
Install with:
Activate with:
Update with:
Load the contents of a lockfile with:
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