From 7461f37f31931717fcd733c0a41f8ec570ad9019 Mon Sep 17 00:00:00 2001 From: chinmayshah99 Date: Mon, 24 Jan 2022 03:01:31 +0530 Subject: [PATCH] added release support --- .github/workflows/publish.yml | 95 +++++++++++++++++++++++++++++++++++ Makefile | 4 ++ pipeline_dp/__init__.py | 2 + pyproject.toml | 33 ++++++------ setup.cfg | 22 ++++++++ setup.py | 44 ++++++++++++++++ 6 files changed, 186 insertions(+), 14 deletions(-) create mode 100644 .github/workflows/publish.yml create mode 100644 setup.cfg create mode 100644 setup.py diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 00000000..e79cdd7c --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,95 @@ +name: Publish PipelineDP + +on: + release: + types: [published] + +jobs: + deploy: + strategy: + fail-fast: false + max-parallel: 3 + matrix: + os: [ubuntu-latest] + python-version: [3.8] + runs-on: ${{ matrix.os }} + + steps: + - uses: actions/checkout@v2 + with: + submodules: true + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + + - name: Setup msbuild Windows + if: runner.os == 'Windows' + uses: microsoft/setup-msbuild@v1.0.2 + + - name: Fix Paths Windows + # Make sure that tar.exe from Git is used not from Windows + if: runner.os == 'Windows' + run: | + @("C:\Program Files\Git\usr\bin") + (Get-Content $env:GITHUB_PATH) | Set-Content $env:GITHUB_PATH -Encoding utf8 + + - name: Build Pipeline DP Windows + if: runner.os == 'Windows' + timeout-minutes: 20 + run: | + $PYTHONHOME=$(python -c 'import sys; print(sys.executable);').replace('\', '/') + $PYTHONPATH=$(python -c "import sys; print([x for x in sys.path if 'site-packages' in x][0]);").replace('\', '/') + echo "PYTHONHOME=$PYTHONHOME" + echo "PYTHONPATH=$PYTHONPATH" + echo "Running: ${{ matrix.os }}" + - name: Upgrade pip + run: | + pip install --upgrade --user pip + + - name: Install Poetry + run: | + pip install poetry + + - name: Get poetry cache dir + id: poetry-cache + run: | + echo "::set-output name=dir::$(poetry config cache-dir)" + + - name: poetry cache + uses: actions/cache@v2 + with: + path: ${{ steps.poetry-cache.outputs.dir }} + key: ${{ runner.os }}-pip-py${{ matrix.python-version }}-${{ hashFiles('**/pyproject.toml') }} + restore-keys: | + ${{ runner.os }}-pip-py${{ matrix.python-version }}- + + - name: Install dependencies + run: | + poetry install + + - name: Build PipelineDP Linux + run: | + poetry run python setup.py bdist_wheel + + - name: Install Wheel Unix + if: runner.os != 'Windows' + run: | + pip install `find -L ./ -name "*.whl"` + + - name: Import Package + run: | + python -c "import pipeline_dp; print(pipeline_dp.__version__)" + + + - name: Check Wheel Unix + if: runner.os != 'Windows' + run: | + poetry run twine check `find -L ./ -name "*.whl"` + + - name: Publishing the wheel + env: + TWINE_USERNAME: __token__ + TWINE_PASSWORD: ${{ secrets.TOKEN }} + run: | + poetry run twine upload --skip-existing dist/*.whl diff --git a/Makefile b/Makefile index 2c7499dc..9eca318b 100755 --- a/Makefile +++ b/Makefile @@ -22,3 +22,7 @@ precommit: lint test format clean .PHONY: dev dev: pip install -r requirements.dev.txt + +.PHONY: dist +dist: + python setup.py bdist_wheel \ No newline at end of file diff --git a/pipeline_dp/__init__.py b/pipeline_dp/__init__.py index 0bc984de..96a5d294 100644 --- a/pipeline_dp/__init__.py +++ b/pipeline_dp/__init__.py @@ -13,3 +13,5 @@ from pipeline_dp.pipeline_backend import BeamBackend from pipeline_dp.pipeline_backend import SparkRDDBackend from pipeline_dp import accumulator + +__version__ = '0.0.1rc0' diff --git a/pyproject.toml b/pyproject.toml index 672d2a01..d2cd3070 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,25 +1,30 @@ [tool.poetry] -name = "pipelinedp" -version = "0.1.0" +name = "pipeline-dp" +version = "0.0.1rc0" description = "" authors = ["Chinmay Shah ", "Vadym Doroshenko "] license = "Apache-2.0" [tool.poetry.dependencies] -python = "^3.6" -apache-beam = "^2.29.0" -pyspark = "^3.1.1" -absl-py = "^0.12.0" -dataclasses = {version = "^0.8", python = "~3.6"} -numpy = "<1.21" -scipy = "^1.5" -yapf = "^0.31.0" +python = "^3.8, < 3.11" +python-dp = "^1.1.1" +pyspark = "^3.2.0" +absl-py = "^1.0.0" +numpy = "^1.20.1" +apache-beam = "^2.35.0" +scipy = "^1.7.3" +dp-accounting = "^0.0.2" -[tool.poetry.dev-dependencies] -[tool.yapf] -based_on_style = "google" -indent_width = 4 +[tool.poetry.dev-dependencies] +yapf = "^0.32.0" +twine = "^3.7.1" +pytest = "^6.2.5" +pytest-timeout = "^2.1.0" +pylint = "2.12.0" +bumpversion = "==0.5.3" +wheel = "^0.37.1" +setuptools = "^60.5.0" [build-system] requires = ["poetry-core>=1.0.0"] diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 00000000..a45e0701 --- /dev/null +++ b/setup.cfg @@ -0,0 +1,22 @@ +[bumpversion] +current_version = 0.0.1rc0 +commit = True +tag = True + +[bumpversion:file:setup.py] +search = version='{current_version}' +replace = version='{new_version}' + +[bumpversion:file:pyproject.toml] +search = version='{current_version}' +replace = version='{new_version}' + +[bumpversion:file:pipeline_dp/__init__.py] +search = __version__ = '{current_version}' +replace = __version__ = '{new_version}' + +[bdist_wheel] +universal = 1 + +[flake8] +exclude = docs \ No newline at end of file diff --git a/setup.py b/setup.py new file mode 100644 index 00000000..e33afe45 --- /dev/null +++ b/setup.py @@ -0,0 +1,44 @@ +# -*- coding: utf-8 -*- +from setuptools import setup +import os + +packages = \ +['pipeline_dp'] + +package_data = \ +{'': ['*']} + +install_requires = \ +['absl-py>=1.0.0,<2.0.0', + 'apache-beam>=2.35.0,<3.0.0', + 'dp-accounting>=0.0.2,<0.0.3', + 'numpy>=1.20.1,<2.0.0', + 'pyspark>=3.2.0,<4.0.0', + 'python-dp>=1.1.1,<2.0.0', + 'scipy>=1.7.3,<2.0.0'] + + +def read(fname): + with open(os.path.join(os.path.dirname(__file__), fname), encoding="utf-8") as fp: + return fp.read() + +setup_kwargs = { + 'name': 'pipeline-dp', + 'version': '0.0.1rc0', + 'description': 'Framework for applying differential privacy to large datasets using batch processing systems', + 'author': 'Chinmay Shah', + 'author_email': 'chinmayshah3899@gmail.com', + 'maintainer': 'Vadym Doroshenko', + 'maintainer_email': 'dvadym@google.com', + 'url': 'https://github.com/OpenMined/PipelineDP/', + 'packages': packages, + 'package_data': package_data, + 'install_requires': install_requires, + 'python_requires': '>=3.8,<3.11', + 'long_description': read("README.md"), + 'long_description_content_type': 'text/markdown', + 'license': "Apache-2.0", +} + + +setup(**setup_kwargs)