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

python3Packages.black: init at 18.4a0 #38386

Merged
merged 3 commits into from Apr 5, 2018
Merged

Conversation

sveitser
Copy link
Contributor

@sveitser sveitser commented Apr 3, 2018

Motivation for this change

Add python code formatter black: https://github.com/ambv/black.

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option build-use-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/)
  • Fits CONTRIBUTING.md.

buildPythonPackage rec {
pname = "black";
version = "18.4a0";
name = "${pname}-${version}";
Copy link
Member

Choose a reason for hiding this comment

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

When using buildPythonPackage the name attribute defaults to name = "${pname}-${version}"; so this line can be omitted.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good to know. Thanks!

Copy link
Member

@dotlambda dotlambda left a comment

Choose a reason for hiding this comment

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

If I understand correctly, black doesn't provide a python module. In that case, it must be moved to e.g. pkgs/development/tools/black and called from all-packages.nix.

propagatedBuildInputs = [ attrs click ];

meta = with stdenv.lib; {
description = "The uncompromising Python code formatter.";
Copy link
Member

Choose a reason for hiding this comment

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


meta = with stdenv.lib; {
description = "The uncompromising Python code formatter.";
homepage = "https://github.com/ambv/black";
Copy link
Member

Choose a reason for hiding this comment

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

no quotes

@sveitser
Copy link
Contributor Author

sveitser commented Apr 5, 2018

@dotlambda made the changes for meta attributes.

It can also be used as a python module, for instance here https://github.com/ambv/black/blob/master/vim/plugin/black.vim#L77

@dotlambda
Copy link
Member

@GrahamcOfBorg build python3.pkgs.black

@GrahamcOfBorg
Copy link

Success on x86_64-linux (full log)

Attempted: python3.pkgs.black

Partial log (click to expand)

test_setup (tests.test_black.BlackTestCase) ...
ok
test_string_quotes (tests.test_black.BlackTestCase) ...
ok

----------------------------------------------------------------------
Ran 27 tests in 6.993s

OK
/nix/store/aphnjxgr4h97qzl01xmnf25ny2r8hrz8-python3.6-black-18.4a0

@GrahamcOfBorg
Copy link

Success on aarch64-linux (full log)

Attempted: python3.pkgs.black

Partial log (click to expand)

test_report (tests.test_black.BlackTestCase) ... ok
test_self (tests.test_black.BlackTestCase) ... ok
test_setup (tests.test_black.BlackTestCase) ... ok
test_string_quotes (tests.test_black.BlackTestCase) ... ok

----------------------------------------------------------------------
Ran 27 tests in 39.698s

OK
/nix/store/slq1glxq1lxidcsncgh3zgnfs4pi9q9s-python3.6-black-18.4a0

@dotlambda dotlambda merged commit 7485d21 into NixOS:master Apr 5, 2018
@sveitser sveitser deleted the python-black branch April 6, 2018 02:22
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

4 participants