Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Please make example notebooks reproducible by including top level dependencies with versions. #5

Open
bdklahn opened this issue Aug 28, 2024 · 0 comments

Comments

@bdklahn
Copy link

bdklahn commented Aug 28, 2024

Thanks for sharing notebooks with example code!

I tried to run a notebook in Colab. But after hitting the second import dependency error, I gave up. One issue is that it looks like the environment you used had Python 3.8.4, while the latest Colab seems to default to 3.10. Thus library versions probably end up pulling in versions no longer compatible with the calls in your code.

Short of creating a full package with a pyproject.toml file, there are many many ways (reinventions) Python developers have mitigated it's dependency resolution issues, over the years.

A simple way to help users get an isolated environment with both the right Python version as well as pypi-available packages is to create a conda env file which uses pip to install the python stuff. Just including the Python version, with pinned versions of the top level dependencies should be enough. Think: import statements of libraries not included in the Python standard library of the version you're using.

I've created a starter one here:
https://github.com/bdklahn/EllipticPlusPlus/blob/reproducible/environment.yml

If you let me know your working dep versions, I can fill that out and create a PR. But it might also be just as simple for you to copy that file in the working dir of your main branch, fill it out, then push.

A way to fill in the versions is to start in an environment where you've got things working. Then import those top level libraries.
Then inspect the current version from the __version__ attribute.

E.g.

ipython
Python 3.11.9 | packaged by conda-forge | (main, Apr 19 2024, 18:34:54) [Clang 16.0.6 ]
Type 'copyright', 'credits' or 'license' for more information
IPython 8.25.0 -- An enhanced Interactive Python. Type '?' for help.

In [1]: import pandas

In [2]: pandas.__version__
Out[2]: '2.2.2'

With a conda env file, users can simply . . .
conda env create -f environment.yml

Colab is a nice web-based way for users to get a testing interface. But it is inherently not really designed to support reproducibility. Even if users don't use conda, at least the Python and library versions of things are clearly documented in such a conda env file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant