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

pythonPackages.voltron: init at 0.1.7 #21398

Closed
wants to merge 7 commits into from
Closed

pythonPackages.voltron: init at 0.1.7 #21398

wants to merge 7 commits into from

Conversation

psychomario
Copy link

Motivation for this change

Add the voltron package and required dependencies:

  • requests-unixsocket
  • pysigset
  • blessed
  • Flask-RESTful
  • aniso8601
  • scruffington
  • voltron
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
    • Linux
  • 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.

Note that for testing purposes I had to recompile my gdb to use the full version of python27 due to the curses library not being there. This is likely due to my own stupidity.

Python27, Python3{3,4,5,6} all compile, fully tested with Python27.

Apologies if I've done this completely wrong, I'm very new to this packaging format.

@mention-bot
Copy link

@psychomario, thanks for your PR! By analyzing the history of the files in this pull request, we identified @FRidh to be a potential reviewer.

@FRidh
Copy link
Member

FRidh commented Dec 25, 2016

Hi @psychomario. This looks good.

Note that for testing purposes I had to recompile my gdb to use the full version of python27 due to the curses library not being there. This is likely due to my own stupidity.

Nowadays all Python interpreters in Nixpkgs come with curses by default.

Python27, Python3{3,4,5,6} all compile, fully tested with Python27.

Good! Did you also check whether the tests are actually run? After building and "installing" a test runner is automatically run. The default runner doesn't always detect tests, and if that's the case the checkPhase should be fixed.

@FRidh FRidh changed the title Pythonpackage.voltron: init at 0.1.7 pythonPackages.voltron: init at 0.1.7 Dec 25, 2016
Copy link
Member

@FRidh FRidh left a comment

Choose a reason for hiding this comment

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

Could you also add yourself as maintainer of these packages?

