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

init: pebble-sdk at 4.5 #23445

Closed
wants to merge 8 commits into from
Closed

init: pebble-sdk at 4.5 #23445

wants to merge 8 commits into from

Conversation

edanaher
Copy link
Contributor

@edanaher edanaher commented Mar 3, 2017

Motivation for this change

While Pebble has been bought by Fitbit and stopped selling new products, the watches are still around and available (and cheap!). So this adds the pebble sdk to develop apps for it.

This is by far my most complex PR to date; there are definitely some rough edges and probably things that could be done better. E.g., I used pypi2nix to generate the dependencies, since the sdk's requirements.txt wants specific versions which are often slightly older than the versions in nixpkgs (though I don't know if that's actually a requirement or just paranoia). Also, the user-facing tooling is written in Python, but a C toolchain is also included, so we need to patch both binaries and python scripts; I ended up doing that "manually" but would love to hear if there's a better way.

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.

@FRidh
Copy link
Member

FRidh commented Mar 5, 2017

So these are the requirements:

libpebble2==0.0.26
enum34==1.0.4
httplib2==0.9.1
oauth2client==1.4.12
progressbar2==2.7.3
pyasn1==0.1.8
pyasn1-modules==0.0.6
pypng==0.0.17
pyqrcode==1.1
requests==2.7.0
rsa==3.1.4
pyserial==2.7
six==1.9.0
virtualenv==13.1.0
websocket-client==0.32.0
wheel==0.24.0
colorama==0.3.3
packaging==16.7
https://s3-us-west-2.amazonaws.com/pebble-sdk-homebrew/pypkjs-1.0.6.tar.gz

Apparently they have been fixed by something like pip freeze. For many of these dependencies there is absolutely no need to pin them.

Please try and use the packages we have currently in python-packages.nix. Aside from 1 or 2 all of them are already packaged. I highly doubt the sdk won't work without exactly these versions.

@FRidh
Copy link
Member

FRidh commented Mar 5, 2017

Furthermore, unless the sdk includes importable modules (i.e., its a library itself) you might want to use pythonEnv = python.withPackages(ps: dependencies) here.

@edanaher
Copy link
Contributor Author

edanaher commented Mar 5, 2017

@FRidh Thanks for the input! I'll try your advice.

@FRidh
Copy link
Member

FRidh commented Mar 18, 2017

What is the status of this PR?

@edanaher
Copy link
Contributor Author

I cleaned it up a bit, and thought it was better; I just noticed that travis-ci failed because I used "bsd" for one of the licenses instead of "bsd3"; I've fixed that and re-pushed.

Aside from that, I think it's good, but would be happy to get more feedback if you have any suggestions.

@edanaher
Copy link
Contributor Author

edanaher commented Apr 5, 2017

I'm a bit confused by that failing travis-ci build; it's failing with the following

error: a ‘aarch64-linux’ is required to build ‘/nix/store/yf3mids7kd7gwxbfpl2mkrd9wydl7h8j-binutils-2.28.drv’, but I am a ‘x86_64-linux’

But when I build locally (on x86_64), the sdk builds just fine, as does the nox-review command given in the PR checklist. And if I try to run the command from travis-ci (travis-nox-review-pr.sh), it fails due to a missing /nixos/release.nix.

Can I get a hand either with possible causes of the error or with how to reproduce it?

@7c6f434c
Copy link
Member

Well, there is nox package with nox-review wip --against upstream/master where upstream is the remote name; and for evaluation (which currently seems a problem, too) there is ./maintainers/scripts/test-eval-release.sh

