From 07e436007fdde521613d63585a8c868e81b5ed8d Mon Sep 17 00:00:00 2001 From: Ivan Ryabov Date: Wed, 9 Oct 2019 16:42:12 +0300 Subject: [PATCH 01/15] Move python include path param to gradle.properties --- gradle.properties | 5 ++++- python-extension/build.gradle | 39 ++++++++++++++++++++--------------- python-package/build.gradle | 0 3 files changed, 26 insertions(+), 18 deletions(-) create mode 100644 python-package/build.gradle diff --git a/gradle.properties b/gradle.properties index 9f92a054b54..6eb5531595f 100644 --- a/gradle.properties +++ b/gradle.properties @@ -22,4 +22,7 @@ ktor_version=1.2.3 rootProject.name=datalore-plot -org.gradle.warning.mode=all \ No newline at end of file +org.gradle.warning.mode=all + + +#python_include_path= \ No newline at end of file diff --git a/python-extension/build.gradle b/python-extension/build.gradle index f923478572f..57b60c3608c 100644 --- a/python-extension/build.gradle +++ b/python-extension/build.gradle @@ -4,34 +4,39 @@ plugins { } kotlin { - macosX64() { - binaries { - staticLib { - baseName = "datalore-plot-${project.name}" + if (project.properties['python_include_path'] != null && project.properties['python_include_path'] != "") { + macosX64() { + binaries { + staticLib { + baseName = "datalore-plot-${project.name}" + } } - } - compilations.main.cinterops { - python { - compilerOpts "-I$System.env.PYTHON_INCLUDE" + compilations.main.cinterops { + python { + compilerOpts "-I${project.properties['python_include_path']}" + } } } - } - linuxX64() { - binaries { - sharedLib { - baseName = "datalore-plot-${project.name}" + linuxX64() { + binaries { + sharedLib { + baseName = "datalore-plot-${project.name}" + } } - } - compilations.main.cinterops { - python { - compilerOpts "-I$System.env.PYTHON_INCLUDE" + compilations.main.cinterops { + python { + compilerOpts "-I${project.properties['python_include_path']}" + } } } + } else { + println("AAAAAAAAAAAAAAAAAAAAAAAAAAA!!!") } + sourceSets { commonMain { dependencies { diff --git a/python-package/build.gradle b/python-package/build.gradle new file mode 100644 index 00000000000..e69de29bb2d From b81dd5c7e696f7bf24913b947a341b78f64ac9ad Mon Sep 17 00:00:00 2001 From: Ivan Ryabov Date: Thu, 10 Oct 2019 12:50:40 +0300 Subject: [PATCH 02/15] Add python package building with gradle --- build.gradle | 6 ------ gradle.properties | 8 ++++++++ python-extension/build.gradle | 6 ++++-- python-package/build.gradle | 26 ++++++++++++++++++++++++++ settings.gradle | 1 + 5 files changed, 39 insertions(+), 8 deletions(-) diff --git a/build.gradle b/build.gradle index aeed2d948fd..40e9a876c93 100644 --- a/build.gradle +++ b/build.gradle @@ -12,12 +12,6 @@ allprojects { // println "--- project ---: $project.name $project.rootDir" } -task printProps { - doLast { - println System.env.PYTHON_INCLUDE - } -} - def publishedProjects = [ 'base-portable', 'base', diff --git a/gradle.properties b/gradle.properties index 6eb5531595f..c9055947b82 100644 --- a/gradle.properties +++ b/gradle.properties @@ -25,4 +25,12 @@ rootProject.name=datalore-plot org.gradle.warning.mode=all +# ------------------------------------------------------------------- +# Python settings +# ------------------------------------------------------------------- + +# Python binary (for building datalore-plot python package) +python_bin=python3 + +# Set this path for building datalore-plot python package #python_include_path= \ No newline at end of file diff --git a/python-extension/build.gradle b/python-extension/build.gradle index 57b60c3608c..12cb0d8e6a9 100644 --- a/python-extension/build.gradle +++ b/python-extension/build.gradle @@ -4,7 +4,7 @@ plugins { } kotlin { - if (project.properties['python_include_path'] != null && project.properties['python_include_path'] != "") { + if (project.properties['python_include_path'] != null) { macosX64() { binaries { staticLib { @@ -33,7 +33,9 @@ kotlin { } } } else { - println("AAAAAAAAAAAAAAAAAAAAAAAAAAA!!!") + println("------------------------------------------------------------------------------------------------") + println("Python package build unavailable. Please set \"python_include_path\" property in gradle.properties file.") + println("------------------------------------------------------------------------------------------------") } diff --git a/python-package/build.gradle b/python-package/build.gradle index e69de29bb2d..bac8619ac92 100644 --- a/python-package/build.gradle +++ b/python-package/build.gradle @@ -0,0 +1,26 @@ +plugins { + id 'kotlin-multiplatform' +} + +if (project.properties['python_include_path'] != null) { + if (project.properties['python_bin'] != null) { + task installPythonPackage(type:Exec) { + workingDir project.projectDir + + commandLine project.properties['python_bin'], 'setup.py', 'install' + } + + installPythonPackage.dependsOn(':python-extension:build') + + build.dependsOn(installPythonPackage) + } else { + println("------------------------------------------------------------------------------------------------") + println("Python package build unavailable. Please set \"python_bin\" property in gradle.properties file.") + println("------------------------------------------------------------------------------------------------") + } + +} else { + println("------------------------------------------------------------------------------------------------") + println("Python package build unavailable. Please set \"python_include_path\" property in gradle.properties file.") + println("------------------------------------------------------------------------------------------------") +} diff --git a/settings.gradle b/settings.gradle index abe435c5a9e..479e7e32d31 100644 --- a/settings.gradle +++ b/settings.gradle @@ -36,6 +36,7 @@ include 'base-portable', 'visualization-demo-svg-mapper', 'visualization-demo-plot', 'python-extension', + 'python-package', 'js-package', 'jvm-jfx-package', 'test-common' From b02a86abb743b397a773f286a4d28217a72591e0 Mon Sep 17 00:00:00 2001 From: Valentin Dovidaytis Date: Thu, 10 Oct 2019 15:49:26 +0300 Subject: [PATCH 03/15] Added Travis CI config. --- .travis.yml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 00000000000..9b5625405c3 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,18 @@ +language: java + +os: linux +dist: bionic +jdk: oraclejdk8 + +branches: + only: + - horis-ci + +before_install: + - sudo apt install -y python3-dev + +install: true + +env: ORG_GRADLE_PROJECT_python_include_path=/usr/include/python3.6m + +script: ./gradlew build From df2c5c69a2c64f3d01008645a4707dac2ab0be02 Mon Sep 17 00:00:00 2001 From: Ivan Ryabov Date: Thu, 10 Oct 2019 16:54:49 +0300 Subject: [PATCH 04/15] Separate python package building from local installing --- gradle.properties | 6 +++--- python-package/build.gradle | 32 +++++++++++++++++++++++++++----- 2 files changed, 30 insertions(+), 8 deletions(-) diff --git a/gradle.properties b/gradle.properties index c9055947b82..9db1e48039b 100644 --- a/gradle.properties +++ b/gradle.properties @@ -29,8 +29,8 @@ org.gradle.warning.mode=all # Python settings # ------------------------------------------------------------------- -# Python binary (for building datalore-plot python package) -python_bin=python3 +# Python bin path (for building datalore-plot python package) +python_bin_path=/home/iryabov/.datalore/anaconda/bin # Set this path for building datalore-plot python package -#python_include_path= \ No newline at end of file +python_include_path=/home/iryabov/.datalore/anaconda/include/python3.7m \ No newline at end of file diff --git a/python-package/build.gradle b/python-package/build.gradle index bac8619ac92..21bf579a5d1 100644 --- a/python-package/build.gradle +++ b/python-package/build.gradle @@ -2,17 +2,39 @@ plugins { id 'kotlin-multiplatform' } +def PYTHON_BIN_PATH_PROPERTY = "python_bin_path" + if (project.properties['python_include_path'] != null) { - if (project.properties['python_bin'] != null) { - task installPythonPackage(type:Exec) { + if (project.properties[PYTHON_BIN_PATH_PROPERTY] != null) { + + + task updateJs(type:Exec) { + workingDir project.projectDir + + commandLine "${project.properties[PYTHON_BIN_PATH_PROPERTY]}/python3", 'setup.py', 'updatejs' + } + + task buildPythonPackage(type:Exec) { workingDir project.projectDir - commandLine project.properties['python_bin'], 'setup.py', 'install' + commandLine "${project.properties[PYTHON_BIN_PATH_PROPERTY]}/python3", 'setup.py', 'bdist_wheel', "--dist-dir=${project.buildDir}/dist" } - installPythonPackage.dependsOn(':python-extension:build') + task localInstallPythonPackage(type:Exec) { + workingDir "${project.buildDir}/dist" + + commandLine "${project.properties[PYTHON_BIN_PATH_PROPERTY]}/pip3", 'install', '--no-index', '--find-links=./', 'datalore-plot' + } + + updateJs.dependsOn(':js-package:build') + + buildPythonPackage.dependsOn(':python-extension:build') + + buildPythonPackage.dependsOn(updateJs) + + build.dependsOn(buildPythonPackage) + - build.dependsOn(installPythonPackage) } else { println("------------------------------------------------------------------------------------------------") println("Python package build unavailable. Please set \"python_bin\" property in gradle.properties file.") From 8fb6a084f475f8f02cacf9f80e33f34951feab5a Mon Sep 17 00:00:00 2001 From: Ivan Ryabov Date: Thu, 10 Oct 2019 17:06:55 +0300 Subject: [PATCH 05/15] Remove paths from gradle-properties --- gradle.properties | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gradle.properties b/gradle.properties index 9db1e48039b..89866d71a9b 100644 --- a/gradle.properties +++ b/gradle.properties @@ -30,7 +30,7 @@ org.gradle.warning.mode=all # ------------------------------------------------------------------- # Python bin path (for building datalore-plot python package) -python_bin_path=/home/iryabov/.datalore/anaconda/bin +python_bin_path=/usr/bin # Set this path for building datalore-plot python package -python_include_path=/home/iryabov/.datalore/anaconda/include/python3.7m \ No newline at end of file +#python_include_path= \ No newline at end of file From 44495e89bb78cf5535853919ef43fbc3e325c222 Mon Sep 17 00:00:00 2001 From: Ivan Ryabov Date: Fri, 11 Oct 2019 12:28:46 +0300 Subject: [PATCH 06/15] Fix python package installing on MacOS --- python-package/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python-package/build.gradle b/python-package/build.gradle index 21bf579a5d1..ce2891c0b03 100644 --- a/python-package/build.gradle +++ b/python-package/build.gradle @@ -23,7 +23,7 @@ if (project.properties['python_include_path'] != null) { task localInstallPythonPackage(type:Exec) { workingDir "${project.buildDir}/dist" - commandLine "${project.properties[PYTHON_BIN_PATH_PROPERTY]}/pip3", 'install', '--no-index', '--find-links=./', 'datalore-plot' + commandLine "${project.properties[PYTHON_BIN_PATH_PROPERTY]}/pip", 'install', '--no-index', '--find-links=./', 'datalore-plot' } updateJs.dependsOn(':js-package:build') From a6c901cb52a3d37954d8f03b5c3d2b90cd2c4c1f Mon Sep 17 00:00:00 2001 From: Ivan Ryabov Date: Fri, 11 Oct 2019 12:42:06 +0300 Subject: [PATCH 07/15] Fix updateJS task after renaming --- python-package/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python-package/build.gradle b/python-package/build.gradle index ce2891c0b03..9b3c82238cf 100644 --- a/python-package/build.gradle +++ b/python-package/build.gradle @@ -11,7 +11,7 @@ if (project.properties['python_include_path'] != null) { task updateJs(type:Exec) { workingDir project.projectDir - commandLine "${project.properties[PYTHON_BIN_PATH_PROPERTY]}/python3", 'setup.py', 'updatejs' + commandLine "${project.properties[PYTHON_BIN_PATH_PROPERTY]}/python3", 'setup.py', 'update_js' } task buildPythonPackage(type:Exec) { From 294eebd04b2e78e9e8e9beca03bcc610cb390cc9 Mon Sep 17 00:00:00 2001 From: Ivan Ryabov Date: Fri, 11 Oct 2019 15:42:16 +0300 Subject: [PATCH 08/15] Fix readme --- python-package/HOWTO_JUPYTER.txt | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/python-package/HOWTO_JUPYTER.txt b/python-package/HOWTO_JUPYTER.txt index 7af87c20497..379b55f0101 100644 --- a/python-package/HOWTO_JUPYTER.txt +++ b/python-package/HOWTO_JUPYTER.txt @@ -1,18 +1,12 @@ - Jupyter must be installed in Python environment (IPython.display is required) -- set PYTHON_INCLUDE environment variable with path to python include path +- set `python_include_path` and `python_bin_path` properties in gradle.properties file. - build project (gradle) -In terminal: - - create/activate Python environment (I use conda) - - cd to datalore-plot/python-package - - copy all JS to package data: python setup.py update_js - - install python package (egg): python setup.py install - or - - build and install wheel: - python setup.py bdist_wheel - pip install --no-index --find-links=dist/ datalore-plot +- uninstall datalore-plot with `pip uninstall datalore-plot` if needed + +- run localInstallPythonPackage gradle task from python-package module (./gredlew :python-package:localInstallPythonPackage) Start local web-server to serve our js scripts (from /datalore-plot/plot-demo/build/demoWeb/lib): From 755eace3f1e115664bb1724279daf3b7bae775ec Mon Sep 17 00:00:00 2001 From: Ivan Ryabov Date: Fri, 11 Oct 2019 16:01:50 +0300 Subject: [PATCH 09/15] Add gradle task for python package publishing --- gradle.properties | 9 ++++++- python-package/HOWTO_JUPYTER.txt | 2 +- python-package/HOWTO_PYPI_PUBLISH.txt | 9 +++++++ python-package/build.gradle | 35 +++++++++++++++++++++++++-- 4 files changed, 51 insertions(+), 4 deletions(-) create mode 100644 python-package/HOWTO_PYPI_PUBLISH.txt diff --git a/gradle.properties b/gradle.properties index 89866d71a9b..81c21405e63 100644 --- a/gradle.properties +++ b/gradle.properties @@ -33,4 +33,11 @@ org.gradle.warning.mode=all python_bin_path=/usr/bin # Set this path for building datalore-plot python package -#python_include_path= \ No newline at end of file +#python_include_path= + +# PyPI repository url +# python_repository_url= + +# PyPI credentials for publishing +pypi_username= +pypi_password= \ No newline at end of file diff --git a/python-package/HOWTO_JUPYTER.txt b/python-package/HOWTO_JUPYTER.txt index 379b55f0101..6e521ef553b 100644 --- a/python-package/HOWTO_JUPYTER.txt +++ b/python-package/HOWTO_JUPYTER.txt @@ -6,7 +6,7 @@ - uninstall datalore-plot with `pip uninstall datalore-plot` if needed -- run localInstallPythonPackage gradle task from python-package module (./gredlew :python-package:localInstallPythonPackage) +- run localInstallPythonPackage gradle task from python-package module (./gradlew :python-package:localInstallPythonPackage) Start local web-server to serve our js scripts (from /datalore-plot/plot-demo/build/demoWeb/lib): diff --git a/python-package/HOWTO_PYPI_PUBLISH.txt b/python-package/HOWTO_PYPI_PUBLISH.txt new file mode 100644 index 00000000000..def8d1af179 --- /dev/null +++ b/python-package/HOWTO_PYPI_PUBLISH.txt @@ -0,0 +1,9 @@ +- twine must be installed (pip install twine) + +- set `pypi_username` and `pypi_password` properties in gradle.properties file. + +- if needed set `python_repository_url` property in gradle.properties file. + +- build project (gradle) + +- run publishPythonPackage gradle task from python-package module (./gradlew :python-package:publishPythonPackage) \ No newline at end of file diff --git a/python-package/build.gradle b/python-package/build.gradle index 9b3c82238cf..78a3a72cd16 100644 --- a/python-package/build.gradle +++ b/python-package/build.gradle @@ -3,6 +3,7 @@ plugins { } def PYTHON_BIN_PATH_PROPERTY = "python_bin_path" +def PYTHON_REPOSITORY_URL_PROPERTY = "python_repository_url" if (project.properties['python_include_path'] != null) { if (project.properties[PYTHON_BIN_PATH_PROPERTY] != null) { @@ -17,13 +18,40 @@ if (project.properties['python_include_path'] != null) { task buildPythonPackage(type:Exec) { workingDir project.projectDir - commandLine "${project.properties[PYTHON_BIN_PATH_PROPERTY]}/python3", 'setup.py', 'bdist_wheel', "--dist-dir=${project.buildDir}/dist" + commandLine "${project.properties[PYTHON_BIN_PATH_PROPERTY]}/python3", + 'setup.py', + 'bdist_wheel', + "--dist-dir=${project.buildDir}/dist" } task localInstallPythonPackage(type:Exec) { workingDir "${project.buildDir}/dist" - commandLine "${project.properties[PYTHON_BIN_PATH_PROPERTY]}/pip", 'install', '--no-index', '--find-links=./', 'datalore-plot' + commandLine "${project.properties[PYTHON_BIN_PATH_PROPERTY]}/pip", + 'install', + '--no-index', + '--find-links=./', + 'datalore-plot' + } + + task publishPythonPackage(type:Exec) { + workingDir "${project.buildDir}/dist" + + if (project.properties[PYTHON_REPOSITORY_URL_PROPERTY] != null) { + commandLine "${project.properties[PYTHON_BIN_PATH_PROPERTY]}/twine", + "upload", + "--repository-url", + project.properties[PYTHON_REPOSITORY_URL_PROPERTY], + "-u", + project.properties["pypi_username"], + "-p", + project.properties["pypi_password"], + "./*" + } else { + commandLine "${project.properties[PYTHON_BIN_PATH_PROPERTY]}/twine", + "upload", + "./*" + } } updateJs.dependsOn(':js-package:build') @@ -34,6 +62,9 @@ if (project.properties['python_include_path'] != null) { build.dependsOn(buildPythonPackage) + localInstallPythonPackage.dependsOn(buildPythonPackage) + publishPythonPackage.dependsOn(buildPythonPackage) + } else { println("------------------------------------------------------------------------------------------------") From 55b488c5dfbaeaf6f0c041393329d8535ad8f1e7 Mon Sep 17 00:00:00 2001 From: Ivan Ryabov Date: Fri, 11 Oct 2019 16:37:51 +0300 Subject: [PATCH 10/15] Add bintray plugin --- build.gradle | 9 +++++++++ gradle.properties | 12 +++++++++++- python-package/build.gradle | 6 +++--- 3 files changed, 23 insertions(+), 4 deletions(-) diff --git a/build.gradle b/build.gradle index 140d02f7b42..e43c93f83e5 100644 --- a/build.gradle +++ b/build.gradle @@ -4,6 +4,8 @@ plugins { id 'org.jetbrains.gradle.plugin.idea-ext' version '0.5' apply false // executing node scripts (adds support for Yarn. Also - NPM, Grunt and Gulp) id 'com.moowork.node' version '1.3.1' apply false + // publishing to bintray + id "com.jfrog.bintray" version "1.8.4" } @@ -62,3 +64,10 @@ subprojects { } } } + +if (hasProperty('bintray_user') && hasProperty('bintray_key')) { + bintray { + user = bintray_user + key = bintray_key + } +} \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index 81c21405e63..e691213869b 100644 --- a/gradle.properties +++ b/gradle.properties @@ -40,4 +40,14 @@ python_bin_path=/usr/bin # PyPI credentials for publishing pypi_username= -pypi_password= \ No newline at end of file +pypi_password= + + + +# ------------------------------------------------------------------- +# Bintray settings +# ------------------------------------------------------------------- + +# Bintray credentials +bintray_user= +bintray_key= \ No newline at end of file diff --git a/python-package/build.gradle b/python-package/build.gradle index 78a3a72cd16..23ba5781b59 100644 --- a/python-package/build.gradle +++ b/python-package/build.gradle @@ -5,8 +5,8 @@ plugins { def PYTHON_BIN_PATH_PROPERTY = "python_bin_path" def PYTHON_REPOSITORY_URL_PROPERTY = "python_repository_url" -if (project.properties['python_include_path'] != null) { - if (project.properties[PYTHON_BIN_PATH_PROPERTY] != null) { +if (hasProperty('python_include_path')) { + if (hasProperty(PYTHON_BIN_PATH_PROPERTY)) { task updateJs(type:Exec) { @@ -37,7 +37,7 @@ if (project.properties['python_include_path'] != null) { task publishPythonPackage(type:Exec) { workingDir "${project.buildDir}/dist" - if (project.properties[PYTHON_REPOSITORY_URL_PROPERTY] != null) { + if (hasProperty(PYTHON_REPOSITORY_URL_PROPERTY)) { commandLine "${project.properties[PYTHON_BIN_PATH_PROPERTY]}/twine", "upload", "--repository-url", From 0ab79b7952c5022d0c079b34593a8399a5b28a22 Mon Sep 17 00:00:00 2001 From: Ivan Ryabov Date: Mon, 14 Oct 2019 17:28:15 +0300 Subject: [PATCH 11/15] Fix python publishing gradle task. --- python-package/build.gradle | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/python-package/build.gradle b/python-package/build.gradle index 23ba5781b59..fa24a17fe61 100644 --- a/python-package/build.gradle +++ b/python-package/build.gradle @@ -3,7 +3,6 @@ plugins { } def PYTHON_BIN_PATH_PROPERTY = "python_bin_path" -def PYTHON_REPOSITORY_URL_PROPERTY = "python_repository_url" if (hasProperty('python_include_path')) { if (hasProperty(PYTHON_BIN_PATH_PROPERTY)) { @@ -37,7 +36,7 @@ if (hasProperty('python_include_path')) { task publishPythonPackage(type:Exec) { workingDir "${project.buildDir}/dist" - if (hasProperty(PYTHON_REPOSITORY_URL_PROPERTY)) { + if (project.properties["python_repository_url"] != null) { commandLine "${project.properties[PYTHON_BIN_PATH_PROPERTY]}/twine", "upload", "--repository-url", From 9cf7c26e35c5ec3da7bc2a7193927a9332c7897a Mon Sep 17 00:00:00 2001 From: Ivan Ryabov Date: Mon, 14 Oct 2019 18:14:32 +0300 Subject: [PATCH 12/15] Add README files for python and js packages --- gradle.properties | 6 +++--- js-package/README.md | 14 ++++++++++++++ python-package/README.md | 33 +++++++++++++++++++++++++++++++++ 3 files changed, 50 insertions(+), 3 deletions(-) create mode 100644 js-package/README.md create mode 100644 python-package/README.md diff --git a/gradle.properties b/gradle.properties index e691213869b..1f1bd24a3f2 100644 --- a/gradle.properties +++ b/gradle.properties @@ -33,14 +33,14 @@ org.gradle.warning.mode=all python_bin_path=/usr/bin # Set this path for building datalore-plot python package -#python_include_path= +# python_include_path= # PyPI repository url # python_repository_url= # PyPI credentials for publishing -pypi_username= -pypi_password= +# pypi_username= +# pypi_password= diff --git a/js-package/README.md b/js-package/README.md new file mode 100644 index 00000000000..29a15211118 --- /dev/null +++ b/js-package/README.md @@ -0,0 +1,14 @@ +# datalorePlot JS library. + +## Building + +* build project with Gradle (`./gradlew build`) + +* take library files in `js-package/build/dist` directory + + +## Publishing in Bintray CDN + +* set `bintray_user` and `bintray_api_key` in `gradle.properties` with your Bintray credentials + +* run `:js-package:bintrayUpload` gradle task (`./gradlew :js-package:bintrayUpload`) \ No newline at end of file diff --git a/python-package/README.md b/python-package/README.md new file mode 100644 index 00000000000..fad9081f4e1 --- /dev/null +++ b/python-package/README.md @@ -0,0 +1,33 @@ +# datalore-plot Python package + +## Building + +* install `python-dev` package (if you use Anaconda it's already installed) + +* install python `setuptools` (run `pip install setuptools`) + +* set `python_include_path` in `gradle.properties`. +For getting this path you can run `python -c "from sysconfig import get_paths as gp; print(gp()['include'])"`. + +* check if `python_bin_path` in `gradle.properties` contents true path to your python bin path (default is `/usr/bin`). +For getting this path you can run `python -c "from sysconfig import get_paths as gp; print(gp()['scripts'])"`. + +* build project with Gradle (run `./gradlew build`) + + +## Local installing + +* build package + +* run `:python-package:localInstallPythonPackage` gradle task (`./gradlew :python-package:localInstallPythonPackage`) + + +## Publishing + +* build package + +* set `pypi_username` and `pypi_password` in `gradle.properties` with your PyPI credentials + +* set `python_repository_url` in `gradle.properties` if you need publish to not standard PyPI repository (i.e. `https://test.pypi.org/legacy/` for testing publishing). + +* run `:python-package:publishPythonPackage` \ No newline at end of file From b6593e05216b16b7eecda2938925fb67108a2551 Mon Sep 17 00:00:00 2001 From: Ivan Ryabov Date: Wed, 16 Oct 2019 15:52:52 +0300 Subject: [PATCH 13/15] Fix python-package publishing --- python-package/build.gradle | 11 ++++++++--- python-package/setup.cfg | 3 --- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/python-package/build.gradle b/python-package/build.gradle index fa24a17fe61..15357c8f14f 100644 --- a/python-package/build.gradle +++ b/python-package/build.gradle @@ -2,7 +2,8 @@ plugins { id 'kotlin-multiplatform' } -def PYTHON_BIN_PATH_PROPERTY = "python_bin_path" +def PYTHON_BIN_PATH_PROPERTY = 'python_bin_path' +def PYTHON_REPOSITORY_URL_PROPERTY = 'python_repository_url' if (hasProperty('python_include_path')) { if (hasProperty(PYTHON_BIN_PATH_PROPERTY)) { @@ -36,7 +37,7 @@ if (hasProperty('python_include_path')) { task publishPythonPackage(type:Exec) { workingDir "${project.buildDir}/dist" - if (project.properties["python_repository_url"] != null) { + if (project.properties[PYTHON_REPOSITORY_URL_PROPERTY] != null) { commandLine "${project.properties[PYTHON_BIN_PATH_PROPERTY]}/twine", "upload", "--repository-url", @@ -49,6 +50,10 @@ if (hasProperty('python_include_path')) { } else { commandLine "${project.properties[PYTHON_BIN_PATH_PROPERTY]}/twine", "upload", + "-u", + project.properties["pypi_username"], + "-p", + project.properties["pypi_password"], "./*" } } @@ -62,7 +67,7 @@ if (hasProperty('python_include_path')) { build.dependsOn(buildPythonPackage) localInstallPythonPackage.dependsOn(buildPythonPackage) - publishPythonPackage.dependsOn(buildPythonPackage) + //publishPythonPackage.dependsOn(buildPythonPackage) } else { diff --git a/python-package/setup.cfg b/python-package/setup.cfg index 8449df346af..4f290e15d43 100644 --- a/python-package/setup.cfg +++ b/python-package/setup.cfg @@ -1,6 +1,3 @@ [metadata] # description-file = README.md license_file = ../LICENSE - -[bdist_wheel] -universal = 1 \ No newline at end of file From 1f1e0155f6dea2d495bf72a4ae5045e37aca6918 Mon Sep 17 00:00:00 2001 From: Ivan Ryabov Date: Wed, 16 Oct 2019 17:12:27 +0300 Subject: [PATCH 14/15] Add bintray uploading --- build.gradle | 9 +-------- js-package/build.gradle | 26 ++++++++++++++++++++++++++ 2 files changed, 27 insertions(+), 8 deletions(-) diff --git a/build.gradle b/build.gradle index e43c93f83e5..5bb6aa3b61a 100644 --- a/build.gradle +++ b/build.gradle @@ -5,7 +5,7 @@ plugins { // executing node scripts (adds support for Yarn. Also - NPM, Grunt and Gulp) id 'com.moowork.node' version '1.3.1' apply false // publishing to bintray - id "com.jfrog.bintray" version "1.8.4" + id "com.jfrog.bintray" version "1.8.4" apply false } @@ -63,11 +63,4 @@ subprojects { } } } -} - -if (hasProperty('bintray_user') && hasProperty('bintray_key')) { - bintray { - user = bintray_user - key = bintray_key - } } \ No newline at end of file diff --git a/js-package/build.gradle b/js-package/build.gradle index b2415bcabbb..618b0677d6e 100644 --- a/js-package/build.gradle +++ b/js-package/build.gradle @@ -1,6 +1,8 @@ plugins { id 'kotlin-multiplatform' id "com.moowork.node" + // publishing to bintray + id "com.jfrog.bintray" } repositories { mavenCentral() @@ -52,6 +54,30 @@ node { download = true } +if (hasProperty('bintray_user') && hasProperty('bintray_key')) { + bintray { + user = bintray_user + key = bintray_key + + filesSpec { + from 'build/dist' + into '.' + } + + publish = true + + pkg { + repo = 'datalore-plot' + name = 'datalore-plot-js' + licenses = ['MIT'] + vcsUrl = 'https://github.com/JetBrains/datalore-plot' + version { + name = '0.0.dev1' + } + } + } +} + repositories.whenObjectAdded { if (it instanceof IvyArtifactRepository) { metadataSources { From 3dde45b21a720f8c624b17456b7b4b7adb560b5b Mon Sep 17 00:00:00 2001 From: Ivan Ryabov Date: Wed, 16 Oct 2019 18:08:24 +0300 Subject: [PATCH 15/15] Fix package.json --- js-package/package.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/js-package/package.json b/js-package/package.json index 233e3e85c39..4afc694d554 100644 --- a/js-package/package.json +++ b/js-package/package.json @@ -1,7 +1,7 @@ { - "name": "demoweb", + "name": "datalore-plot-bundling", "version": "1.0.0", - "description": "", + "description": "file for setup js part bundling environment", "main": "plot-demo.js", "directories": { "lib": "lib" @@ -11,8 +11,8 @@ "webpack-build-dev": "webpack --config webpack.dev.config.js", "webpack-build-prod": "webpack --config webpack.prod.config.js" }, - "author": "", - "license": "ISC", + "author": "JetBrains", + "license": "MIT", "devDependencies": { "webpack": "^4.41.0", "webpack-cli": "^3.3.9"