Add config to automatically build and publish to PyPI - #16
Merged
Conversation
mfisher87
marked this pull request as draft
July 9, 2026 02:25
mfisher87
marked this pull request as ready for review
July 9, 2026 04:03
| @@ -0,0 +1,18 @@ | |||
| import os | |||
| sys.path.append(os.path.join(os.path.dirname(__file__), "..")) | ||
| import s3 | ||
| import ivert.utils.configfile as configfile | ||
| import ivert.s3 as s3 |
| @@ -0,0 +1,7 @@ | |||
| import os | |||
| @@ -0,0 +1,7 @@ | |||
| import os | |||
| @@ -0,0 +1,7 @@ | |||
| import os | |||
| import sys | |||
| @@ -0,0 +1,18 @@ | |||
| import os | |||
| @@ -0,0 +1,18 @@ | |||
| import os | |||
| import sys | |||
| sys.path.append(os.path.join(os.path.dirname(__file__), "..")) | ||
| import s3 | ||
| import ivert.utils.configfile as configfile | ||
| import ivert.s3 as s3 |
| @@ -0,0 +1,7 @@ | |||
| import os | |||
| @@ -0,0 +1,7 @@ | |||
| import os | |||
| import sys | |||
This config assumes the source is at src/ivert, but it's not (yet)
A package in Python is named after the directory it lives in, so the directory should be named `ivert`. Idiomatically, it should live at `src/ivert`.
Resolves error in GHA:
Error: Cannot cache without running install
We no longer build as a setup.py package, so these conditionals are no longer necessary. We should no longer support a "running as script" use case; this will be installed from PyPI or installed as a package in dev mode with `uv sync` or `pip install -e .`.
Collaborator
Author
|
All the alerts above are because we moved this to the new org which has security scanning enabled. We should fix them of course, but that's not for this PR. The pre-commit.ci failure is also because we have pre-commit checks turned on in this org, but not the prior one. |
There was a problem hiding this comment.
Pylintpython3 (reported by Codacy) found more than 20 potential problems in the proposed changes. Check the Files changed tab for more details.
| from utils.version import __version__ as ivert_version | ||
| except ImportError: | ||
| ivert_version = "unknown" | ||
| from ivert import __version__ as ivert_version |
| from utils.version import __version__ as ivert_version | ||
| except ImportError: | ||
| ivert_version = "unknown" | ||
| from ivert import __version__ as ivert_version |
| import ivert.utils.dem_geom as dem_geom | ||
|
|
||
| ivert_config = utils.configfile.Config() | ||
| ivert_config = ivert.utils.configfile.Config() |
|
|
||
| def __init__(self, | ||
| ivert_config: utils.configfile.Config | None = None): | ||
| ivert_config: ivert.utils.configfile.Config | None = None): |
| new_bboxes = [] | ||
| for q_bbox in query_bboxes: | ||
| new_bboxes.extend(utils.cuboid_funcs.subtract_cuboids(q_bbox, e_bbox, bbox_order="axis")) | ||
| new_bboxes.extend(ivert.utils.cuboid_funcs.subtract_cuboids(q_bbox, e_bbox, bbox_order="axis")) |
| import utils.configfile | ||
| my_config = utils.configfile.Config() | ||
| import icesat2.plot_validation_results | ||
| import ivert.utils.configfile |
| my_config = utils.configfile.Config() | ||
| import icesat2.plot_validation_results | ||
| import ivert.utils.configfile | ||
| my_config = ivert.utils.configfile.Config() |
| import icesat2.plot_validation_results | ||
| import ivert.utils.configfile | ||
| my_config = ivert.utils.configfile.Config() | ||
| import ivert.icesat2.plot_validation_results |
| import icesat2.plot_validation_results | ||
| import ivert.utils.configfile | ||
| my_config = ivert.utils.configfile.Config() | ||
| import ivert.icesat2.plot_validation_results |
| else: | ||
|
|
||
| data = icesat2.plot_validation_results.get_data_from_h5_or_list(results_h5_or_list, | ||
| data = ivert.icesat2.plot_validation_results.get_data_from_h5_or_list(results_h5_or_list, |
| from utils.version import __version__ as ivert_version | ||
| except ImportError: | ||
| ivert_version = "unknown" | ||
| from ivert import __version__ as ivert_version |
| from utils.configfile import Config | ||
| except ImportError: | ||
| from ivert_utils.configfile import Config | ||
| from ivert.utils.configfile import Config |
| from utils.configfile import Config | ||
| except ImportError: | ||
| from ivert_utils.configfile import Config | ||
| from ivert.utils.configfile import Config |
| from utils.configfile import Config | ||
| except ImportError: | ||
| from ivert_utils.configfile import Config | ||
| from ivert.utils.configfile import Config |
| from utils.configfile import Config | ||
| except ImportError: | ||
| from ivert_utils.configfile import Config | ||
| from ivert.utils.configfile import Config |
| target_vert_epsg_int = None | ||
| ylabel = "Elevation / depth (m, EGM2008 geoid)" | ||
| if args.vdatum: | ||
| import ivert.vdatum_lookup |
| ylabel = f"Elevation / depth (m, {_get_vdatum_label(target_vert_epsg_int)})" | ||
|
|
||
| # Datum-shift grid cache (use ivert cache if available, else cwd) | ||
| import ivert.utils.configfile |
| import utils.configfile | ||
| my_config = utils.configfile.Config() | ||
| import icesat2.plot_validation_results | ||
| import ivert.utils.configfile |
| import icesat2.plot_validation_results | ||
| import ivert.utils.configfile | ||
| my_config = ivert.utils.configfile.Config() | ||
| import ivert.icesat2.plot_validation_results |
| import icesat2.plot_validation_results | ||
| import ivert.utils.configfile | ||
| my_config = ivert.utils.configfile.Config() | ||
| import ivert.icesat2.plot_validation_results |
Collaborator
Author
|
I'm going to ask forgiveness instead of permission on this PR, since we want to get it on Conda Forge ASAP. |
Collaborator
|
Good call. We can fix whatever issues might need to be cleared up this coming week, but it's on a tight timeline, so getting it on conda forge is good to do immediately. Thank you Matt! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolves #22
Resolves #12 (with a post-merge release)
@mmacferrin
Builds will happen on GitHub releases only. We just need to click the Create a Release button in the right panel. We should be sure to follow semver.org. And start with 0.1.0!
I was able to really simplify the internal imports -- now we can expect this source to always be used as a package, never as a script. The code has been moved into a correctly-named directory so everything should just work as normally now.
I switched to the modern standard build tool, hatchling, and a more conventional automation for populating the package version.
Those two above changes enabled deleting a lot of code.
I removed the concept of an
ivert_utilspackage. I think the conventional way to deliver this is as one package on PyPI.The
blasc2dependency was missing, so I added that.I did some tests locally but there are no automated tests. I'm not sure that I've tested the important code paths. Mike, would you please test this branch?