HERA-Team / hera_pspec

HERA power spectrum estimation code and data formats
http://hera-pspec.readthedocs.io/en/latest/
BSD 3-Clause "New" or "Revised" License
5 stars 3 forks source link

Pypi release #358

Closed steven-murray closed 2 years ago

steven-murray commented 2 years ago

This PR gets hera_pspec for a PyPI release, by doing the following:

acliu commented 2 years ago

Quick thing...looks like some hidden files got committed by accident? In a .vscode directory, so I assume you must use vscode on your local machine.

steven-murray commented 2 years ago

Ah dang.

steven-murray commented 2 years ago

@acliu OK I removed those files.

nkern commented 2 years ago

the removal of version.py will probably break backwards compat, just fyi b/c our pipeline uses version to automatically print out the git / version info when we perform an analysis step in our pipeline. the easy thing to do is to keep version.py but just have it call utils.history_string() but still eliminate versioning from it and let scm handle it.

I know there are benefits to moving to setuptools_SCM, but tbh I never really got totally comfortable with it (maybe this will force me to). Can you give a brief explanation here for how we can easily duplicate what hera_pspec.version.print_version_info() is doing (from within a python interpreter)?

thanks ! :)

steven-murray commented 2 years ago

@nkern thanks for the heads up. I'm ok with adding the version.py back in just to have the call to utils.history_string -- hera_cal had a similar issue (@jsdillon opted to rip off the bandaid and just force updating all the notebooks that use this). I could also add a warning into the function in version.py with some kind of deprecation period, if you prefer.

So, with setuptools_scm the version is exclusively based on the git tag (so there's no file you need to update with the version in it). Other than reducing redundancy in terms of defining the version, it has the advantage that exact git info is folded into the version string itself as necessary. So, to get the version (in an interpreter) you'd just do from hera_pspec import __version__; print(__version__).

When your installed library is exactly on a commit that has an associated version tag, this will simply print eg. "v1.2.3". However, if you've made three commits since that v1.2.3 tag, it will print eg. "v.1.2.4.dev3+HASH". Since it includes the hash, you can always get back to the exact commit that produced it (similar to your print_version_info). Obviously if no hash is printed, you can simply go to the exact tag, which is just as good.

Is that a comprehensive-enough explanation?

nkern commented 2 years ago

hi @steven-murray that makes sense, thanks for the explanation! I hope it also helps us in the future if we need a refresher on this. this looks good to me otherwise!