Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
c02ba86
[#111] Set Up Auto Build and Push to PyPI
NovaVic May 3, 2020
3d5279c
[#111] Fixed a Typo
NovaVic May 3, 2020
85b7d8e
[#111] Trying to Fix Path Issue
NovaVic May 3, 2020
ede93e3
[#111] Cleanup
NovaVic May 3, 2020
81afba1
Merge https://github.com/NovaVic/PyDP into pypi
chinmayshah99 May 7, 2020
9cc3aea
added pypi publish workflow
chinmayshah99 May 7, 2020
0e83314
fixed typo
chinmayshah99 May 7, 2020
99a3e43
yet another typo
chinmayshah99 May 7, 2020
c161f52
removed osx
chinmayshah99 May 7, 2020
91fa710
moving it to test pypi temp
chinmayshah99 May 7, 2020
c53abe6
Update pypipublish_linux.yml
chinmayshah99 May 7, 2020
ea739f6
added many linux
chinmayshah99 May 7, 2020
c85e916
Merge https://github.com/OpenMined/PyDP into pypi
chinmayshah99 May 7, 2020
af53a2b
reformating
chinmayshah99 May 8, 2020
9e5bc6e
added many linux yet again
chinmayshah99 May 8, 2020
dc6458f
Update pypipublish_linux.yml
chinmayshah99 May 8, 2020
fb62fa8
Update pypipublish_linux.yml
chinmayshah99 May 8, 2020
b7e6689
Update pypipublish_linux.yml
chinmayshah99 May 8, 2020
fd20f54
Update pypipublish_linux.yml
chinmayshah99 May 8, 2020
adf3a23
Update pypipublish_linux.yml
chinmayshah99 May 8, 2020
f4a1d87
Add CENTOS 6 compliant bazel build to workflow
Benardi May 9, 2020
4fdf3ca
Merge pull request #4 from Benardi/pypi
chinmayshah99 May 9, 2020
27cd53f
added zip installation
chinmayshah99 May 9, 2020
c8dee93
moved bazel to 0.9.0
chinmayshah99 May 9, 2020
74037b2
fixed typo
chinmayshah99 May 9, 2020
c5dd91c
added alternate path for devtools-3
chinmayshah99 May 9, 2020
ed20a7e
Update pypipublish_linux.yml
chinmayshah99 May 9, 2020
4f9268e
latest version bazel + fixed dependencies
chinmayshah99 May 9, 2020
8d812d4
fixed pypi upload using ubuntu
chinmayshah99 May 10, 2020
2ddbf84
Fixed bug in setup.py wrt shared lib in purelib folder
chinmayshah99 May 10, 2020
6b92503
the package seems to manylinux1 rather than 2010
chinmayshah99 May 10, 2020
2fe030d
trying out without whl repair
chinmayshah99 May 10, 2020
6ff7f7c
Update pypipublish_linux.yml
chinmayshah99 May 10, 2020
c1b7b3f
fixed typo
chinmayshah99 May 10, 2020
b59f49b
some testing
chinmayshah99 May 10, 2020
1ce9104
rst rendering
chinmayshah99 May 10, 2020
c66ea8d
removed wheel version by mistake
chinmayshah99 May 10, 2020
fe8be68
Update pypipublish_linux.yml
chinmayshah99 May 10, 2020
103a96c
Merge pull request #5 from chinmayshah99/pypit
chinmayshah99 May 10, 2020
6b71f9c
removed auto python3.6 installation
chinmayshah99 May 10, 2020
1261bae
file version rename
chinmayshah99 May 10, 2020
ac15750
Update pypipublish_linux.yml
chinmayshah99 May 10, 2020
2676b8d
Update pypipublish_linux.yml
chinmayshah99 May 10, 2020
b4cc457
Update pypipublish_linux.yml
chinmayshah99 May 10, 2020
9130d0a
yet another test
chinmayshah99 May 10, 2020
7afec62
moved python setup earlier
chinmayshah99 May 10, 2020
ca7a656
Update setup.py
chinmayshah99 May 10, 2020
c93df51
release ready
chinmayshah99 May 11, 2020
31cd91e
Delete .travis.yml
chinmayshah99 May 11, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 67 additions & 0 deletions .github/workflows/pypipublish_linux.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: Linux Package PyPI deploy

on:
release:
types: [created]

jobs:
deploy:
strategy:
matrix:
os:
- ubuntu-latest
python-version: [3.5, 3.6, 3.7,3.8]

runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v2
- name: Set up submodules
run: |
bash ./ext_source_setup.sh
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
- name: Install pre-requisites
run: |
sudo apt-get update
# checking for g++
dpkg -s g++ &> /dev/null
if [ $? -eq 0 ]; then
echo "g++ is installed, skipping..."
else
echo "Installing g++"
sudo apt-get install g++
fi
echo "Installing Bazel dependencies"
sudo apt-get install pkg-config zip zlib1g-dev unzip
echo "Donwloading Bazel 2.1.0"
wget https://github.com/bazelbuild/bazel/releases/download/2.1.0/bazel-2.1.0-installer-linux-x86_64.sh

chmod +x bazel-2.1.0-installer-linux-x86_64.sh
./bazel-2.1.0-installer-linux-x86_64.sh --user
Comment on lines +40 to +43
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Do you require a specific version of bazel? Bazel 3.0 is installed on Ubuntu 18.06

Copy link
Copy Markdown
Member Author

@chinmayshah99 chinmayshah99 May 11, 2020

Choose a reason for hiding this comment

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

We have tested with this bazel version(2.1). Any upgrade in bazel versions needs to be tested

export PATH="$PATH:$HOME/bin"
- name: Build pydp lib
run: |
bash ./build_PyDP.sh

- name: Install python dependencies
run: |
python -m pip install --upgrade pip
pip install -r ./requirements_dev.txt

- name: Build wheel
run: |
python setup.py bdist_wheel

- name: Renaming wheel
run: |
find . -name '*linux*.whl' -type f -exec bash -c 'mv "$1" "${1/linux/manylinux1}"' -- {} \;
Comment on lines +58 to +60
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I don't agree that renaming is the way to go here, you should be using the auditwheel package for compliance, it might break on some systems.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

The package is manylinux1 compliant. So adding it here.
But in the meantime, we are in the process of looking for a permanent solution.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Hi there ,

@chinmayshah99 let’s open an issue as it is a good practise to normally use auditwheel to publish on PyPi.

It will enable to keep track or the changes.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Yeah, let's do this. Are you creating an issue?


- name: Publishing the wheel
env:
TWINE_USERNAME: "__token__"
TWINE_PASSWORD: ${{ secrets.TOKEN }}
run: |
twine upload --skip-existing dist/*.whl
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ If you'd like to contribute to this project please read these [guidelines](https

## Usage

As part of the 0.1.0 dev release, we have managed to port the Private Mean function (Bounded Mean). Other functions will be released in further release.
As part of the 0.1.1 dev release, we have managed to port the Private Mean function (Bounded Mean). Other functions will be released in further release.

To install the package:
`pip install python-dp`
Expand Down
2 changes: 1 addition & 1 deletion contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ $ python3 setup.py sdist bdist_wheel
Install wheel:

```
$ pip install dist/pydp-0.1.0-py2.py3-none-any.whl
$ pip install dist/*.whl
```

## Docker Support
Expand Down
54 changes: 54 additions & 0 deletions docs/readme.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
Introduction
============

PyDP is a Python wrapper for Google’s `Differential Privacy`_ project.
The library provides a set of ε-differentially private algorithms, which
can be used to produce aggregate statistics over numeric data sets
containing private or sensitive information.

PyDP is part of the OpenMined community, come join the movement on
`Slack`_.

Instructions
============

If you’d like to contribute to this project please read these
`guidelines`_.

Usage
-----

As part of the 0.1.1 dev release, we have managed to port the Private
Mean function (Bounded Mean). Other functions will be released in
further release.

To install the package: ``pip install python-dp``

::

import pydp as dp # imports the DP library

# To calculate the Bounded Mean
# epsilon is a number between 0 and 1 denoting privacy threshold
# It measures the acceptable loss of privacy (with 0 meaning no loss is acceptable)
# If both the lower and upper bounds are specified,
# x = dp.BoundedMean(epsilon: double, lower: int, upper: int)
x = dp.BoundedMean(0.6, 1, 10)

# If lower and upper bounds are not specified,
# DP library automatically calculates these bounds
# x = dp.BoundedMean(epsilon: double)
x = dp.BoundedMean(0.6)

# To get the result
# Currently supported data types are integer and float. Future versions will support additional data types
# Refer to examples/carrots.py for an introduction
x.result(input_data: list)

Known issue: If the privacy budget (epsilon is too less), we get a
StatusOR error in the command line. While this needs to be raised as an
error, right now, it’s just displayed as an error in logs.

.. _Differential Privacy: https://github.com/google/differential-privacy
.. _Slack: http://slack.openmined.org/
.. _guidelines: https://github.com/OpenMined/PyDP/blob/master/contributing.md
1 change: 1 addition & 0 deletions requirements_dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ tox==3.5.2
coverage==4.5.1
pytest
pycodestyle
twine
4 changes: 1 addition & 3 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
[bumpversion]
current_version = 0.1.0dev
current_version = 0.1.1dev
commit = True
tag = True

[bumpversion:file:setup.py]
search = version='{current_version}'
replace = version='{new_version}'

[bdist_wheel]
universal = 1

[pycodestyle]
max-line-length = 88
Expand Down
24 changes: 17 additions & 7 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,23 @@

from setuptools import setup, find_packages
from setuptools.dist import Distribution
from setuptools.command.install import install

import os


class InstallPlatlib(install):
def finalize_options(self):
install.finalize_options(self)
if self.distribution.has_ext_modules():
self.install_lib = self.install_platlib


class BinaryDistribution(Distribution):
"""This class is needed in order to create OS specific wheels."""
"""This class is needed in order to create OS specific wheels."""

def has_ext_modules(self):
return True
def has_ext_modules(self):
return True


def read(fname):
Expand All @@ -36,22 +45,23 @@ def read(fname):
"Programming Language :: Python :: 3.5",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
],
description="Python API for Google's Differential Privacy library",
distclass=BinaryDistribution,
install_requires=requirements,
license="Apache-2.0",
long_description=read("README.md"),
long_description_content_type="text/markdown",
long_description=read("docs/readme.rst"),
include_package_data=True,
keywords="pydp",
name="python-dp",
package_data={"pydp": ["pydp.so"],},
packages=find_packages(), # need to check this
packages=find_packages(exclude=["tests/"]), # need to check this
cmdclass={"install": InstallPlatlib},
setup_requires=setup_requirements,
test_suite="tests",
tests_require=test_requirements,
url="https://github.com/OpenMined/PyDP",
version="0.1.0",
version="0.1.1",
zip_safe=False,
)