Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nix update #127

Merged
merged 5 commits into from
Jan 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/pytest-lsp/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
.coverage
result
12 changes: 6 additions & 6 deletions lib/pytest-lsp/flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

55 changes: 32 additions & 23 deletions lib/pytest-lsp/flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -14,27 +14,36 @@
pytest-lsp-overlay = import ./nix/pytest-lsp-overlay.nix;
in {

overlays.default = pytest-lsp-overlay;

devShells = utils.lib.eachDefaultSystemMap (system:
let
pkgs = import nixpkgs { inherit system; overlays = [ pytest-lsp-overlay ]; };
in
eachPythonVersion [ "38" "39" "310" "311" ] (pyVersion:
with pkgs; mkShell {
name = "py${pyVersion}";

shellHook = ''
export PYTHONPATH="./:$PYTHONPATH"
'';

packages = with pkgs."python${pyVersion}Packages"; [
pygls
pytest
pytest-asyncio
];
}
)
);
};
overlays.default = pytest-lsp-overlay;

packages = utils.lib.eachDefaultSystemMap (system:
let
pkgs = import nixpkgs { inherit system; overlays = [ pytest-lsp-overlay ]; };
in
eachPythonVersion [ "38" "39" "310" "311"] (pyVersion:
pkgs."python${pyVersion}Packages".pytest-lsp
)
);

devShells = utils.lib.eachDefaultSystemMap (system:
let
pkgs = import nixpkgs { inherit system; overlays = [ pytest-lsp-overlay ]; };
in
eachPythonVersion [ "38" "39" "310" "311" ] (pyVersion:
with pkgs; mkShell {
name = "py${pyVersion}";

shellHook = ''
export PYTHONPATH="./:$PYTHONPATH"
'';

packages = with pkgs."python${pyVersion}Packages"; [
pygls
pytest
pytest-asyncio
];
}
)
);
};
}
64 changes: 15 additions & 49 deletions lib/pytest-lsp/nix/pytest-lsp-overlay.nix
Original file line number Diff line number Diff line change
@@ -1,71 +1,37 @@
final: prev: {
final: prev:

let
# Read the package's version from file
lines = prev.lib.splitString "\n" (builtins.readFile ../pytest_lsp/client.py);
matches = builtins.map (builtins.match ''__version__ = "(.+)"'') lines;
versionStr = prev.lib.concatStrings (prev.lib.flatten (builtins.filter builtins.isList matches));
in {
pythonPackagesExtensions = prev.pythonPackagesExtensions ++ [(
python-final: python-prev: {

# TODO: Remove once https://github.com/NixOS/nixpkgs/pull/233870 is merged
typeguard = python-prev.typeguard.overridePythonAttrs (oldAttrs: rec {
version = "3.0.2";
format = "pyproject";

src = prev.fetchPypi {
inherit version;
pname = oldAttrs.pname;
sha256 = "sha256-/uUpf9so+Onvy4FCte4hngI3VQnNd+qdJwta+CY1jVo=";
};

propagatedBuildInputs = with python-prev; [
importlib-metadata
typing-extensions
];

});

lsprotocol = python-prev.lsprotocol.overridePythonAttrs(oldAttrs: rec {
version = "2023.0.0a3";

src = prev.fetchFromGitHub {
rev = version;
owner = "microsoft";
repo = oldAttrs.pname;
sha256 = "sha256-Q4jvUIMMaDX8mvdmRtYKHB2XbMEchygO2NMmMQdNkTc=";
};
});

pygls = python-prev.pygls.overridePythonAttrs (_: {
format = "pyproject";

src = prev.fetchFromGitHub {
owner = "openlawlibrary";
repo = "pygls";
rev = "main";
hash = "sha256-JpopfqeLNi23TuZ5mkPEShUPScd1fB0IDXSVGvDYFXE=";
};

nativeBuildInputs = with python-prev; [
poetry-core
];
});

pytest-lsp = python-prev.buildPythonPackage {
pname = "pytest-lsp";
version = "0.3.0";
version = versionStr;
format = "pyproject";

src = ./..;

nativeBuildInputs = with python-final; [
hatchling
];

propagatedBuildInputs = with python-final; [
pygls
pytest
pytest-asyncio
];

doCheck = true;

pythonImportsCheck = [ "pytest_lsp" ];
nativeCheckInputs = with python-prev; [
pytestCheckHook
];

pythonImportsCheck = [ "pytest_lsp" ];

};
}
)];
Expand Down