version = "0.3.7";
format = "wheel";
src = pkgs.fetchurl {
url = "https://pypi.python.org/packages/6c/73/18d180df19d55e8803731ad638513038906914063bd9bde8eea3cfa1ece5/${name}-py2.py3-none-any.whl";
Copy link
Member

Choose a reason for hiding this comment

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

please use url's like

url = "mirror://pypi/a/${pname}/${name}.tar.gz";

or, even better,

url = "mirror://pypi/${builtins.substring 0 1 pname}/${pname}/${name}.tar.gz";

The one you use now consists of a big hash which changes with every version requiring updating the url.

Copy link
Author

Choose a reason for hiding this comment

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

The two libraries I've not done this for only offer .whl files on pypi, and I couldn't find any examples of the hashless url, do you know the correct format for this?

Copy link
Member

Choose a reason for hiding this comment

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

you're right, then its fine!

Copy link
Member

Choose a reason for hiding this comment

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

While its possible to install wheels, the original source is still preferred. I've looked at the two packages, and they have repo's on GitHub and use setuptools.

@FRidh
Copy link
Member

FRidh commented Dec 25, 2016

Then I have one more request (we don't have a guideline on this matter yet). Please put each expression in a default.nix in pkgs/development/python-modules/ and call it from python-packages.nix like is done with several other packages (e.g. setuptools). We should slowly move to separate files since python-packages.nix becomes huge.

@psychomario
Copy link
Author

Hi @FRidh, thanks for the feedback. I'll make these changes when I can, but it will likely be tomorrow as today is Christmas day.
I've also noticed Travis is failing to build due to a bad license, unsure why my local build succeeded but I will fix this too.

meta = {
description = "Use requests to talk HTTP via a UNIX domain socket";
homepage = "https://github.com/msabramo/requests-unixsocket";
license = licenses.apache;
Copy link
Member

Choose a reason for hiding this comment

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

licenses.asl20

@psychomario
Copy link
Author

psychomario commented Dec 25, 2016

Test status

I will fill this out as I verify each package.

Python27 Python33 Python34 Python35 Python36
requests-unixsocket+/++
pysigset**
blessed+/++
Flask-RESTful
aniso8601
scruffington***
voltron++

* Tests not found
** No tests present
*** First run only
+

______ ERROR collecting dist/tmpbuild/blessed/blessed/tests/test_wrap.py _______
import file mismatch:
imported module 'blessed.tests.test_wrap' has this __file__ attribute:
  /tmp/nix-build-python3.6-blessed-1.14.1.drv-0/blessed-1.14.1/blessed/tests/test_wrap.py
which is not the same as the test file we want to collect:
  /tmp/nix-build-python3.6-blessed-1.14.1.drv-0/blessed-1.14.1/dist/tmpbuild/blessed/blessed/tests/test_wrap.py
HINT: remove __pycache__ / .pyc files and/or use a unique basename for your test file modules

++ fails
bold All testing and OK

@psychomario
Copy link
Author

I've noticed some inconsistencies in the way - are handled in package names. For example, pytest-mock has the -, but pytestpep8 does not.

Which is the preferred method which I should apply to requests-unixsocket and Flask-RESTful?

@FRidh
Copy link
Member

FRidh commented Dec 25, 2016

For Python packages the preferred name is the one used by upstream, which we consider PyPI, and if the package is not on PyPI then its the name given by the author.

@psychomario
Copy link
Author

For those two examples, PyPI has the - in both, and the name/pname attribute is correct, but the definition start line varies. See below:

  pytest-mock = buildPythonPackage rec {
    name = "${pname}-${version}";
    pname = "pytest-mock";
    version = "1.2";
  pytestpep8 = buildPythonPackage rec {
    name = "pytest-pep8";

@FRidh
Copy link
Member

FRidh commented Dec 25, 2016

Correct. The general guidelines for Nixpkgs are different. python-packages.nix used to follow those.

@psychomario
Copy link
Author

psychomario commented Dec 25, 2016

Ok so I think I've implemented all of your feedback, and I've rebuilt with Python27 and Python3{3,4,5,6} to verify nothing has broken.

A few of the packages have broken tests so the testing has been disabled, I'm not sure if this is Ok or not. I've opened an issue against scruffington to fix the tests failing every time after the first run if the tests are run as a new nixbld user. On a related note, is there a reason why the package building environment does not have a fresh /tmp? I saw a test failure in both requests-unixsocket and blessed, seen in my comment above keyed as '+'; is this a known Nix thing with a fix?

Copy link
Member

@FRidh FRidh left a comment

Choose a reason for hiding this comment

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

Some of my comments apply to all expressions.

license = licenses.bsd3;
platforms = platforms.linux;
};
propagatedBuildInputs = [ flask pytz six aniso8601 itsdangerous click jinja2 werkzeug dateutil nose ];
Copy link
Member

Choose a reason for hiding this comment

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

does it have a runtime dependency on nose? That's unlikely.

@@ -0,0 +1,23 @@
{
stdenv, pkgs, python, wrapPython, buildPythonPackage,
Copy link
Member

Choose a reason for hiding this comment

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

just pass lib instead of stdenv. Furthermore, never pass the whole package set pkgs, instead pass individual applications/libraries, like in this case fetchurl. wrapPython is not used so you don't need to pass it, and neither should you pass python.

meta = with stdenv.lib; {
description = "Simple framework for creating REST APIs";
homepage = "https://github.com/flask-restful/flask-restful/";
license = licenses.bsd3;
Copy link
Member

Choose a reason for hiding this comment

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

lib.licenses.bsd3 (or stdenv.lib.licenses.bsd3 should you choose to keep stdenv in)

description = "Simple framework for creating REST APIs";
homepage = "https://github.com/flask-restful/flask-restful/";
license = licenses.bsd3;
platforms = platforms.linux;
Copy link
Member

Choose a reason for hiding this comment

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

lib.platforms.linux

url = "mirror://pypi/b/${pname}/${name}.tar.gz";
sha256 = "0wy0na399swybp5bzys31pn57vg34bjsl0kv5zf496996gc8k8jq";
};
doCheck = false;
Copy link
Member

Choose a reason for hiding this comment

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

Don't just disable tests. Always include a comment explaining why they're disabled.

license = licenses.mit;
platforms = platforms.linux;
};
propagatedBuildInputs = [ pyyaml six nose ];
Copy link
Member

Choose a reason for hiding this comment

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

nose as runtime dependency (read: install_requires)? Or only for tests?

# $HOME is by default not a valid dir, so we have to set that too
# https://github.com/NixOS/nixpkgs/issues/12591
# taken from the voltron .travis.yml
checkPhase = ''
Copy link
Member

Choose a reason for hiding this comment

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

postPatch = ''

@FRidh
Copy link
Member

FRidh commented Feb 10, 2017

ping

@psychomario
Copy link
Author

Sorry, I forgot about this and I don't currently have the time to fix and support this. I'm sorry for wasting your time.

@CMCDragonkai
Copy link
Member

This is almost there. I'd like to try and package this soon.

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