Skip to content

python3Packages.lintrunner: init at 0.12.7#377405

Open
PrestonHager wants to merge 8 commits intoNixOS:masterfrom
PrestonHager:add-lintrunner-package
Open

python3Packages.lintrunner: init at 0.12.7#377405
PrestonHager wants to merge 8 commits intoNixOS:masterfrom
PrestonHager:add-lintrunner-package

Conversation

@PrestonHager
Copy link

Based on https://github.com/suo/lintrunner upstream. Package is listed in PyPI already at https://pypi.org/project/lintrunner/.

Things done

  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandboxing enabled in nix.conf? (See Nix manual)
    • sandbox = relaxed
    • sandbox = true
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 25.05 Release Notes (or backporting 24.11 and 25.05 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

Add a 👍 reaction to pull requests you find important.

@github-actions github-actions bot added 6.topic: python Python is a high-level, general-purpose programming language. 8.has: maintainer-list (update) This PR changes `maintainers/maintainer-list.nix` labels Jan 27, 2025
@nix-owners nix-owners bot requested a review from natsukium January 27, 2025 20:54
@NixOSInfra NixOSInfra added the 12.first-time contribution This PR is the author's first one; please be gentle! label Jan 27, 2025
@github-actions github-actions bot added 10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. labels Jan 27, 2025
@PrestonHager PrestonHager force-pushed the add-lintrunner-package branch from d7051df to cc51b5f Compare January 27, 2025 21:22
@PrestonHager PrestonHager changed the title pythonPackages3.lintrunner: init at 0.12.7 python3Packages.lintrunner: init at 0.12.7 Jan 27, 2025
Copy link
Member

Choose a reason for hiding this comment

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

I think this tool is an application but not a library.
If so, please use buildPythonApplication and move it to pkgs/by-name/li/lintrunner instead.

Copy link
Author

Choose a reason for hiding this comment

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

It is an application, I've used buildPythonApplication instead of buildPythonPackage. The typical way to install the application is via pip, should the package then be referenced/placed in the python top-level packages? This way it can be installed using python3Packages.lintrunner instead of the package name lintrunner, or is this bad practice?

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Author

Choose a reason for hiding this comment

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

Since it's an application, there's no imports to check with python. It's written in rust, should I run cargo test under the package to ensure tests? Not quite the same as testing the installed binary, but testing the application code functionality itself.

Added myself as a maintainer for future packages.
Based on https://github.com/suo/lintrunner upstream. Package is listed
in PyPI already at https://pypi.org/project/lintrunner/.
Built using buildPythonApplication with maturin (rust) build system.
@PrestonHager PrestonHager force-pushed the add-lintrunner-package branch from cc51b5f to b01f4fd Compare January 31, 2025 22:22
@github-actions github-actions bot removed the 6.topic: python Python is a high-level, general-purpose programming language. label Jan 31, 2025
@PrestonHager
Copy link
Author

@natsukium I was able to make most of the changes you suggested, I have a couple of questions with regards to some changes. I left comments under each suggestion, but here they are below for completeness:

  1. It is an application, I've used buildPythonApplication instead of buildPythonPackage. The typical way to install the application is via pip, should the package then be referenced/placed in the python top-level packages? This way it can be installed using python3Packages.lintrunner instead of the package name lintrunner, or is this bad practice?
  2. I'd like to use patches instead of a fork of the repository, but I could not get a git diff --cached > file.patch to work locally, probably doing something wrong. I tried using patches = [ file.patch ]; and cargoPatches = [ file.patch ]; but neither seemed to change the contents of the source directory. I also noticed that this would be creating a new file (Cargo.lock) rather than changing the contents of a file.
  3. Since it's an application, there's no imports to check with python. It's written in rust, should I run cargo test under the package to ensure tests? Not quite the same as testing the installed binary, but testing the application code functionality itself.
  4. I left an issue in the upstream repository, #84. If I were to guess, it's meant to be MIT and the other one is from Cargo doing something. In the meantime, is there a dual license option we can do to specify both licenses for the nix package?

Thank you for the review and all the help!

@github-actions github-actions bot added 10.rebuild-darwin: 1 This PR causes 1 package to rebuild on Darwin. 10.rebuild-linux: 1 This PR causes 1 package to rebuild on Linux. labels Jan 31, 2025
@FliegendeWurst FliegendeWurst added the 8.has: package (new) This PR adds a new package label Mar 11, 2025
@FliegendeWurst FliegendeWurst marked this pull request as draft June 14, 2025 15:23
@PrestonHager PrestonHager marked this pull request as ready for review September 11, 2025 03:50

python3Packages.buildPythonApplication rec {
pname = "lintrunner";
version = "0.12.7";
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
version = "0.12.7";
version = "0.12.7-unstable-2025-07-03";

Since you aren't using the tagged release we should add the commit date here. Also please put a comment why the tagged release is not used. (And meta.changelog needs to be adjusted)

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

Labels

8.has: maintainer-list (update) This PR changes `maintainers/maintainer-list.nix` 8.has: package (new) This PR adds a new package 10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. 10.rebuild-darwin: 1 This PR causes 1 package to rebuild on Darwin. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. 10.rebuild-linux: 1 This PR causes 1 package to rebuild on Linux. 12.first-time contribution This PR is the author's first one; please be gentle!

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants