feat: make all the python scripts available again in standard pip install #957
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request also standardizes the script argument parsing and invocation setup.
In more detail, for automatically installing the scripts, this pull request does the following:
clisubmodules under both theskgenome(withskg_convert.py) andcnvlib(all the other python scripts) modules, both with empty__init__.pyfiles.[tool.setuptools]in thepyproject.toml, also list those new submodules as"cnvlib.cli"and"skgenome.cli". I just did this by analogy to the existing entries and because otherwise theclimodules would not be found in the installation. Not sure if this is the correct / best way?[project.scripts]in thepyproject.toml, create anentry_pointfor each of the scripts.Further, the pull reqiest does the following to standardize the scripts:
argument_parsing()function that takes no arguments.argsproduced by theargument_parsing()function as input.main()function that does not take any arguments.if __name__ == '__main__':(so when calling this as a script), they just call themain()function.With this new structure, any functions used in these scripts could be reused in other code parts by importing them from the newly created modules. I guess this is unlikely, but now it has a consistent structure for it.
I tested each of the scripts after a pip-based installation, and they all properly run with
--help. Also, for all of the scripts (exceptcnv_expression_correlate.py) I quickly found some example data in thetest/folder or from my projects, and can confirm that they run through from such an installation. So I think that all the importing updates are also correct.If there is some further testing infrastructure for the scripts that I have missed, please let me know. And code reviews and more testing from others is of course also welcome!
Also, I might pursue adding this pull request as a patch to the bioconda recipe until this is merged and released. Because what I am really aiming for here is to have the script installation automatable via conda for a standardized snakemake workflow.