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

Add --version to every entry point #456

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

JAlvarezJarreta
Copy link
Contributor

It turns out Python's argument parser has a quick workaround for this, so it was pretty quick to update all our entry points.

@vsitnik
Copy link
Contributor

vsitnik commented Dec 11, 2024

why not a single entry point instead?

@JAlvarezJarreta
Copy link
Contributor Author

why not a single entry point instead?

I felt this was more the standard approach for every tool we use, even for tool suites such as bcftools. When checking how this should be done for Python libraries, the official answers are either use the python -c "import ..." approach we already have, or get it via pip, and both have their issues, as we know.

It is also only adding two lines of code, and we could even reduce it to one if we move the logic into ensembl.utils. Happy with what the majority decides, as I have no strong feelings for any solution.

Copy link
Member

@ens-LCampbell ens-LCampbell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, thanks Jorge. Tested some entry points too and looks fine !

@ens-LCampbell
Copy link
Member

Side note, is there currently way quick way to list or find all genomio entry points available ? Would it be useful to add such a functionality and a single entry point cmd to list all (+ maybe add current library version as well) ?

@JAlvarezJarreta
Copy link
Contributor Author

JAlvarezJarreta commented Dec 11, 2024

Side note, is there currently way quick way to list or find all genomio entry points available ? Would it be useful to add such a functionality and a single entry point cmd to list all (+ maybe add current library version as well) ?

The only way I can think of is looking at pyproject.toml. After some digging, there is a programmatic way to obtain them in Python:

from importlib.metadata import entry_points
genomio_scripts = [
    script.name for script in entry_points(group='console_scripts') if script.module.startswith("ensembl.io.genomio")
]
print("\n".join(genomio_scripts))

What I have found more frequently is that every entry point has its entry in the documentation. Something we should consider if we want to avoid having the auxiliary script you are mentioning (or have both).

Copy link
Contributor

@Dishalodha Dishalodha left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, a nice way of using version with the parser

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

Successfully merging this pull request may close these issues.

4 participants