google / differential-privacy

Google's differential privacy libraries.
Apache License 2.0
3.07k stars 346 forks source link

JAR release to Maven Central #80

Closed replomancer closed 3 years ago

replomancer commented 3 years ago

Hello,

It would be nice if the Java library was available for download from Maven Central. Using the library currently requires downloading the source code and building with bazel. Having a JAR on Maven Central would make it so much easier to install.

cmhh commented 3 years ago

Seconding this idea.

I'm currently trying to see if I can copy all the jars from the bazel-out folder, maybe make a single fat-jar, and then see if I can use it as an unmanaged dependency in an SBT project. I was curious at least to see if I could easily get the simply Java examples going in Scala. Also, if this works, then using the jar with the rJava package would be an easy path for using this library from R.

Edit I see there is a libdifferentialprivacy.jar file created as part of the build which I seem to be able to use. Should have looked more carefully. Still good to have this on Maven, though.

replomancer commented 3 years ago

@cmhh In case you're interested, we (OpenMined) have been experimenting with various JVM languages (including Scala) and we started building some demo notebooks on top of the differential-privacy library. What we do to get the notebooks running is in the first code cell we download the jar from my private server :slightly_smiling_face: I'd like to continue building more notebooks with a new jar from Maven.

For some things (IIRC autocomplete in Clojure repl) I also needed libsummary-proto-speed.jar next to libdifferentialprivacy.jar, so here's what used to work for me after "bazel build":

mvn install:install-file -Dfile=bazel-bin/main/com/google/privacy/differentialprivacy/libdifferentialprivacy.jar -DgroupId=com.google.privacy.differentialprivacy -DartifactId=libdifferentialprivacy -Dversion=1.0 -Dpackaging=jar

mvn install:install-file -Dfile=bazel-bin/external/com_google_differential_privacy/proto/libsummary-proto-speed.jar -DgroupId=com.google.differentialprivacy -DartifactId=libsummary-proto-speed -Dversion=1.0 -Dpackaging=jar
dibakch commented 3 years ago

I've pushed version 1.0.0 to maven central. Could you verify if this works for your project? Maven coordinates are com.google.privacy.differentialprivacy:differentialprivacy:1.0.0.

cmhh commented 3 years ago

I've pushed version 1.0.0 to maven central. Could you verify if this works for your project? Maven coordinates are com.google.privacy.differentialprivacy:differentialprivacy:1.0.0.

I've done a quick test using SBT and it looks good so far. I'll try and work through the all the examples from this repo. Thanks!

osuketh commented 3 years ago

@dibakch It would be nice if proto jars can be pushed as well. I want to use CountSummary, but it cannnot be imported like import com.google.privacy.differentialprivacy.proto.SummaryOuterClass.CountSummary;.

dibakch commented 3 years ago

Thanks @cmhh

@osuketh The protos are not part of the official API for Java. I'm wondering why you need the protos. Serialization returns a byte[] that can be used to be merged with the same algorithm on another machine. Note that we also changed the path for the protos since v1.0.0.

dibakch commented 3 years ago

I'm resolving this for now. Please feel free to re-open.