BiaPyX / BiaPy

Open source Python library for building bioimage analysis pipelines
https://BiaPyX.github.io
MIT License
123 stars 28 forks source link

running biapy after pip install #73

Closed pr4deepr closed 4 months ago

pr4deepr commented 6 months ago

Hi Great package and I love the modularity of it as well as the ease of getting it up and running.

So, I've followed the isntructions to pip install Biapy. Now, when I want to run the training via command line, it looks like I can only run it via

python -u main.py ?

You can make it executable by adding the entry under project.scripts . https://packaging.python.org/en/latest/guides/writing-pyproject-toml/#creating-executable-scripts

This way, we wouldn't need to clone the repo again to run biapy even after pip install.

Cheers Pradeep

danifranco commented 6 months ago

Hi,

Thank you so much for your suggestion. You can also run it by importing and calling BiaPy through python code, which I understand is the goal of the link you provided (tell me if I'm wrong and if there is any other advantage on doing what you suggested). For instance, you can use BiaPy also like below:

from biapy import BiaPy
biapy = BiaPy('/content/config.yaml', result_dir=output_path, name="name", run_id=1, gpu=0)
biapy.run_job()

Actually, that way of running BiaPy is the one used in the notebooks we provide.

Cheers,

pr4deepr commented 6 months ago

Hi

Thanks, I should have been clear. The goal is to run it from the command line and not from a notebook.

With pip install, once the package is installed there is no easy way to run from command line directly. As you mention 'command line' in the documentation, the expectation would be the ability to call BiaPy from the terminal directly.

For example instead of

python main.py --config

this would

look like

biapy --config

Also, if I have to clone the git repository directly, then there is no point in a pip install. The other advantage is users will run the most stable release (pip) if we can call from command line.

For example, I ran a pip install and still had to clone the GitHub repo to run BiaPy in the command line and then ran into this issue: https://github.com/BiaPyX/BiaPy/issues/74

Moreover, this will make it easier for users to run BiaPy, and share environments too.

Cheers Pradeep

danifranco commented 6 months ago

Hi,

I understand that you want to run BiaPy through command line. I suggested executing it through a Python script as this approach doesn't necessitate cloning the repository after installation via pip (which is your concern). Also, when installing it with pip and using the way I described the user will be using the newest stable release. That option is also integrable in any external code that want to use BiaPy.

We didn't have the need of creating a binary to run it but, if you will be more comfortable having that option, I will have that in mind and do/test it as soon as possible.

Thank you so much for your interest improving the library!

pr4deepr commented 6 months ago

@danifranco Thanks for the reply.

Btw, I'm in no means trying to be pushy. I just thought it was a standard thing to do for running software via CLI, hence my request.

Is editing the project.toml file to call BiaPy directly the same as creating a binary? I just want to make sure I'm using the right terminology here.

I'll execute it from a script directly using the code you've suggested. , as that pretty much does what I want.

Thanks for your help and appreciate the effort in maintaining this software.

Cheers Pradeep

danifranco commented 5 months ago

Hello again,

Once we can have your double check that percentile norm is working (as discussed in forum.sc thread) I will create a new version of BiaPy (3.3.16) and hopefully have the binary as your suggestion in this issue. I added in the last commit changes to generate it: hope I did it correctly 🤞 .

Cheers,

danifranco commented 5 months ago

Just pushed the biapy package in PyPI creating the binary to run it through the CLI as you were proposing.

Feel free to close the issue or I will do it in a few weeks.

Cheers,