rec {
libpebble2 = python27Packages.buildPythonPackage {
name = "libpebble2-0.0.26";
src = pkgs.fetchurl {
Copy link
Contributor

Choose a reason for hiding this comment

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

You could use fetchPypi here

@c0bw3b
Copy link
Contributor

c0bw3b commented Nov 13, 2017

@edanaher do you still want this merged? If you could rebase it on master and resolve the conflicts, please. :)

And take a look at fetchPypi for libpebble2

@edanaher
Copy link
Contributor Author

Yeah... I never managed to figure out the travis failure, and it Works For Me for now, so I kind of gave up on the PR. Maybe I'll take another look at it in the next few days.

@c0bw3b
Copy link
Contributor

c0bw3b commented Nov 13, 2017

The Travis failures were probably unrelated to your commits so don't worry about it.
BTW we just got rid of it. :) (replaced by a new bot/borg)

Evan Danaher and others added 5 commits December 8, 2017 12:04
Caught by travis-ci; nicely done!
- peewee
- pypng
- progressbar2
- pyqrcode
- wsgiref
- Don't require exact versions of python packages
- Use existing python packages where appropriate
- Use pythonEnv to set up the python dependencies
- Other minor cleanups
@edanaher
Copy link
Contributor Author

Whoops; didn't mean to push this yet. It's rebased and conflicts are resolved, but still needs some cleanup from a few months of bitrot.

@@ -0,0 +1,77 @@
{ pkgs, stdenv, lib, fetchurl, makeWrapper
Copy link
Member

Choose a reason for hiding this comment

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

no pkgs

@@ -0,0 +1,77 @@
{ pkgs, stdenv, lib, fetchurl, makeWrapper
, python27, python27Packages
Copy link
Member

Choose a reason for hiding this comment

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

either python27 or python27Packages

sha256 = "15yiypx9rnwyzsn4s4z1wmn1naw6mk7dpsiljmw3078ag66z1ca7";
};

pythonEnv = (python27.withPackages (ps: with ps; builtins.attrValues pebble-libs ++
Copy link
Member

Choose a reason for hiding this comment

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

this can go in a let .. in

@@ -0,0 +1,59 @@
{ pkgs, python27Packages }:
Copy link
Member

Choose a reason for hiding this comment

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

No pkgs

{ pkgs, python27Packages }:

rec {
libpebble2 = python27Packages.buildPythonPackage rec {
Copy link
Member

Choose a reason for hiding this comment

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

I suggest using with python27Packages; at the top

@@ -6484,6 +6484,23 @@ in {
};
};

peewee = buildPythonPackage rec {
name = "peewee-2.8.8";
Copy link
Member

Choose a reason for hiding this comment

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

The name attribute is added by buildPython* and should therefore be removed.

pyphen = callPackage ../development/python-modules/pyphen {};

pypng = buildPythonPackage rec {
Copy link
Member

Choose a reason for hiding this comment

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

We are moving Python expressions out of pkgs/top-level/python-packages.nix into pkgs/development/python-modules/<module>/default.nix.

Please move the expression there, and call it from pkgs/top-level/python-packages.nix using callPackage ../development/python-modules/<package> { };.

@@ -16242,6 +16274,22 @@ in {
};
});

progressbar2 = buildPythonPackage (rec {
Copy link
Member

Choose a reason for hiding this comment

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

We are moving Python expressions out of pkgs/top-level/python-packages.nix into pkgs/development/python-modules/<module>/default.nix.

Please move the expression there, and call it from pkgs/top-level/python-packages.nix using callPackage ../development/python-modules/<package> { };.

@@ -18314,6 +18362,24 @@ in {
};
in if isPy3k then py3 else py2;

pyqrcode = buildPythonPackage rec {
Copy link
Member

Choose a reason for hiding this comment

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

We are moving Python expressions out of pkgs/top-level/python-packages.nix into pkgs/development/python-modules/<module>/default.nix.

Please move the expression there, and call it from pkgs/top-level/python-packages.nix using callPackage ../development/python-modules/<package> { };.

@@ -20519,6 +20585,20 @@ EOF

magic-wormhole = callPackage ../development/python-modules/magic-wormhole { };

wsgiref = buildPythonPackage rec {
Copy link
Member

Choose a reason for hiding this comment

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

We are moving Python expressions out of pkgs/top-level/python-packages.nix into pkgs/development/python-modules/<module>/default.nix.

Please move the expression there, and call it from pkgs/top-level/python-packages.nix using callPackage ../development/python-modules/<package> { };.

@FRidh
Copy link
Member

FRidh commented Feb 11, 2018

Because of inactivity I will close this PR. When you do like to get this in, please make the required changes and open a new PR.

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

5 participants