You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have come across the same problem as @bshibs in #950 .
PyCharm's "push" seems to be outside of the pipenv shell, leading to a whole lot of warnings because execution is outside of the virtual environment. Running git push manually in the integrated terminal is fine, since it activates the pipenv automatically, but this is not really a feasible solution.
I experimented around, but I was simply unable to add some kind of "pipenv shell" setup to my configuration.
Is there something I missed? Seems like either PyCharm needs to respect the pipenv shell or pre-commit needs to have a way to find it's way back into the virtual environment by itself. My initial idea would be be to offer some kind of setup to initialise pipenv shell, but I'm open for some other ideas.
do you have a step by step reproduction, it's unclear what bshibs was saying there and I don't know what your issue is and whether it is the same one or ?
aka: give me something to copy and paste and run -- "create project, using pipenv for dependencies" doesn't help me because I stay as far away from pipenv as possible
The following assumes PyCharm and no pytest in your global python installation:
Check it out and use pipenv install --dev to install every dependency.
Change and commit any python file (except main.py) to enable the trigger for the pytest hook.
Push using pycharm's push button: <wrong_global_python_install>\python.EXE: No module named pytest
Open console ((CutSolver) should be prefixed to the path, if not use pipenv shell)
Push using git push works with run tests..................Passed.
Don't be alarmed if the created tag is not actually pushed, it's not working right now due to #1411.
oh ok I see -- next time you make a bug report please include the necessary information such that we can understand your problem. This usually involves: some way to reproduce the problem, what you're seeing exactly (output, screenshot, command you ran, etc.), and what you expect to see. without that information it is very difficult to guess at what your problem is.
so first things first, repo: local is the escape hatch from the "normal way" to use pre-commit tools
secondly, language: system is "I don't want pre-commit to manage anything, I promise the tools will be installed globally on my system"
pre-commit works best when it manages the tools that it is running (via language: python / language: node / etc.)
it seems that you're expecting your virtualenv to be globally activated, which it isn't
if you'd like to continue in unsupported territory, I'd suggest you instead use entry: pipenv run ... or whatever pipenv's way of running things is
if you'd like to continue in supported territory, I'd suggest you stop using language: system and use language: python instead (perhaps with additional_dependencies as needed) -- this will cause pre-commit to manage an environment to run the tools in
since this is not a pre-commit issue (language: system is outside the supported domain) I'm closing this -- hopefully those pointers above can help you come to a solution which works for you
here's an example of the former (read: not suggested, but likely does what you want) -- found that from a quick github search filename:.pre-commit-config.yaml "pipenv"
Thanks for your help, I get that solving it here might be out of the scope of this tool.
I am currently trying out both ways. The supported way would need every single dependency listed as [additional dependency] as pytest is calling into the program.
The unsupported way (prefixing every entry with pipenv run ...) works, I was hoping to be able to extract that, either by aliasing the python command with this prefix or having an initial setup call to activate pipenv shell to do that for me.
It's still not perfect, but it's a workaround until the core issue is resolved. Thank's again!
Activity
[-]Pipenv issues[/-][+]Pipenv + PyCharm issues[/+]asottile commentedon Apr 24, 2020
do you have a step by step reproduction, it's unclear what bshibs was saying there and I don't know what your issue is and whether it is the same one or ?
ModischFabrications commentedon Apr 24, 2020
This is a similar case: pypa/pipenv#2850
The short version:
asottile commentedon Apr 24, 2020
show your configuration?
asottile commentedon Apr 24, 2020
aka: give me something to copy and paste and run -- "create project, using pipenv for dependencies" doesn't help me because I stay as far away from pipenv as possible
ModischFabrications commentedon Apr 24, 2020
Everything related to my problem is contained in https://github.com/ModischFabrications/CutSolver, I have not created a minimal working example yet.
I know it's a pain to reproduce it, sorry :/
The following assumes PyCharm and no pytest in your global python installation:
Check it out and use
pipenv install --devto install every dependency.Change and commit any python file (except main.py) to enable the trigger for the pytest hook.
Push using pycharm's push button:
<wrong_global_python_install>\python.EXE: No module named pytestOpen console (
(CutSolver)should be prefixed to the path, if not usepipenv shell)Push using
git pushworks withrun tests..................Passed.Don't be alarmed if the created tag is not actually pushed, it's not working right now due to #1411.
ModischFabrications commentedon Apr 24, 2020
These are pycharm issues and would fix the root cause:
Being able to call
pipenv shellin the project directory before executing anything else should have the same result and gives more flexibility.asottile commentedon Apr 24, 2020
oh ok I see -- next time you make a bug report please include the necessary information such that we can understand your problem. This usually involves: some way to reproduce the problem, what you're seeing exactly (output, screenshot, command you ran, etc.), and what you expect to see. without that information it is very difficult to guess at what your problem is.
repo: localis the escape hatch from the "normal way" to use pre-commit toolslanguage: systemis "I don't want pre-commit to manage anything, I promise the tools will be installed globally on my system"language: python/language: node/ etc.)it seems that you're expecting your virtualenv to be globally activated, which it isn't
if you'd like to continue in unsupported territory, I'd suggest you instead use
entry: pipenv run ...or whateverpipenv's way of running things isif you'd like to continue in supported territory, I'd suggest you stop using
language: systemand uselanguage: pythoninstead (perhaps withadditional_dependenciesas needed) -- this will cause pre-commit to manage an environment to run the tools inasottile commentedon Apr 24, 2020
since this is not a pre-commit issue (
language: systemis outside the supported domain) I'm closing this -- hopefully those pointers above can help you come to a solution which works for youasottile commentedon Apr 24, 2020
filename:.pre-commit-config.yaml "pipenv"pre-commit/pygrep-hooks)try python, don't use unsupported hacks (see pre-commit/pre-commit#1412…
Revert "try python, don't use unsupported hacks (see pre-commit/pre-c…
ModischFabrications commentedon Apr 24, 2020
Thanks for your help, I get that solving it here might be out of the scope of this tool.
I am currently trying out both ways. The supported way would need every single dependency listed as [additional dependency] as pytest is calling into the program.
The unsupported way (prefixing every entry with
pipenv run ...) works, I was hoping to be able to extract that, either by aliasing the python command with this prefix or having an initial setup call to activatepipenv shellto do that for me.It's still not perfect, but it's a workaround until the core issue is resolved. Thank's again!