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

pre-commit hook reinstalls poetry, fails, and aborts. No commits possible. #24

Open
maphew opened this issue Feb 9, 2023 · 4 comments

Comments

@maphew
Copy link
Contributor

maphew commented Feb 9, 2023

...something in that recipe[*] is seriously at odds with my system. Now every commit tries to reinstall poetry, invoke, etc., then encounters a compatbility error and aborts. I'll follow up with a seperate issue after I've had a chance to try and understand what's going on.

Originally posted by @maphew in #22 (comment)

@maphew
Copy link
Contributor Author

maphew commented Feb 9, 2023

I figured out what happened to me. What follows is information for anyone else who happen fall into the same crack; there's no need for this issue to remain open once it's been read.

Host: Windows 10. Pelican python environment managed by conda. Compressed from many sessions over several weeks, the setup resembled:

winget install miniconda3
conda create -n pelican
conda activate pelican
conda install python
pip install pelican
# install m.css: https://mcss.mosra.cz/themes/pelican/#first-steps-with-pelican
# install old https://..../getpelican/pelican-plugins/search
# uninstall pelican-plugins/search
pip install pelican-search

Begin hacking to get pelican-search working (see my Stork posts).
Get Stork working, discover issue with quotes-in-titles #20.
Devise some code fixes, fork pelican-plugins/search, create a branch and pull request.
Make some rookie code formatting mistakes and have PR blocked by sanity checks.
Follow recommended guidelines for setting up plugin development environment within my conda pelican environment, and...

...and all hell breaks loose. Suddenly I'm preventing from making any commits at all on my local machine. On every commit attempt the pre-commit git hook starts re-installing poetry, invoke, and a bunch of dependencies. This takes about a minute; inside I'm cringing at the extra bandwidth consumption. Some kind of problem is encountered, all the installs are rolled back, and the commit is aborted. I'm dead in the water, totally blocked.


So what is going on??
Note this additional detail to the above recipe, the last two lines:

conda activate pelican
conda install python
pip install pelican
pip install pelican-search
conda install poetry
invoke setup

I installed the recommended dev environment inside the conda pelican environment. Nothng wrong with that, in fact it's good practice. However now it's time add last piece, the stick of dynamite:

  • Start Menu >> Git Extensions >> Commit

That's right. I'm using a git gui outside of the conda managed environment and it knows nothing about the pelican plugin dev additions. Dutifully it calls the pre-commit check, does not find the requred tools, attempts to install them who-knows-where, can't, and gives up.


Ok, so, now what?

Well the choices seem to be:

  • disable local pre-commit hook, learn it's procedures and be disciplined about applying them manually
  • see if a bat or powershell script that launches Git Extensions from inside the pelican shell will pick up the correct environment. (If yes: remember to close GE before switching to another project.)
  • Research where in the world Git-outside-conda installs things, figure out what incompatibility there is (if can), and if it resolvable.
  • only hack on Pelican PR's from my laptop which for some reason is immune to this problem (being a secondary machine there aren't as many things installed on it).
  • Buckle down and memorize how to use commandline git from inside a conda activate pelican shell

@maphew maphew changed the title pre-commit hook reinstalls poetry, fails, and aborts pre-commit hook reinstalls poetry, fails, and aborts. No commits possible. Feb 9, 2023
@justinmayer
Copy link
Contributor

Hey Matt. Sorry to hear about your troubles. Since I don't use Windows, Conda, or Git Extensions, I am unfortunately ill-equipped to provide guidance or feedback here. That said, I suspect the latter of the choices listed above is probably your best bet. As someone who struggled with Git for a long time, I have finally come to understand its foibles and now quite appreciate what I can do with it at the CLI level. If you choose that option, let me know if I can be of assistance! 😊

@maphew
Copy link
Contributor Author

maphew commented Feb 9, 2023

Thanks Justin. I'm actually moderately ok with git cli for most things I need to do now. I harbour a prejudice it's probably time to let go of, fed by many instances of now historical epxpeditions to comb Stack Overflow et al for getting myself out of mess X, giving up and just blowing away the repo and starting over. ;-)

@justinmayer
Copy link
Contributor

An understandable prejudice, to be sure. I had similar experiences when I first started out, but I haven't had to blow away a repo in over a decade, so at this point I think I've got it down. 😉

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

No branches or pull requests

2 participants