Imageomics / pyMorphoSource

Python package to interact with morphosource
MIT License
2 stars 0 forks source link

Automation for pywheel creation #18

Open muratmaga opened 10 months ago

muratmaga commented 10 months ago

For SlicerMorph we need to install the package as a pywheel to make ensure consistency, and version checking (e.g., an upgrade needing to install a new version).

Is it possible to automate pywheel generation, so that when a change is made to the source code, it creates a new wheel and bump ups the minor version. for example the version for the new media commit would be be 1.0.1, so that for the people who installed the SlicerMorph version from last week, the new upgrade can automatically do version check and upgrade the morphosource package if necessary. @johnbradley @oothomas

johnbradley commented 10 months ago

When a new GitHub Release is created an action is setup to run that builds and pushes the python package to PyPI. This is the command we are using to build the package: https://github.com/Imageomics/pyMorphoSource/blob/2091ebdbb4b4313fa590bb4b7acab9a726e55e60/.github/workflows/publish-to-pypi.yml#L25-L30

This command should build the wheel.

If you visit https://pypi.org/project/morphosource/#files you can see details about the files on PyPI:

Screenshot 2023-12-04 at 8 13 38 AM

So I think we are already creating wheels on PyPI.

johnbradley commented 10 months ago

I think this is the line in SlicerMorph that installs this package: https://github.com/SlicerMorph/SlicerMorph/blob/e07b04518760bcdf66072a11fbf2d400f1f677cb/MorphoSourceImport/MorphoSourceImport.py#L121

        slicer.util.pip_install('morphosource==1.0.0')

Perhaps you could use a compatible release clause:

slicer.util.pip_install('morphosource~=1.0')
johnbradley commented 10 months ago

Actually that change wouldn't work due to the surrounding code:

        try:
            import morphosource as ms
            from morphosource import search_media, get_media, DownloadVisibility
            from morphosource.search import SearchResults
            from morphosource.exceptions import MetadataMissingError
            from bs4 import BeautifulSoup
        except ImportError:
            slicer.util.pip_install('morphosource==1.0.0')

So this will only install the morphosource package once no matter the version we specify.

muratmaga commented 10 months ago

So I think we are already creating wheels on PyPI.

But I think the wheel is not being updated or kept in sync with source. You have a commit from December 1st, (media update), but the latest wheel is from November 28th according the pyPI

Or am I looking at the wrong things?

johnbradley commented 10 months ago

We only deploy to PyPI when we create a new GitHub Release: https://github.com/Imageomics/pyMorphoSource/releases. I need to update the version number in the source code and create a GitHub release for the file size changes.

muratmaga commented 10 months ago

Yes, that might be issue. Hopefully once things are settled down, there won't be much of need of constant building.

muratmaga commented 10 months ago

Alternatively, we can request wheels on demand manually. I don't see things changing much after this. We just happened to need a wheel with this particular change.

johnbradley commented 10 months ago

There is now a 1.1.0 release on PyPI.