Skip to content

Conversation

@kroenlein
Copy link
Collaborator

GEMD Python PR

Description

This PR migrates the gemd-python repository to take advantage of newer build capabilities and makes it compatible with the uv build tool & venv.

  • It removes the setup.py file and creates a nearly-equivalent pyproject.toml file.
  • It drops the external dependency of importlib_resources, since 3.9 has importlib.resources as a core package with all necessary methods.
  • It drops some convoluted code that was used to modify how the Pint registry object was subclassed depending on Python version
  • It migrates the pytest configuration out of tox.ini.

PR Type:

  • Breaking change (fix or feature that would cause existing functionality to change)
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Maintenance (non-breaking change to assist developers)

Adherence to team decisions

  • I have added tests for 100% coverage
  • I have written Numpy-style docstrings for every method and class.
  • I have communicated the downstream consequences of the PR to others.
  • I have bumped the version in __version__.py

*.cover
.hypothesis/
.pytest_cache/
prof/
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Minor personal annoyance.

Comment on lines 10 to 13
try:
from typing import TypeAlias # Python 3.10+
except ImportError: # pragma nocover
from typing_extensions import TypeAlias # Python 3.9
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is the only residual bit of dependency from the python-dependent subclassing. Removable with 3.10.

# D107: __init__ is self explanatory
# D301: backslash is used in making docstrings for sphinx to parse
# D401: Imperative mood requirement basically gets in the way
ignore = D100,D104,D105,D107,D301,D401
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

flake8 can't pull configuration from pyproject.toml, so it remains here.


[run]
omit = gemd/demo/*
omit = gemd/demo/*
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This can be removed in a follow up. It's required to pass tests common-gh-actions no longer references tox.ini.

build-backend = "setuptools.build_meta"

[tool.setuptools.dynamic]
version = {attr = "gemd.__version__.__version__"}
Copy link
Contributor

Choose a reason for hiding this comment

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

Woah, this is a small but awesome little feature!

Copy link
Contributor

@anoto-moniz anoto-moniz left a comment

Choose a reason for hiding this comment

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

LGTM! I'll use this as a model for CP in the near future.

@kroenlein kroenlein merged commit cfa4c9e into main Oct 2, 2025
38 checks passed
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