Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@yunjunz
Copy link
Member

@yunjunz yunjunz commented Aug 11, 2022

Description of proposed changes

  • version: replace version_num with version for easy re-use, and update its usage in __inti__.py

  • setup: use sys.path.append() to replace open() to grab version from version.py

  • add .github/workflows/publish-to-test-pypi.yml:

    • triggered for push event on main branch
    • run only if repo owner is insarlab or yunjunz, due to the limited access to the PyPI token
    • use "pip install" and "python -m build" to build the binary wheel and source tarball
    • use pypa/gh-action-pypi-publish action to push to PyPI and TestPyPI
    • enable skip_existing for TestPyPI to avoid frequent existing errors
    • push to PyPI only for released version and when owner is insarlab
  • repo setting: add github secrets from pypi and test-pypi, to support the above action

Reminders

  • Pass Codacy code review (green)
  • Pass Circle CI test (green)
  • Make sure that your code follows our style. Use the other functions/files as a basis.
  • If adding new functionality, add a detailed description to the documentation and/or an example.

+ version: replace version_num with version for easy re-use, and update its usage in __inti__.py

+ setup: use sys.path.append() to replace open() to grab version from version.py

+ add .github/workflows/publish-to-test-pypi.yml:
   - triggered for push event on main branch
   - run only if repo owner is insarlab or yunjunz
   - use "pip install" and "python -m build" to build the binary wheel and source tarball
   - use pypa/gh-action-pypi-publish action to push to PyPI and TestPyPI
   - enable skip_existing for TestPyPI to avoid frequent existing errors
   - push to PyPI only for released version and when owner is insarlab

+ repo setting: add github secrets from pypi, to support the above action

+ load_data.py: bugfix when empty file path found, introduced in load iono stack PR 780, reported in the user forum
@yunjunz
Copy link
Member Author

yunjunz commented Aug 11, 2022

@jhkennedy and @avalentino could you take a look at this PR when you got a chance? I appreciate any feedback. The auto-publishing is triggered only after the PR is merged, so it's not shown here, you could check the github action output here on my fork.

There is an open choice that I am not sure about:

  1. run this workflow on both insarlab and yunjunz; and enable skip_existing to TestPyPI to avoid the existing error. This is needed while I was working on this PR.
  2. run this workflow on insarlab only; and disable skip_existing to TestPyPI, to allow for loud failing report, as suggested in https://github.com/pypa/gh-action-pypi-publish#tolerating-release-package-file-duplicates

Update: after writing this out, it seems clear to me that we should go with option 2. Do you agree?

Copy link
Member

@avalentino avalentino left a comment

Choose a reason for hiding this comment

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

LGTM

# Grab version and description from version.py
# link: https://stackoverflow.com/questions/53648900
sys.path.append(os.path.dirname(__file__))
from mintpy.version import version, description
Copy link
Member

Choose a reason for hiding this comment

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

Instead of using this trick you could move to a setup.cfg based system (https://setuptools.pypa.io/en/latest/userguide/declarative_config.html), which is declarative and cleaner IMHO.

Copy link
Collaborator

Choose a reason for hiding this comment

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

setuptools_scm also handles all the versioning work being done here implicitly. Only caveat is you need to make sure the git tags have also been fetched at package build time

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks, setup.cfg makes all the sense! I will try to convert it in another PR.

# Grab long_description from README.md
with open("docs/README.md", "r") as f:
long_description = f.read()

Copy link
Member

Choose a reason for hiding this comment

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

setup.cfg would help also i this case

@yunjunz yunjunz merged commit 47bb7f6 into insarlab:main Aug 12, 2022
@yunjunz yunjunz deleted the pypi branch August 12, 2022 18:12
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.

3 participants