-
Notifications
You must be signed in to change notification settings - Fork 297
automate PyPI publishing with GitHub Actions #827
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
Conversation
+ 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
|
@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:
Update: after writing this out, it seems clear to me that we should go with option 2. Do you agree? |
avalentino
left a comment
There was a problem hiding this 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 |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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() | ||
|
|
There was a problem hiding this comment.
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
Description of proposed changes
version: replace version_num with version for easy re-use, and update its usage in
__inti__.pysetup: use sys.path.append() to replace open() to grab version from version.py
add .github/workflows/publish-to-test-pypi.yml:
repo setting: add github secrets from pypi and test-pypi, to support the above action
Reminders