EllipticPlusPlus icon indicating copy to clipboard operation
EllipticPlusPlus copied to clipboard

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

Open bdklahn opened this issue 1 year ago • 0 comments

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.

bdklahn avatar Aug 28 '24 22:08 bdklahn