Comments (5)
Oh, I wasn't getting how python package dependencies were relevant until I saw the specific example with coverage. But are you imagining cases where there's no system-wide install of python & coverage, or what?
from vim-maktaba.
But are you imagining cases where there's no system-wide install of python & coverage, or what?
from vim-maktaba.
For running the right Python, this might be able to be worked around with a ~/bin/python
(or whatever) in your PATH
(or making the command overridable inside Maktaba, yes).
However, that still leaves the problem that maktaba#python#Eval
only runs binaries as a fallback if Vim itself doesn't have Python support, and that seems like the more-likely case in general.
I'm not familiar with poetry, but would it make sense to run Vim itself in an environment where python -m coverage
works? (i.e. for virtualenv, this'd be running something like source venv/bin/activate
first).
In that case, everything should just work, whether we use Vim's native Python support, or fall back to running a python
binary.
from vim-maktaba.
I think poetry run <command>
is just syntax sugar for source ~/some/venv/in/a/folder/near/you/activate && <command>
.
As a side note, I've recently began using coc.nvim and coc-pyright which is a LSP that has some nice features like knowing if the workspace/project uses some kind of dev tool like poetry
/pipenv
. I feel spoiled/privileged to not having to know about if vim's environment is properly sourced through a virtualenv.
As a workaround for now, I added petobens/poet-v
to my vimrc and ran :PoetvActivate
. That loaded the proper python environment into vim and I'm able to run :CoverageShow coverage.py
inside the project and not get an error.
The workaround is not amazing, since it would require a manual :PoetvActivate
every launch. I think it would be great if there were tooling to sort of automatically know what kind of environment a project is in and could set the provider
from vim-coverage
and be able run coverage-commands more smoothly!
Maybe this is out of scope for this plugin and should be done/thought of elsewhere?
from vim-maktaba.
Looks like another option would be to run poetry shell
or source $(poetry env info --path)/bin/activate
in the terminal before starting vim. Or you could set up an autocmd to run :PoetvActivate
for you from the vim side.
As a maintainer I'm a little concerned about adding too much magic at this level, but specifically for the vim-coverage case I can see some justification for using the same coverage install you're using for the project, since people have run into versioning issues from accessing the same coverage data with different system/project versions of coverage.py. The snag is I think it'd be brittle to introduce a dependency on CWD for detecting which project settings to use. It could in theory detect based on which buffer you're showing coverage for, but that would require changing the library interface and doesn't sound appropriate for ALL existing python we invoke to try to use per-project versions of python & deps. Might be a reasonable vim-coverage feature request, but a pretty effort-intensive one to implement if so.
from vim-maktaba.
Related Issues (20)
- New vim-job based CallAsync doesn't handle complex commands correctly
- Merge vim-selector into maktaba
- maktaba#test#Override no longer working reliably for autoload funcs since vim 8.0.1378 HOT 2
- maktaba#syscall# doesn't work properly for Windows HOT 3
- Implement #mapping#MapUntilTimeout
- maktaba#syscall fails with E766 when throwing a ShellError for stderr containing a printf format string
- Syscall.CallAsync struggles with large stdins HOT 2
- Broken links in Wiki HOT 1
- Error formatting file: ERROR(NotFound): Python module maktaba HOT 3
- Remove need for delays when testing neovim jobcontrol HOT 2
- maktaba#plugin#Enter chokes with cryptic E896 error if it finds a flag called "plugin" HOT 1
- Maktaba plugin bootstrap can fail with `Unknown function: maktaba#Maktaba` HOT 5
- IsBool should handle v:true and v:false HOT 1
- E704 using funcref as selector mapping HOT 2
- Deprecate misc instant/*.vim files HOT 2
- maktaba#function#Filter modifies input HOT 2
- GH run-tests actions failing for ubuntu-latest os (with error about missing impish Release file) HOT 2
- maktaba#value#AsList helper
- matkaba#value#TypeMatches and friends should support recursively checking nested list element types
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vim-maktaba.