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

vscode-extensions.ms-python.python: Fix packaging. #53923

Closed

Conversation

sdorminey
Copy link

Motivation for this change

Previously, this extension used the JEDI backend for understanding
Python. Recently, Microsoft switched to using their Python Language
Server (https://github.com/Microsoft/python-language-server). The
extension attempts to download the latest version into the extension
folder, which failed for obvious reasons.

This change packages the language server into the extension, and
performs the necessary fixups and wrapping to make the dotnet binary
run.

Tested on Linux x86_64, but it should work on Darwin too.

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after) Before: 2794344 After: 2869216
  • Assured whether relevant documentation is up to date
  • Fits CONTRIBUTING.md.

Previously, this extension used the JEDI backend for understanding
Python. Recently, Microsoft switched to using their Python Language
Server (https://github.com/Microsoft/python-language-server). The
extension attempts to download the latest version into the extension
folder, which failed for obvious reasons.

This change packages the language server into the extension, and
performs the necessary fixups and wrapping to make the dotnet binary
run.

Tested on Linux x86_64, but it should work on Darwin too.
Copy link
Contributor

@endgame endgame left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR.
I don't know the vscode ecosystem nor its nixpkging, but I made some comments. HTH, feel free to ignore.

};
meta = with lib; {
license = licenses.mit;
maintainers = [ maintainers.jraygauthier maintainers.sdorminey ];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you only have to do this if you want to become a maintainer of a package. Up to you.
https://nixos.org/nixpkgs/manual/#sec-standard-meta-attributes

'';
};

languageServer = extractNuGet rec {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are other packages going to want to use this language server? Should it be packaged separately?

buildInputs = [ languageServer icu openssl ];
dontPatchELF = true;

buildPhase = ''
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would prefer if this phase happened in the python language server derivation.
Also I think it makes more sense for the installation here to be in the installPhase and the patching and wrapping to happen at postFixup.

'';

fixupPhase = ''
wrapProgram `find $out -name Microsoft.Python.LanguageServer` --prefix LD_LIBRARY_PATH ":" ${icu}/lib:${openssl.out}/lib
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason why having this in rpath isn't done?

@worldofpeace
Copy link
Contributor

Haven't had any response in while, so I'm afraid it would customary for me to close this.
I you're still interested in contributing this change please open another pr with the requested changes.

Thanks 🌟

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants