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.minio: init at 4.0.11 #54972

Merged
merged 1 commit into from Mar 29, 2019
Merged

pythonPackages.minio: init at 4.0.11 #54972

merged 1 commit into from Mar 29, 2019

Conversation

peterromfeldhk
Copy link
Contributor

Motivation for this change
Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option 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/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Assured whether relevant documentation is up to date
  • Fits CONTRIBUTING.md.

@dotlambda
Copy link
Member

@peterromfeldhk You are packaging multiple Python packages. Will this lead up to packaging some specific application? If so, please replace these PRs by a single one.

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.

The commit message should equal this PR's title.

pkgs/development/python-modules/minio/default.nix Outdated Show resolved Hide resolved
pkgs/development/python-modules/minio/default.nix Outdated Show resolved Hide resolved
@peterromfeldhk
Copy link
Contributor Author

peterromfeldhk commented Jan 31, 2019

@peterromfeldhk You are packaging multiple Python packages. Will this lead up to packaging some specific application? If so, please replace these PRs by a single one.

oh ok.. will do.. yes the goal is to have all our project deps managed by nix to make easy nice containers :)

@peterromfeldhk
Copy link
Contributor Author

@dotlambda not sure i understand you correctly... i am packaging up a lot of deps from a private project, so i can use nix in future. should i do one big MR?

@dotlambda
Copy link
Member

i am packaging up a lot of deps from a private project

In that case, there won't be an application I can test the dependencies with. Hence no need to do a single PR.

@flokli
Copy link
Contributor

flokli commented Feb 5, 2019

The minio python libraries are quite useful, and generic enough to have them packaged in nixpkgs IMHO.

I updated the minio test to use the minio python bindings to create a file and check for it afterwards:

From 74b37052c34d5d3265037fb74b3a23dd05fbbe4f Mon Sep 17 00:00:00 2001
From: Florian Klink <flokli@flokli.de>
Date: Tue, 5 Feb 2019 18:31:39 +0100
Subject: [PATCH] minio: test minio python library in minio test

---
 nixos/tests/minio.nix | 29 +++++++++++++++++++++++++----
 1 file changed, 25 insertions(+), 4 deletions(-)

diff --git a/nixos/tests/minio.nix b/nixos/tests/minio.nix
index 40a59954665..f1218b53771 100644
--- a/nixos/tests/minio.nix
+++ b/nixos/tests/minio.nix
@@ -1,4 +1,24 @@
-import ./make-test.nix ({ pkgs, ...} : {
+import ./make-test.nix ({ pkgs, ...} :
+let
+    accessKey = "BKIKJAA5BMMU2RHO6IBB";
+    secretKey = "V7f1CwQqAcwo80UEIJEjc5gVQUSSx5ohQ9GSrr12";
+    minioPythonScript = pkgs.writeScript "minio-test.py" ''
+      #! ${pkgs.python3.withPackages(ps: [ ps.minio ])}/bin/python
+      import io
+      import os
+      from minio import Minio
+      minioClient = Minio('localhost:9000',
+                    access_key='${accessKey}',
+                    secret_key='${secretKey}',
+                    secure=False)
+      sio = io.BytesIO()
+      sio.write(b'Test from Python')
+      sio.seek(0, os.SEEK_END)
+      sio_len = sio.tell()
+      sio.seek(0)
+      minioClient.put_object('test-bucket', 'test.txt', sio, sio_len, content_type='text/plain')
+    '';
+  in {
   name = "minio";
   meta = with pkgs.stdenv.lib.maintainers; {
     maintainers = [ bachp ];
@@ -8,8 +28,7 @@ import ./make-test.nix ({ pkgs, ...} : {
     machine = { pkgs, ... }: {
       services.minio = {
         enable = true;
-        accessKey = "BKIKJAA5BMMU2RHO6IBB";
-        secretKey = "V7f1CwQqAcwo80UEIJEjc5gVQUSSx5ohQ9GSrr12";
+        inherit accessKey secretKey;
       };
       environment.systemPackages = [ pkgs.minio-client ];
 
@@ -25,9 +44,11 @@ import ./make-test.nix ({ pkgs, ...} : {
       $machine->waitForOpenPort(9000);
 
       # Create a test bucket on the server
-      $machine->succeed("mc config host add minio http://localhost:9000 BKIKJAA5BMMU2RHO6IBB V7f1CwQqAcwo80UEIJEjc5gVQUSSx5ohQ9GSrr12 S3v4");
+      $machine->succeed("mc config host add minio http://localhost:9000 ${accessKey} ${secretKey} S3v4");
       $machine->succeed("mc mb minio/test-bucket");
+      $machine->succeed("${minioPythonScript}");
       $machine->succeed("mc ls minio") =~ /test-bucket/ or die;
+      $machine->succeed("mc cat minio/test-bucket/test.txt") =~ /Test from Python/ or die;
       $machine->shutdown;
 
     '';
-- 
2.19.2

@peterromfeldhk could you git am this patch and rebase?

@flokli
Copy link
Contributor

flokli commented Mar 25, 2019

@GrahamcOfBorg test minio

accessKey = "BKIKJAA5BMMU2RHO6IBB";
secretKey = "V7f1CwQqAcwo80UEIJEjc5gVQUSSx5ohQ9GSrr12";
minioPythonScript = pkgs.writeScript "minio-test.py" ''
#! ${pkgs.python3.withPackages(ps: [ ps.minio ])}/bin/python
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
#! ${pkgs.python3.withPackages(ps: [ ps.minio ])}/bin/python
#! ${(pkgs.python3.withPackages (ps: [ ps.minio ])}).interpreter}

pkgs/development/python-modules/minio/default.nix Outdated Show resolved Hide resolved
pkgs/development/python-modules/minio/default.nix Outdated Show resolved Hide resolved
pkgs/development/python-modules/minio/default.nix Outdated Show resolved Hide resolved
@flokli
Copy link
Contributor

flokli commented Mar 29, 2019

@GrahamcOfBorg test minio

@flokli
Copy link
Contributor

flokli commented Mar 29, 2019

@GrahamcOfBorg build nixosTests.minio

@flokli flokli merged commit cb09c5b into NixOS:master Mar 29, 2019
@dotlambda
Copy link
Member

The commit message should equal this PR's title.

This was not fixed.

@flokli
Copy link
Contributor

flokli commented Mar 29, 2019

My bad, sorry :-/

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