Skip to content
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

auto version #2925

Merged
merged 1 commit into from
Mar 31, 2023
Merged

auto version #2925

merged 1 commit into from
Mar 31, 2023

Conversation

jmmshn
Copy link
Contributor

@jmmshn jmmshn commented Mar 30, 2023

Allow proper versioning for forked repos

I'm not 100% sure how the current version numbering is updated for pymatgen but it's not able to update the number properly for forks. The forks seem to keep a much older version number (from before the forking)
This creates problems if you have the forked repo as a dependency in a requirement.txt file.

This should fix that issue.

@shyuep
Copy link
Member

shyuep commented Mar 30, 2023

I think forks just need to merge from the main master branch for versioning to be correct? The versions are updated when the release happens.

@jmmshn
Copy link
Contributor Author

jmmshn commented Mar 30, 2023

So merging from the upstream master did no work.
The following setting in the pyproject.toml breaks because the setuptools thinks the pymatgen version is too old despite merging from upstream.

dependencies = [
  'pymatgen@git+https://github.com/jmmshn/pymatgen#egg=master',
  'jobflow@git+https://github.com/jmmshn/jobflow@main#egg=main',
  'atomate2@git+https://github.com/jmmshn/atomate2@main#egg=main'
]

Without pymatgen, the other two codes required the tag to be pushed up to the forked repo to resolve dependencies properly.

@shyuep
Copy link
Member

shyuep commented Mar 31, 2023

I am not sure how the pyproject fixes this problem? You need to pull from origin/master for the version to be updated.

@jmmshn
Copy link
Contributor Author

jmmshn commented Mar 31, 2023

So the problem was that if I forked master in 2022, and keep pulling from materialsproject/master, I still get a version name 2022...post370+gff40e46 even when I have the most up-to-date code. This is usually not a problem if you just clone all the repos and install the newest code in edit mode.

However, if you have that branch as a dependency, it will cause pip resolve issues since the version number/name is wrong despite the code being correct.
So if I have the following three dependencies in a repo and would like to install them on some system, I could not do that

dependencies = [
  'pymatgen@git+https://github.com/jmmshn/pymatgen#egg=master',
  'jobflow@git+https://github.com/jmmshn/jobflow@main#egg=main',
  'atomate2@git+https://github.com/jmmshn/atomate2@main#egg=main'
]

This morning all three branches were up-to-date in code but not in tags. For jobflow and atomate2 simply pushing the new tags to origin fixed the problem because they had this stanza in their respective pyproject.toml but pymatgen did not, so I still cannot install these three branches. After putting this stanza in and pushing the recently released tag to origin, it looks like the versioning is permanently changed for all commits past the release tag and now I'm able to install all three packages.

@jmmshn
Copy link
Contributor Author

jmmshn commented Mar 31, 2023

This is a pretty niche issue since most people aren't doing production runs while changing multiple packages.
However, I think the setup of automatically pulling from the git tags for version information is generally useful and takes care of edge cases like mine.

@shyuep shyuep merged commit a6fd4e6 into materialsproject:master Mar 31, 2023
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.

2 participants