From 4f4180bb825497d5ad9f85848564eff01a68a94c Mon Sep 17 00:00:00 2001 From: Viktor Vorobev <vorobev@in.tum.de> Date: Thu, 16 Dec 2021 11:29:16 +0000 Subject: [PATCH] Merged in NRRPLT-8403-pynrp-package (pull request #36) NRRPLT-8403 pynrp auto package build and push to nexus * [NRRPLT-8403] PyPi package build and push * [NRRPLT-8403] fetch tags * [NRRPLT-8403] update docs * [NRRPLT-8403] update docs * Merged development into NRRPLT-8403-pynrp-package * [NRRPLT-8103] Update instructions Approved-by: Eloy Retamino --- .ci/whl-package.bash | 13 +++++++ Jenkinsfile | 19 ++++++++++ .../doc/source/developer_manual.rst | 3 +- hbp_nrp_virtual_coach/doc/source/pypi.rst | 35 +++++++++++++++++++ 4 files changed, 69 insertions(+), 1 deletion(-) create mode 100644 .ci/whl-package.bash create mode 100644 hbp_nrp_virtual_coach/doc/source/pypi.rst diff --git a/.ci/whl-package.bash b/.ci/whl-package.bash new file mode 100644 index 0000000..221e552 --- /dev/null +++ b/.ci/whl-package.bash @@ -0,0 +1,13 @@ +#!/bin/bash +set -e + +# Build package +git fetch --tags +PYNRP_VERSION=$(git describe --tags --always) + +echo "${PYNRP_VERSION}" +echo "VERSION = \"${PYNRP_VERSION}\"" > hbp_nrp_virtual_coach/pynrp/version.py + +pushd hbp_nrp_virtual_coach +python3 setup.py sdist bdist_wheel +popd diff --git a/Jenkinsfile b/Jenkinsfile index 4c90936..4c67b04 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -34,6 +34,8 @@ pipeline { TOPIC_BRANCH = "${TOPIC_BRANCH}" DEFAULT_BRANCH = "${DEFAULT_BRANCH}" + NexusPyPiRepoUrl = "https://nexus.neurorobotics.ebrains.eu/repository/nrp-pypi-internal/" + CODE_COVERAGE_LINE = 74 } agent { @@ -107,6 +109,23 @@ pipeline { } } } + + stage('Create package') { + steps { + bitbucketStatusNotify(buildState: 'INPROGRESS', buildName: 'Building pynrp') + + dir(env.GIT_CHECKOUT_DIR){ + // tbuild package + sh 'bash ./.ci/whl-package.bash' + // upload package + withCredentials([usernamePassword(credentialsId: 'nexusadmin', usernameVariable: 'USER', passwordVariable: 'PASSWORD')]) + { + sh 'pip3 install twine' + sh 'twine upload -u $USER -p $PASSWORD --repository-url ${NexusPyPiRepoUrl} hbp_nrp_virtual_coach/dist/*.whl' + } + } + } + } } post { diff --git a/hbp_nrp_virtual_coach/doc/source/developer_manual.rst b/hbp_nrp_virtual_coach/doc/source/developer_manual.rst index f8b9788..1e2833f 100644 --- a/hbp_nrp_virtual_coach/doc/source/developer_manual.rst +++ b/hbp_nrp_virtual_coach/doc/source/developer_manual.rst @@ -14,4 +14,5 @@ Virtual Coach developer space .. toctree:: :maxdepth: 2 - python_api \ No newline at end of file + python_api + pypi \ No newline at end of file diff --git a/hbp_nrp_virtual_coach/doc/source/pypi.rst b/hbp_nrp_virtual_coach/doc/source/pypi.rst new file mode 100644 index 0000000..06acba2 --- /dev/null +++ b/hbp_nrp_virtual_coach/doc/source/pypi.rst @@ -0,0 +1,35 @@ +.. _virtual-pypi: + +.. sectionauthor:: Viktor Vorobev <vorobev@in.tum.de> + +.. seealso:: + + :ref:`User manual<virtual_coach_intro>` / + :ref:`Tutorials<virtual-coach-tutorial>` / + :ref:`Developer pages<virtual_coach_dev_space>` + +Stand-alone installation +======================== + +The Virtual Coach is packed and published to PyPi repository. + +The official releases can be found `here <https://pypi.org/project/pynrp/>`_ and you can install it as + +.. code-block:: bash + + pip3 install pynrp + + +The intermediate packages are stored in internal PyPi repository with developer-only access. One requires the username and the password for the developers Nexus server to get them. The following command will help to install the specific version + +.. code-block:: bash + + pip3 install pynrp==<version> --index-url https://<user>:<pass>@nexus.neurorobotics.ebrains.eu/repository/nrp-pypi/simple/ --trusted-host nexus.neurorobotics.ebrains.eu --use-deprecated=legacy-resolver + +where + +* :code:`<user>` is your Nexus username; +* :code:`<pass>` is your Nexus password; +* :code:`<version>` is a package version, that is determined as :code:`git describe --tags --always` of your commit. + +You can browse the available versions `here <https://nexus.neurorobotics.ebrains.eu/#browse/browse:nrp-pypi-internal>`_. -- GitLab