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

python: update documentation #48132

Merged
merged 2 commits into from Oct 12, 2018
Merged

python: update documentation #48132

merged 2 commits into from Oct 12, 2018

Conversation

bhipple
Copy link
Contributor

@bhipple bhipple commented Oct 10, 2018

This touches up a handful of places in the python documentation to try to make
the current best-practices more obvious. In particular, I often find the
function signatures (what to pass, what not to pass) confusing and have added
them to the docs.

Also updated the metas to be more consistent with the most frequently used
modern style.

This touches up a handful of places in the python documentation to try to make
the current best-practices more obvious. In particular, I often find the
function signatures (what to pass, what not to pass) confusing and have added
them to the docs.

Also updated the metas to be more consistent with the most frequently used
modern style.
@bhipple bhipple requested a review from FRidh as a code owner October 10, 2018 00:45
@bhipple
Copy link
Contributor Author

bhipple commented Oct 10, 2018

CC @FRidh @samueldr

@@ -655,6 +654,9 @@ Another difference is that `buildPythonPackage` by default prefixes the names of
the packages with the version of the interpreter. Because this is irrelevant for
applications, the prefix is omitted.

When packaging a python application with `buildPythonApplication`, it should be
invoked with `callPackage` and passed `python` or `pythonPackages`.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

One of the issues with the python packages is that there are a handful of historical bad examples floating around. In this PR I'm making an effort to start noting some of the best practices, though there's more editing to be done for sure.

Copy link
Member

Choose a reason for hiding this comment

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

invoked with -> called with

Copy link
Member

Choose a reason for hiding this comment

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

Maybe show an example of a Python application?


src = fetchPypi {
inherit pname version;
sha256 = "cf8436dc59d8695346fcd3ab296de46425ecab00d64096cebe79fb51ecb2eb93";
};

preCheck = ''
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Maybe this should be a patchPhase?

Copy link
Member

Choose a reason for hiding this comment

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

postPatch so that patches can still be used

@@ -186,7 +186,7 @@ building Python libraries is `buildPythonPackage`. Let's see how we can build th
`toolz` package.

```nix
{ # ...
{ lib, buildPythonPackage, fetchPypi }:
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think it's useful to have these to note that you don't just pass python to python modules.

@GrahamcOfBorg
Copy link

Success on aarch64-linux (full log)

Attempted: python

Partial log (click to expand)

/nix/store/hwvbbmqyshry7q5r6qb612i12z8pgva9-python-2.7.15

@GrahamcOfBorg
Copy link

Success on x86_64-linux (full log)

Attempted: python

Partial log (click to expand)

/nix/store/25z9ppmwr6pjy039lkfywabg422clgn6-python-2.7.15

@teto
Copy link
Member

teto commented Oct 10, 2018

Just a suggestion (while you are at it :D) if you have time, it would be cool to expand on how to provide python bindings for programs like gpgme/notmuch/bcc. There was some standard here I think #40470, like you should use { pythonSupport ? false/true } etc.

Also this is not specific to python but maybe having a rationale in nixpkgs doc as to the "why" we do things like this could be interesting (though it could also be another PR).

@GrahamcOfBorg
Copy link

Success on aarch64-linux (full log)

Attempted: python

Partial log (click to expand)

/nix/store/hwvbbmqyshry7q5r6qb612i12z8pgva9-python-2.7.15

@GrahamcOfBorg
Copy link

Success on x86_64-linux (full log)

Attempted: python

Partial log (click to expand)

/nix/store/25z9ppmwr6pjy039lkfywabg422clgn6-python-2.7.15

@FRidh FRidh merged commit 1bcdf27 into NixOS:master Oct 12, 2018
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