Skip to content

Add config to automatically build and publish to PyPI - #16

Merged
mfisher87 merged 30 commits into
continuous-dems:mainfrom
mfisher87:pypi
Jul 10, 2026
Merged

Add config to automatically build and publish to PyPI#16
mfisher87 merged 30 commits into
continuous-dems:mainfrom
mfisher87:pypi

Conversation

@mfisher87

@mfisher87 mfisher87 commented Jul 9, 2026

Copy link
Copy Markdown
Collaborator

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_utils package. I think the conventional way to deliver this is as one package on PyPI.

The blasc2 dependency 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?

@mfisher87
mfisher87 marked this pull request as draft July 9, 2026 02:25
@mfisher87 mfisher87 changed the title Build and publish to PyPI Add config to automatically build and publish to PyPI Jul 9, 2026
@mfisher87
mfisher87 marked this pull request as ready for review July 9, 2026 04:03
Comment thread .github/workflows/publish-to-pypi.yml Fixed
Comment thread src/ivert/__init__.py
@@ -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
Comment thread src/ivert/__init__.py
@@ -0,0 +1,18 @@
import os
Comment thread src/ivert/__init__.py
@@ -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
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 .`.
@mfisher87

mfisher87 commented Jul 10, 2026

Copy link
Copy Markdown
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.

@github-advanced-security github-advanced-security AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pylintpython3 (reported by Codacy) found more than 20 potential problems in the proposed changes. Check the Files changed tab for more details.

Comment thread src/ivert/cli.py
from utils.version import __version__ as ivert_version
except ImportError:
ivert_version = "unknown"
from ivert import __version__ as ivert_version
Comment thread src/ivert/cli.py
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,
Comment thread src/ivert/cli.py
from utils.version import __version__ as ivert_version
except ImportError:
ivert_version = "unknown"
from ivert import __version__ as ivert_version
Comment thread src/ivert/cli.py
from utils.configfile import Config
except ImportError:
from ivert_utils.configfile import Config
from ivert.utils.configfile import Config
Comment thread src/ivert/cli.py
from utils.configfile import Config
except ImportError:
from ivert_utils.configfile import Config
from ivert.utils.configfile import Config
Comment thread src/ivert/cli.py
from utils.configfile import Config
except ImportError:
from ivert_utils.configfile import Config
from ivert.utils.configfile import Config
Comment thread src/ivert/cli.py
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
@mfisher87

Copy link
Copy Markdown
Collaborator Author

I'm going to ask forgiveness instead of permission on this PR, since we want to get it on Conda Forge ASAP.

@mfisher87
mfisher87 merged commit 067c17a into continuous-dems:main Jul 10, 2026
5 of 6 checks passed
@mfisher87
mfisher87 deleted the pypi branch July 10, 2026 08:37
@mmacferrin

Copy link
Copy Markdown
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!

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.

Remove compatibility shim in src/ivert/__init__.py Publish ivert to PyPI

3 participants