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

Horis ci #41

Merged
merged 17 commits into from
Oct 16, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
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
Prev Previous commit
Next Next commit
Add gradle task for python package publishing
  • Loading branch information
IRyabov-HORIS committed Oct 11, 2019
commit 755eace3f1e115664bb1724279daf3b7bae775ec
9 changes: 8 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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=
#python_include_path=

# PyPI repository url
# python_repository_url=

# PyPI credentials for publishing
pypi_username=
pypi_password=
2 changes: 1 addition & 1 deletion python-package/HOWTO_JUPYTER.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
9 changes: 9 additions & 0 deletions python-package/HOWTO_PYPI_PUBLISH.txt
Original file line number Diff line number Diff line change
@@ -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)
35 changes: 33 additions & 2 deletions python-package/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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')
Expand All @@ -34,6 +62,9 @@ if (project.properties['python_include_path'] != null) {

build.dependsOn(buildPythonPackage)

localInstallPythonPackage.dependsOn(buildPythonPackage)
publishPythonPackage.dependsOn(buildPythonPackage)


} else {
println("------------------------------------------------------------------------------------------------")
Expand Down