-
-
Notifications
You must be signed in to change notification settings - Fork 214
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
Add pre-commit hook to update editable install versions #642
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like the idea but wonder how to correctly integrate it with pep-620 as that will not support the in worktree Metadata one could update
I'm not sure what you mean by integrate it with pep-620, that seems to be dealing with the c api. I figured out that post-commit lets you configure arguments to pass to its entry. Using this I was able to make it so you can configure the build command that is run so you can change it from the default of "python setup.py egg_info". See the updated README.rst for details. I am curious if there is a newer way to build the egg_info than calling setup.py? That is how all of our pip packages are setup and from what I can tell setup.py is still required to support editable installs, but I haven't done much research on that yet. Btw, it took me a while to figure out how to easily test uncommitted pre-commit hook plugin changes. I use this command in the directory of my test pip package. I have my working copy of setuptools_scm next to the test pip repo. It doesn't work with the custom args in .pre-commit-config.yaml though. pre-commit try-repo ../setuptools_scm --verbose --hook-stage post-commit |
Apologies, there is a different pep for editable installs using wheels, once it is widespread, updating local egg info is likely not going to be enough Im currently down with a cold and might Nedd until next weekend to get back at this |
No problem, hope you feel better. I'm guessing you were talking about pep-660, and wanting to support removing setup.py. By letting the hook config specify the build command in I've spent the extra time cleaning up and finishing code so the pull request is ready for a full review now. I've cleaned up my prototype code, updated the readme and created tests. Let me know what you think when you get a chance to look at it. |
Have you gotten a chance to look this over? |
i managed to take a initial look i am under the impression this should register virtual envronments that have been used as install target, and decide based on build backend the classical setuptools one just needs to regen the egg info modern pakcages need a pip install -e for PEP660 |
5f83bdc
to
c7791f4
Compare
Ok, I've made it create a virtualenv and do a full I'm creating a virtualenv named I rebased and squashed all of the previous code into the |
i think there has been a misunderstanding, creating a setuptools_scm specific virtualenv to do the updates in is pretty much not going to help the users who have their own, potentially numerous virtualenvs that each need updates |
i believe some coordination with pip will be necessary |
Ok I did some more reading and I think I understand what you mean. PEP 660 requires putting the So, the only way to update the version for all of the editable installs the way I want is to somehow be able to find all of a users's virtualenv and system installs and run a editable install. If that's the case, I really don't like that, it makes this so much more complicated and slow. My first thought is that when doing an editable install we would add that path to a file in the source repo and the hook would process each path, and have to deal with also updating the system pythons. I'm not a fan of this. I'm not sure if uninstalling a editable package would allow us to automatically remove that path from the file and I'm sure there are other ways that could be broken, so we would have to add checks for if its currently editability installed for a given path. |
closing as infeasible or this library as of now - build backends for the editable wheels need to provide the hooks |
This adds a pre-commit hook to setuptools_scm that will automatically update the .egg-info for a setuptools_scm enabled project. It uses the newer post-commit, post-merge, post-checkout, post-rewrite hooks that pre-commit supports.
This MR is working for me, but still needs some work before it would be ready to merge into setuptools_scm. I'm providing this MR as a proof of concept and to ask if its something that can/should be added to setuptools_scm, or if I should make my own package.
I have a few TODO's that will need looked into:
console_scripts
entry_point
instead of using__main__.py
? Iepython -m setuptools_scm post-commit
__main__.py
or the console_script.