Mobility fitting#19
Merged
nury12n merged 57 commits intoJun 5, 2026
Merged
Conversation
added 15 commits
February 23, 2024 15:46
added 11 commits
February 21, 2025 16:55
…espei.paramselect.generate_parameters instead of going through espei script
added 22 commits
June 2, 2026 15:08
bocklund
added a commit
to PhasesResearchLab/ESPEI
that referenced
this pull request
Jun 3, 2026
When installing ESPEI from a git source using package managers, e.g. ```shell pip install git+https://github.com/phasesresearchlab/espei.git@master ``` or entirely from a fresh env using `uv`: ```shell uv init --bare uv add "espei @ git+https://github.com/phasesresearchlab/espei.git@master" ``` the code can successfully install, but give errors like this when you try to use it: ```python Traceback (most recent call last): File "<python-input-0>", line 1, in <module> import espei File "/Users/bocklund1/src/test/.venv/lib/python3.13/site-packages/espei/__init__.py", line 10, in <module> __version__ = get_version(root='..', relative_to=__file__) File "/Users/bocklund1/src/test/.venv/lib/python3.13/site-packages/setuptools_scm/_get_version.py", line 56, in get_version return _get_version_public( root=root, ...<17 lines>... scm=scm, ) File "/Users/bocklund1/src/test/.venv/lib/python3.13/site-packages/vcs_versioning/_get_version_impl.py", line 257, in get_version _version_missing(config) ~~~~~~~~~~~~~~~~^^^^^^^^ File "/Users/bocklund1/src/test/.venv/lib/python3.13/site-packages/vcs_versioning/_get_version_impl.py", line 207, in _version_missing raise LookupError(error_msg) LookupError: setuptools-scm was unable to detect version for /Users/bocklund1/src/test/.venv/lib/python3.13/site-packages. Make sure you're either building from a fully intact git repository or PyPI tarballs. Most other sources (such as GitHub's tarballs, a git checkout without the .git folder) don't contain the necessary metadata and will not work. For example, if you're using pip, instead of https://github.com/user/proj/archive/master.zip use git+https://github.com/user/proj.git#egg=proj Alternatively, set the version with the environment variable SETUPTOOLS_SCM_PRETEND_VERSION_FOR_${NORMALIZED_DIST_NAME} as described in https://setuptools-scm.readthedocs.io/en/latest/config/ ``` Looking at ```python # espei/__init__.py try: from ._dev import get_version # We have a local (editable) installation and can get the version based on the # source control management system at the project root. __version__ = get_version(root='..', relative_to=__file__) del get_version except ImportError: # Fall back on the metadata of the installed package from importlib.metadata import version __version__ = version("espei") del version ``` There current behavior of `__init__.py` expects one of the following cases: 1. Installing from a release version that has a sdist/bdist where `MANIFEST.in` does `prune espei/_dev` and therefore `._dev` doesn't exist and we hit the `ImportError` fallback to `importlib.metadata` 2. For working from the git source checkout, you have full git history and `get_version` from `setuptools_scm` detects the git tag and can set the versions correctly. However, when installing on one of the failure modes above, you get an in between case where a) you get all the files, which includes `_dev/__init__.py`, and b) you don't get the full git repo with the full git version history and thus you don't get the `ImportError`, but you have `setuptools_scm.get_version` raise a `LookupError` when it fails. This PR catches that `LookupError` and falls back onto the `importlib.metadata` version which does work on installs using the `git+` mechanism above on `pip` and `uv`. It also adds a new GitHub Action file for doing smoke tests, where in this case we add a single test that installing ESPEI to a bare repo and then importing works. This should fix issues in getting CI working in downstream packages like here: materialsgenomefoundation/kawin#19
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.
This adds a number of features to generate and assess mobility models
Main changes
FittingStepandModelFittingDescriptionfor each element, so the user doesn't have to create the fitting steps themselvesMobilityTemplateobject where user can create a custom mobility model, add parameters and insert model into an existing TDBOther changes
TODO