Skip to content

Commit f30464d

Browse files
committed
Organizing settings for Python 3
1 parent 4bcbb15 commit f30464d

File tree

4 files changed

+17
-12
lines changed

4 files changed

+17
-12
lines changed

modules/kernels/python/default.nix

+3-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@
1313
, settingsSchema
1414
}:
1515

16-
with { inherit (settings) packages attrs extensions; };
16+
with { inherit (settings) packages; };
17+
with { inherit (settings.interface) attrs extensions; };
1718

1819
let
1920
common = callPackage ../common.nix {};
@@ -56,7 +57,7 @@ symlinkJoin {
5657
(callPackage ./kernel.nix {
5758
python = pythonToUse;
5859
inherit displayName kernelName attrs extensions;
59-
enableVariableInspector = settings.enableVariableInspector;
60+
enableVariableInspector = settings.misc.enableVariableInspector;
6061
})
6162

6263
pythonToUse

modules/kernels/python/module.nix

+10-6
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,15 @@ let
1919

2020
python3Package = packageOption;
2121

22-
attrs = mkOption {
22+
interface.attrs = mkOption {
23+
example = "Notebook attributes";
24+
description = "Notebook cells that have these attributes will match this kernel, allowing it to run the code.";
2325
type = types.listOf types.str;
2426
default = ["python"];
2527
};
26-
27-
extensions = mkOption {
28+
interface.extensions = mkOption {
29+
example = "File extensions";
30+
description = "Files with these extensions will match against this kernel, allowing you to run the code as if it were a Jupyter cell.";
2831
type = types.listOf types.str;
2932
default = ["py"];
3033
};
@@ -70,14 +73,15 @@ let
7073
default = false;
7174
};
7275

73-
permitUserSite = mkOption {
76+
misc.permitUserSite = mkOption {
7477
example = "Permit user site-packages";
7578
description = "Skip setting the PYTHONNOUSERSITE variable. This will allow your Python code to import local packages (e.g. from ~/.local/lib). This is useful if you want to use pip to install Python packages independently of Nix.";
7679
type = types.bool;
7780
default = false;
7881
};
79-
enableVariableInspector = mkOption {
80-
description = "Enable the variable inspector";
82+
misc.enableVariableInspector = mkOption {
83+
example = "Enable the variable inspector";
84+
description = "This will show a summary of the currently defined variables in the UI.";
8185
type = types.bool;
8286
default = true;
8387
};

sample_environments/mega.nix

+2-2
Original file line numberDiff line numberDiff line change
@@ -41,16 +41,16 @@ codedown.makeEnvironment {
4141

4242
kernels.python3.enable = true;
4343
kernels.python3.packages = ["matplotlib" "scipy" "rope"];
44-
kernels.python3.permitUserSite = false;
4544
kernels.python3.lsp.jedi.enable = true;
4645
kernels.python3.lsp.pyright.enable = true;
4746
kernels.python3.lsp.pylint.enable = true;
4847
kernels.python3.lsp.flake8.enable = true;
4948
kernels.python3.lsp.pycodestyle.enable = true;
5049
kernels.python3.lsp.python-lsp-server.enable = true;
50+
kernels.python3.misc.permitUserSite = false;
5151

5252
# kernels.pypy3.enable = true;
53-
# kernels.pypy3.permitUserSite = false;
53+
# kernels.pypy3.misc.permitUserSite = false;
5454

5555
kernels.ruby.enable = true;
5656

sample_environments/python3.nix

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@ codedown.makeEnvironment {
1111
"rope"
1212
];
1313

14-
kernels.python3.permitUserSite = false;
15-
1614
kernels.python3.lsp = {
1715
jedi.enable = true;
1816
pyright.enable = true;
@@ -21,4 +19,6 @@ codedown.makeEnvironment {
2119
pycodestyle.enable = true;
2220
python-lsp-server.enable = true;
2321
};
22+
23+
kernels.python3.misc.permitUserSite = false;
2424
}

0 commit comments

Comments
 (0)