pelican-plugins / search

Pelican plugin that adds site search capability
47 stars 9 forks source link

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

Open maphew opened 1 year ago

maphew commented 1 year ago

...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 https://github.com/pelican-plugins/search/pull/22#discussion_r1096586679_

maphew commented 1 year ago

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:

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:

justinmayer commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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. 😉