Skip to content

Commit

Permalink
refactor(python): install dependencies inside the virtualenv.
Browse files Browse the repository at this point in the history
This is in order to prevent long compilation time required for
development dependencies.
  • Loading branch information
shahinism committed Jul 17, 2024
1 parent 3f4492a commit 6146320
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 26 deletions.
23 changes: 10 additions & 13 deletions devenv.nix
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,21 @@
...
}:

let
python-packages =
p: with p; [
python-lsp-server
importmagic
epc
];
in
{
# https://devenv.sh/packages/
packages = with pkgs; [
pdm
(python3.withPackages python-packages)
];
packages = with pkgs; [ ];

languages.python = {
enable = true;
venv.enable = true;
venv = {
enable = true;
requirements = ''
pdm
python-lsp-server
importmagic
epc
'';
};
};

# Make diffs fantastic
Expand Down
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@ version = "1.0.0"
description = "Default template for PDM package"
authors = [
{name = "Reza (Shahin) Khanipour", email = "[email protected]"},
{name = "Reza (Shahin) Khanipour", email = "[email protected]"},
]
dependencies = [
"copier>=9.3.1",
]
requires-python = "==3.12.*"
requires-python = "==3.11.*"
readme = "README.md"
license = {text = "MIT"}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,5 @@
{% extends pathjoin("includes", "base.nix.jinja") %}

{% block variables %}
let
python-packages =
p: with p; [
python-lsp-server
importmagic
epc
];
in
{% endblock %}

{% block packages %}
pdm
(python3.withPackages python-packages)
Expand All @@ -19,7 +8,15 @@ in
{% block languages %}
python = {
enable = true;
venv.enable = true;
venv = {
enable = true;
requirements = ''
pdm
python-lsp-server
importmagic
epc
'';
};
};
{% endblock %}

Expand Down

0 comments on commit 6146320

Please sign in to comment.