Closed robcaulk closed 3 months ago
First all of thank you very much @robcaulk for your great observations! Sometimes when you're too deep into your projects, you don't see the really obvious things anymore!
I hope the updates detailed below have fixed all the mentioned issues, but please let me know if there are still some problems!
examples
" that could be locally installed with for example the command poetry install --with examples
. But thanks to your comments, I realised that I should have used extras
dependencies that are installable from everywhere instead of group
dependencies that are only installable locally. In any case, I really want to have matplotlib outside the necessary requirements of PyCVI.basic_usage.py
could be run from the package root by running python -m examples.basic_usage
, assuming that the user had downloaded the whole package repository). This was more convenient for me at the beginning, but now that you point at it, it is indeed a terrible design choice when used in a documentation. The idea was also that I really didn't want to pollute the example scripts with plot functions (hence the relative import of the utils.py
file).Create an "example
" extra set of dependencies that contain the necessary dependencies to run the example scripts. This extra set of dependency can be installed by running:
# using poetry
poetry add pycvi-lib[examples]
# using pip or anaconda
pip install pycvi-lib[examples]
Switch from a module-based type of example scripts to scripts that follow what a user would actually do, that is:
examples
or after manually installing the package related to the specific example (e.g. matplotlib and/or sklearn-extra)Specify on the README page as well as on the welcome page of the documentation that there are extra steps to follow to be able to run the example script on your computer.
Specify very clearly in each page of the documentation showcasing an example to carefully follow the instructions in order to run the scripts on their own computers. That is, it is necessary to:
examples
for all examplesFix the dependency issues between the examples
extra dependency group and the rest of the packages in the case of python 3.11 (and check more carefully with other versions as well, use different version constraints for different python versions.) Matplotlib 3.9 was the main culprit, but other dependencies have been checked as well.
Released a new version of PyCVI and of the documentation (0.1.2).
Hello,
I am one of the reviewers on the JOSS review for this repository https://github.com/openjournals/joss-reviews/issues/6841.
Following the pip installation instructions located in the docs https://pycvi.readthedocs.io/en/latest/index.html, the examples are not runnable. I copy pasted the example (https://pycvi.readthedocs.io/en/latest/examples/basic_usage.html) into a script, but could see that it would not work. It doesn't work because you have a raw import on the
import ..utils plot_true_selected
function, which is not part of your pypi package since it is not located within thepyci
folder.In any case, ok, forget the pypi install method, I tried to clone the repo and test, and still ran into some issues:
The current (wrong) solution would be to copy paste utils.py into the
basic_example
directory. But generally speaking, if this utils.py is integral for users to learn your code, you should include it in your package so that it can be imported as necessary.Then we run into the next issue, which is that matplotlib is not installed.
Is matplotlib an "extra" that is not a dependency for this library? If it is not required, but integral for users to learn your code, it would be preferable to at least add this as a doc string to the example scripts. But more likely you would add this to your pypi package
pip install pycvi-lib[plot]
After
pip install matplotlib
, I run into:My matplotlib version seems to fit into your pyproject.toml requirements
And the python version version that I am using is 3.11, which also fits into your pyproject.toml specification.