Comments (15)
No, there is no require
for this plugin.
However, you need to properly set up the dependencies.
:UpdateRemoteDependencies
should be recognized as a command. However, it fails on my side, saying that it misses the jupyter_client
module.
from nixvim.
Thanks a lot for looking at it so swiftly.
jupyter
is indeed a dependency of molten
.
However, even when do create a temp shell that has jupyter, :UpdateRemoteDependencies
continues to fail.
# in my `nix flake init --template github:nix-community/nixvim` dir
nix-shell -p "python3.withPackages(ps: with ps; [ numpy pandas jupyter ])"
nix run .#
Obviously, feel free to tell me if this is outside the scope of nixnvim support. I just wasn't sure if :UpdateRemoteDependencies
was even supported or if it breaks nix paradigms.
from nixvim.
I think we need to add it to the extraPythonPackages of nixvim
from nixvim.
That's exactly what I was looking at.
Here is the molten example for nixos: https://github.com/benlubas/molten-nvim/blob/main/docs/NixOS.md
Using home-manager, they have this part:
...
extraPython3Packages = ps: with ps; [
# ... other python packages
pynvim
jupyter-client
cairosvg # for image rendering
pnglatex # for image rendering
plotly # for image rendering
pyperclip
];
...
Is there a similar user-defined argument in nixvim?
from nixvim.
We have this option: https://nix-community.github.io/nixvim/NeovimOptions/index.html?highlight=python#extrapython3packages
from nixvim.
This helped a lot to go forward.
Now I have:
- a tiny shell.nix for the environment (to be replaced by a flake)
{ pkgs ? import <nixpkgs> {} }:
pkgs.mkShell {
nativeBuildInputs = with pkgs; [
python311
quarto
];
LD_LIBRARY_PATH = "${pkgs.stdenv.cc.cc.lib}/lib";
}
- Some molten python package dependency for nvim declared in the nixvim
config/default.nix
{ self
, pkgs
, ...
}: {
# Import all your configuration modules here
imports = [
./bufferline.nix
];
extraPython3Packages = p: with p; [ jupyter-client pynvim cairosvg pnglatex plotly pyperclip ];
extraPlugins = [
{ plugin = pkgs.vimPlugins.quarto-nvim; }
{ plugin = pkgs.vimPlugins.otter-nvim; }
{
plugin = pkgs.vimUtils.buildVimPlugin {
name = "jupytext-nvim";
src = pkgs.fetchFromGitHub {
owner = "GCBallesteros";
repo = "jupytext.nvim";
rev = "68fddf28119dbaddfaea6b71f3d6aa1e081afb93";
sha256 = "x5emW+qfUTUDR72B9QdDgVdrb8wGH9D7AdtRrQm80sI=";
};
};
}
];
extraConfigLua = ''
require("jupytext").setup({
style = "markdown",
output_extension = "md",
force_ft = "markdown",
})
'';
plugins.lsp = {
enable = true;
servers = {
tsserver.enable = true;
lua-ls.enable = true;
rnix-lsp.enable = true;
pyright.enable = true;
};
};
plugins.molten = {
enable = true;
};
}
- The jupiter kernel and jupytext cli installed in a venv
With these three parts, I can :MoltenInit
and run code in notebook cells 🥳
The current blocker is that I could only make this works with the line:
LD_LIBRARY_PATH = "${pkgs.stdenv.cc.cc.lib}/lib";
in shell.nix
, which helps pass :UpdateRemotePlugins
but also seem to break the pyright
lsp. Without it I have normal LSP support, with it the LSP fails to attach to the buffer with the :LspLog
error message:
/lib/libstdc++.so.6: version `GLIBXX_3.4.32' not found
from nixvim.
I also had the same problem, where molten
would never load by just enabling it. I fixed it by fetching the plugin manually from github and passing the required dependencies through to it.
plugins.molten = {
enable = true;
package = pkgs.vimUtils.buildVimPlugin {
pname = "molten-nvim";
version = "2024-02-23";
src = pkgs.fetchFromGitHub {
owner = "benlubas";
repo = "molten-nvim";
rev = "8346bba69e0de96278dad2038e9be74605908b7d";
# sha256 = lib.fakeSha256;
sha256 = "08f3zxzka43f87fks56594476h57yq01x7a1zdsn4acc278xg1nb";
};
passthru.python3Dependencies = ps:
with ps; [
pynvim
jupyter-client
cairosvg
ipython
nbformat
];
meta.homepage = "https://github.com/benlubas/molten-nvim/";
};
};
Maybe the original package in nixpkgs
can also be overwritten with overrideAttrs
but the above code worked for me, so i did not experiment further.
from nixvim.
Thank you for sharing @Charging1948
I tried it but for me it did not change the situation.
- With
LD_LIBRARY_PATH = "${pkgs.stdenv.cc.cc.lib}/lib";
inshell.nix
(which breaks pyright LSP):molten
is responsive and I get results below cells.
- Without
LD_LIBRARY_PATH = "${pkgs.stdenv.cc.cc.lib}/lib";
inshell.nix
(which fixes pyright LSP): the entire nvim becomes extremely sluggish after:MoltenInit
and I get "on hold" below cells.
from nixvim.
@xvrdm Very Interesting. I do not override the LD_LIBRARY_PATH and it just works.
My config is a mess, but maybe it helps: https://github.com/Charging1948/neovim
from nixvim.
@Charging1948 I actually tried your config after your first config, very impressive, but a bit overwhelming for my level of understanding. Definitely an inspiration.
I put my tiny attempt here: https://github.com/xvrdm/nixvim_sandbox
from nixvim.
@xvrdm I tried to replicate the behavior you are experiencing, but i was able to use molten without problems:
The only thing i have added was the ipykernel, because it was missing.
At this point i dont know what the problem could be, sorry.
from nixvim.
Thanks a lot for trying.
So you manage to have both molten working and LSP support in normal python files 🤔 ?
I wonder if it could be because I am trying on an arm vm. I will try it on another architecture.
from nixvim.
In the end, I am not sure about what we could/should do at the nixvim level.
Should we add the few recommended packages to extraPython3Packages
? What do you think @traxys ?
from nixvim.
@GaetanLepage, do you mean that they could have been automatically when a user enable molten
?
From a user perspective, I think it makes sense that I have to add these python packages via the extrapython3packages
argument @traxys pointed me to. Except if for other packages you tend to do it for the user (but I guess it would be quite challenging to keep track of).
from nixvim.
Related Issues (20)
- [BUG] error: `phpcbf` is now deprecated, use `php-codesniffer` instead which contains both `phpcs` and `phpcbf`. HOT 14
- [PLUGIN REQUEST] vim-sandwich
- [BUG] Treesitter configures custom parser lists incorrectly HOT 4
- plugins/whichkey: Support window and layout fields HOT 1
- [PLUGIN REQUEST] <auto-save fork>
- [BUG] [nvim-cmp] unable to pass a function in sources entryFilter HOT 3
- nord colorscheme not starting on launch due to `colorscheme` not set when `colorschemes.nord.enable = true;` HOT 4
- [PLUGIN REQUEST] cmp_yanky HOT 1
- [BUG] some none-ls servers have no nixpkgs sources configured HOT 2
- feature: keymaps action should be optional HOT 6
- feature: keymap aliasing HOT 3
- feature: option to enable refactor.nvim's telescope extension HOT 3
- feature: register LSP binds on `LspAttach` HOT 5
- [BUG] Cannot access `helpers` in flake HOT 3
- docs: support other branches HOT 2
- [BUG] cmp sources do not accept list of lists HOT 5
- [BUG] Onedark color scheme not loading HOT 2
- [PLUGIN REQUEST] sqls LSP
- [PLUGIN REQUEST] telescope-manix
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 nixvim.