xgcm / xrft

Fourier transforms on xarray data structures
https://xrft.readthedocs.io/en/latest/
MIT License
154 stars 45 forks source link

Switching from versioneer to setuptools-scm #165

Closed roxyboy closed 3 years ago

roxyboy commented 3 years ago

A PR to switch from versioneer to setuptools_scm for managing versions.

fixes #164

rabernat commented 3 years ago

I think you also need to remove this stuff

https://github.com/xgcm/xrft/blob/744209f5f01b5ddd887e6bd5ad5e75d9512bdda8/xrft/__init__.py#L1-L4

plus this file: https://github.com/xgcm/xrft/blob/master/xrft/_version.py

rabernat commented 3 years ago

So you can see from the CI that the version is not getting set right. It's currently showing up as 0.1.dev1+gc81d518.

https://github.com/xgcm/xrft/pull/165/checks?check_run_id=3475121204#step:5:136

rabernat commented 3 years ago

Takaya, are you actually testing this locally? I recommend you get it working locally first, as that can be a lot faster to iterate, and then push you changes. Debugging interactively via CI is hard.

roxyboy commented 3 years ago

Takaya, are you actually testing this locally? I recommend you get it working locally first, as that can be a lot faster to iterate, and then push you changes. Debugging interactively via CI is hard.

@rabernat On my local computer, when I run:

$ python setup.py --version
0.3.2.dev30+g53c53f8.d20210901

so I think it's working locally...? Honestly not sure.

rabernat commented 3 years ago

On my local computer, when I run:

$ python setup.py --version
0.3.2.dev30+g53c53f8.d20210901

so I think it's working locally...?

I think your local copy has leftover files that were not removed cleanly when you did git rm.

To match the dev environment, use the same installation method as the worfklow:

https://github.com/xgcm/xrft/blob/744209f5f01b5ddd887e6bd5ad5e75d9512bdda8/.github/workflows/ci.yaml#L41

roxyboy commented 3 years ago

To match the dev environment, use the same installation method as the worfklow:

https://github.com/xgcm/xrft/blob/744209f5f01b5ddd887e6bd5ad5e75d9512bdda8/.github/workflows/ci.yaml#L41

I ran python -m pip install -e . to see whether that would end up giving the wrong version on my local computer but I still seem to get it working locally :(( :

Installing collected packages: xrft
  Attempting uninstall: xrft
    Found existing installation: xrft 0.3.2.dev18+ga192a27
    Uninstalling xrft-0.3.2.dev18+ga192a27:
      Successfully uninstalled xrft-0.3.2.dev18+ga192a27
  Running setup.py develop for xrft
Successfully installed xrft
(py38) eduroam-114178:xrft uchidatakaya$ pwd
/Users/uchidatakaya/Documents/Python/xrft
(py38) eduroam-114178:xrft uchidatakaya$ python setup.py --version
0.3.2.dev31+g807f0c9
rabernat commented 3 years ago

I think looking at https://github.com/pangeo-forge/pangeo-forge-recipes/blob/master/pyproject.toml would be a good place to start.

I also think I gave a bad suggestion when I told you to remove _version from __init__.py. That is what we do in pangeo-forge-recipes.

https://github.com/pangeo-forge/pangeo-forge-recipes/blob/690594a86d1115efe2ab229d7c46f464396a7110/pangeo_forge_recipes/__init__.py#L1-L4

rabernat commented 3 years ago

@roxyboy - did you see Tom's comments in https://github.com/xgcm/xrft/issues/164#issuecomment-910351533?

roxyboy commented 3 years ago

@roxyboy - did you see Tom's comments in #164 (comment)?

Yes, and I've been trying to copy and paste files that he's edited but I have yet to figure it out :((

rabernat commented 3 years ago

Here are another thread on the same topic: https://github.com/pypa/setuptools_scm/issues/414 It sounds like the core problem is described here: https://github.com/pypa/setuptools_scm/issues/480

From reading that, one fix could be

    steps:
    - uses: actions/checkout@v2
      with:
        fetch-depth: 0
rabernat commented 3 years ago

~I'm going to go out on a limb and ping open-source 🦸 @ocefpaf.~

~Filipe, our package is in a bit of a jam. Versioneer stopped working, so we are trying to upgrade to setuptools_scm. But at this PR illustrates, we can't get it working with our release workflow (version number detected is wrong). So we are stuck, unable to release.~

~Do you have any tips or suggestions to help us get out of this situation? Do you see any problems with the config introduced here?~

Edit: It is actually working! See https://github.com/xgcm/xrft/runs/3569028145?check_suite_focus=true#step:5:128

ocefpaf commented 3 years ago

I really love to be pinged on a packaging issue that get resolved in less than 10 min until I get here :smile:

Shameless plug though I'm keeping a "package skeleton" as an alternative to cookie cutters out there: https://github.com/ioos/ioos-python-package-skeleton

It is supposed to be a copy-n-paste updated references for scientific Python packaging. I'm writing docs on it to make it easier to navigate them.

rabernat commented 3 years ago

Yes we know about the package skeleton. Unfortunately this project predates it.

roxyboy commented 3 years ago

Should we make a new release so that PyPI is up to date?

rabernat commented 3 years ago

Yes, can you try to make the release?

We released 0.3.1 on GitHub, but it didn't work for pypi (thus this PR): https://github.com/xgcm/xrft/releases We can't delete a release, so I would move on to 0.3.2. However, to test things out, let's make a "release candidate"

Use v0.3.2-rc0 for the tag and release title when drafting a new release and check the box that says "This is a pre-release". Let's see if the release workflow works.

rabernat commented 3 years ago

I just ran pip install xrft==0.3.1rc0 and it worked! So I would move forward with the release of 0.3.2.

roxyboy commented 3 years ago

Bravo!! 👯