From 3cc67349344d5ac6ad6abdc55ab45cb07af7d307 Mon Sep 17 00:00:00 2001 From: Anatolii Lishchynskyi Date: Fri, 22 Sep 2023 15:03:21 +0300 Subject: [PATCH 01/12] Update PyThemis installation instructions Mention that old pythemis_install is deprecated, don't remove that part yet. Describe how to build a .whl package and install it into venv. Draft for system package building and installing. --- .../themis/languages/python/installation.md | 52 +++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/content/themis/languages/python/installation.md b/content/themis/languages/python/installation.md index 68ae4ac5..75e9e88a 100644 --- a/content/themis/languages/python/installation.md +++ b/content/themis/languages/python/installation.md @@ -75,6 +75,58 @@ Once PyThemis is installed, you can [try out code examples](../examples/). If the stable package version does not suit your needs, you can manually build and install the latest version of Themis from source code. + 1. [Build and install Themis Core library](/themis/installation/installation-from-sources/) + into your system. + + 2. Create a "wheel" package + + + Run this command outside of virtual environment: + ```bash + make pythemis_make_wheel + ``` + + Result package filename will be printed at the end, like this: + ``` + Result: src/wrappers/themis/python/dist/pythemis-0.14.0-py2.py3-none-any.whl + ``` + + 3. Install PyThemis in your virtual environment + + Activate your virtual environment and run + ```bash + pip install src/wrappers/themis/python/dist/pythemis-0.14.0-py2.py3-none-any.whl + ``` + +If the virtual environment already contained PyThemis, +add `--force-reinstall` option to `pip install` to rewrite the previous version + + + +## Building latest version from source (deprecated) + +{{< hint warning >}} +[PEP 668](https://peps.python.org/pep-0668/) changed the way Python packages are managed. +It is now recommended to use `pip install` to only install packages into isolated virtual environments +while installing things system-wide should be done using OS package manager (like `apt` or `rpm`). +This means running `sudo make pythemis_install` is no longer recommended as it copies files +into system-managed Python directory that is no longer maintained by `pip`. +Consider building a `.whl` and installing it into your venv instead. +{{< /hint >}} + 1. [Build and install Themis Core library](/themis/installation/installation-from-sources/) into your system. From 3cdd69f7f71a02a97cbc81d53c1ec4b41990ed5d Mon Sep 17 00:00:00 2001 From: Anatolii Lishchynskyi Date: Mon, 25 Sep 2023 20:28:59 +0300 Subject: [PATCH 02/12] Update PyThemis build/install docs --- content/themis/languages/python/installation.md | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/content/themis/languages/python/installation.md b/content/themis/languages/python/installation.md index 75e9e88a..2e64b4fa 100644 --- a/content/themis/languages/python/installation.md +++ b/content/themis/languages/python/installation.md @@ -80,9 +80,6 @@ you can manually build and install the latest version of Themis from source code 2. Create a "wheel" package - - Run this command outside of virtual environment: ```bash make pythemis_make_wheel ``` @@ -92,15 +89,16 @@ you can manually build and install the latest version of Themis from source code Result: src/wrappers/themis/python/dist/pythemis-0.14.0-py2.py3-none-any.whl ``` - 3. Install PyThemis in your virtual environment + 3. Install PyThemis into virtual environment Activate your virtual environment and run ```bash - pip install src/wrappers/themis/python/dist/pythemis-0.14.0-py2.py3-none-any.whl + make pythemis_install_wheel ``` -If the virtual environment already contained PyThemis, -add `--force-reinstall` option to `pip install` to rewrite the previous version + Or run `pip install pythemis-...-none-any.whl` (the package file previously created). + If the virtual environment already contained PyThemis of the same version, + add `--force-reinstall` option to rewrite the previous package. + ## Building latest version from source (deprecated) From 42a8f12864dd68b78948554b43f230b22edf971e Mon Sep 17 00:00:00 2001 From: Anatolii Lishchynskyi Date: Wed, 27 Sep 2023 17:58:36 +0300 Subject: [PATCH 05/12] Update .deb building steps --- content/themis/languages/python/installation.md | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/content/themis/languages/python/installation.md b/content/themis/languages/python/installation.md index 5e142f54..bdcc3fcb 100644 --- a/content/themis/languages/python/installation.md +++ b/content/themis/languages/python/installation.md @@ -114,16 +114,22 @@ you can manually build and install the latest version of Themis from source code If the virtual environment already contained PyThemis of the same version, add `--force-reinstall` option to rewrite the previous package. -To install PyThemis globally, you need to create a system package first: +Alternatively, you could install PyThemis system-wide. * For Debian, Ubuntu: ```bash - make pythemis_deb + make pythemis_install_deb ``` + This will create a `.deb` package and install it with `sudo apt install`. + + Or run `make pythemis_deb` to just generate the package. The result will be located at `build/deb/python3-pythemis_..._all.deb`. - Install with `sudo dpkg -i `. Remove with `sudo apt remove python3-pythemis`. + There are two ways of installing it: + 1. `sudo apt install ./path/to/package.deb` (the `./` is important here!) + 2. `sudo dpkg -i path/to/package.deb` + The first one is preferred as it will install dependencies along with PyThemis itself, while `dpkg` might just complain and exit. From c4ffb1ac1c502619fa53422b3d3d0790a5f735f4 Mon Sep 17 00:00:00 2001 From: Anatolii Lishchynskyi Date: Thu, 28 Sep 2023 18:07:59 +0300 Subject: [PATCH 06/12] Rename pythemis_old_install -> pythemis_install --- content/themis/languages/python/installation.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/content/themis/languages/python/installation.md b/content/themis/languages/python/installation.md index bdcc3fcb..df809a12 100644 --- a/content/themis/languages/python/installation.md +++ b/content/themis/languages/python/installation.md @@ -139,7 +139,7 @@ Alternatively, you could install PyThemis system-wide. [PEP 668](https://peps.python.org/pep-0668/) changed the way Python packages are managed. It is now recommended to use `pip install` to only install packages into isolated virtual environments while installing things system-wide should be done using OS package manager (like `apt` or `rpm`). -This means running `sudo make pythemis_old_install` is no longer recommended as it copies files +This means running `sudo make pythemis_install` is no longer recommended as it copies files into system-managed Python directory (like `/usr/lib/python3.X/site-packages`) that is no longer maintained by `pip`. Consider building a `.whl` and installing it into your venv instead. {{< /hint >}} @@ -150,7 +150,7 @@ Consider building a `.whl` and installing it into your venv instead. 2. Install PyThemis package from the source code: ```bash - sudo make pythemis_old_install + sudo make pythemis_install ``` The package will be installed globally into the system. @@ -161,7 +161,7 @@ Consider building a `.whl` and installing it into your venv instead. make prepare_tests_all test_python ``` -To remove PyThemis after using `pythemis_old_install`, run +To remove PyThemis after using `pythemis_install`, run ```bash sudo pip uninstall --break-system-packages pythemis ``` From e29949b9ae12ce08f4b7692e1242a60b930fbfa1 Mon Sep 17 00:00:00 2001 From: Anatolii Lishchynskyi Date: Fri, 29 Sep 2023 16:42:09 +0300 Subject: [PATCH 07/12] Update PyThemis installation docs --- .../themis/languages/python/installation.md | 132 +++++++++++++----- 1 file changed, 96 insertions(+), 36 deletions(-) diff --git a/content/themis/languages/python/installation.md b/content/themis/languages/python/installation.md index df809a12..fe872c1f 100644 --- a/content/themis/languages/python/installation.md +++ b/content/themis/languages/python/installation.md @@ -80,56 +80,116 @@ you can manually build and install the latest version of Themis from source code 2. Install Python dependencies - For Debian, Ubuntu: + Depending on how you want to install PyThemis, there are different requirements. - ```bash - sudo apt install python3-setuptools python3-wheel python3-pip python3-venv - ``` + To create a `.whl` package for installation inside virtualenv, you'll need `setuptools` and `wheel` - For CentOS, RHEL: + * Install globally - ```bash - sudo yum install python3-setuptools python3-wheel python3-pip python3-venv - ``` + For Debian, Ubuntu: - 3. Create a "wheel" package + ```bash + sudo apt install python3-setuptools python3-wheel + ``` - ```bash - make pythemis_make_wheel - ``` + For CentOS, RHEL: - Result package filename will be printed at the end, like this: - ``` - Result: src/wrappers/themis/python/dist/pythemis-0.14.0-py2.py3-none-any.whl - ``` + ```bash + sudo yum install python3-setuptools python3-wheel + ``` - 4. Install PyThemis into virtual environment + * Or install into virtualenv - Activate your virtual environment and run - ```bash - make pythemis_install_wheel - ``` + ```bash + # activate virtualenv if not done yet + pip install setuptools wheel + ``` + + --- + + To create a system package (i.e. `.deb` one for Debian) you will need `pip` and `fpm` + + * Install globally + + For Debian, Ubuntu: + + ```bash + sudo apt install python3-pip lsb-release ruby + sudo gem install fpm + ``` + + For CentOS, RHEL: + + ```bash + sudo yum install python3-pip ruby + sudo gem install fpm + ``` + + On RHEL you also need to have working `pip` command. If it's not, and you only got `pip3`, + create a symlink like this: `sudo ln -s $(which pip3) /usr/bin/pip`. + + 3. Create a PyThemis package + + * Create a "wheel" for virtualenv + + {{< hint info >}} + If you installed dependencies globally, virtualenv should not be activated during wheel + generation since needed packages won't be visible in an isolated environment. + {{< /hint >}} + + ```bash + make pythemis_make_wheel + ``` + + Result package filename will be printed at the end, like this: + ``` + Result: src/wrappers/themis/python/dist/pythemis-0.14.0-py2.py3-none-any.whl + ``` + + * Create package for your distro + + For Debian, Ubuntu: + + ```bash + make pythemis_deb + ``` + + For CentOS, RHEL: + + ```bash + make pythemis_rpm + ``` + + The result will be located at `build/deb/python3-pythemis_..._all.deb` + or `build/rpm/python3-pythemis_..._all.rpm` respectively. + + 4. Install PyThemis + + * Install a wheel into virtualenv - Or manually run `pip install path/to/pythemis-...-none-any.whl` (the package file previously created). - If the virtual environment already contained PyThemis of the same version, - add `--force-reinstall` option to rewrite the previous package. + ```bash + # activate virtualenv if not done yet + make pythemis_install_wheel + ``` -Alternatively, you could install PyThemis system-wide. + Or manually run `pip install path/to/pythemis-...-none-any.whl` (the package file previously created). + If the virtual environment already contained PyThemis of the same version, + add `--force-reinstall` option to rewrite the previous package. -* For Debian, Ubuntu: + * Install system package - ```bash - make pythemis_install_deb - ``` + ```bash + make pythemis_install_deb + ``` + For manual installation, there are two ways: + 1. `sudo apt install ./path/to/package.deb` (the `./` is important here!) + 2. `sudo dpkg -i path/to/package.deb` - This will create a `.deb` package and install it with `sudo apt install`. + For CentOS, RHEL: - Or run `make pythemis_deb` to just generate the package. - The result will be located at `build/deb/python3-pythemis_..._all.deb`. - There are two ways of installing it: - 1. `sudo apt install ./path/to/package.deb` (the `./` is important here!) - 2. `sudo dpkg -i path/to/package.deb` - The first one is preferred as it will install dependencies along with PyThemis itself, while `dpkg` might just complain and exit. + ```bash + make pythemis_install_rpm + ``` From 329bb44059aa150d37a8a1ede77fce43e35f543b Mon Sep 17 00:00:00 2001 From: Anatolii Lishchynskyi Date: Fri, 29 Sep 2023 18:31:19 +0300 Subject: [PATCH 08/12] Comment RHEL-related PyThemis installation --- content/themis/languages/python/installation.md | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/content/themis/languages/python/installation.md b/content/themis/languages/python/installation.md index fe872c1f..506a7193 100644 --- a/content/themis/languages/python/installation.md +++ b/content/themis/languages/python/installation.md @@ -92,11 +92,13 @@ you can manually build and install the latest version of Themis from source code sudo apt install python3-setuptools python3-wheel ``` + * Or install into virtualenv @@ -118,6 +120,7 @@ you can manually build and install the latest version of Themis from source code sudo gem install fpm ``` + 3. Create a PyThemis package @@ -154,14 +158,16 @@ you can manually build and install the latest version of Themis from source code make pythemis_deb ``` + 4. Install PyThemis @@ -178,20 +184,23 @@ you can manually build and install the latest version of Themis from source code * Install system package + For Debian, Ubuntu: + ```bash make pythemis_install_deb ``` + For manual installation, there are two ways: 1. `sudo apt install ./path/to/package.deb` (the `./` is important here!) 2. `sudo dpkg -i path/to/package.deb` + +--> ## Building latest version from source (deprecated) From d58883b8b2560af91db3553e2d5a370b7d3bf9de Mon Sep 17 00:00:00 2001 From: Anatolii Lishchynskyi Date: Thu, 5 Oct 2023 23:48:11 +0300 Subject: [PATCH 09/12] Uncomment rpm building, other changes --- .../themis/languages/python/installation.md | 29 ++++++++----------- 1 file changed, 12 insertions(+), 17 deletions(-) diff --git a/content/themis/languages/python/installation.md b/content/themis/languages/python/installation.md index 506a7193..3d2b9292 100644 --- a/content/themis/languages/python/installation.md +++ b/content/themis/languages/python/installation.md @@ -92,18 +92,16 @@ you can manually build and install the latest version of Themis from source code sudo apt install python3-setuptools python3-wheel ``` - * Or install into virtualenv ```bash - # activate virtualenv if not done yet + # create and activate virtualenv if not done yet pip install setuptools wheel ``` @@ -116,15 +114,14 @@ you can manually build and install the latest version of Themis from source code For Debian, Ubuntu: ```bash - sudo apt install python3-pip lsb-release ruby + sudo apt install lsb-release python3-pip ruby sudo gem install fpm ``` - + The result will be located at `build/deb/python3-pythemis_...all.deb` + or `build/rpm/python3-pythemis_...all.rpm` respectively. 4. Install PyThemis @@ -187,20 +182,20 @@ you can manually build and install the latest version of Themis from source code For Debian, Ubuntu: ```bash - make pythemis_install_deb + sudo make pythemis_install_deb ``` For manual installation, there are two ways: 1. `sudo apt install ./path/to/package.deb` (the `./` is important here!) - 2. `sudo dpkg -i path/to/package.deb` + 2. `sudo dpkg -i path/to/package.deb` (need `apt install python3-six` beforehands) - + + Or manually run `sudo yum install ./path/to/package.rpm` ## Building latest version from source (deprecated) From 6c636f8b96fef754af309b0242c180f1fa4bfa3e Mon Sep 17 00:00:00 2001 From: Anatolii Lishchynskyi Date: Wed, 11 Oct 2023 13:24:42 +0300 Subject: [PATCH 10/12] Update PyThemis installation docs --- .../themis/languages/python/installation.md | 132 +++++++++--------- content/themis/languages/wasm/installation.md | 3 + 2 files changed, 69 insertions(+), 66 deletions(-) diff --git a/content/themis/languages/python/installation.md b/content/themis/languages/python/installation.md index 3d2b9292..678d15c0 100644 --- a/content/themis/languages/python/installation.md +++ b/content/themis/languages/python/installation.md @@ -75,14 +75,16 @@ Once PyThemis is installed, you can [try out code examples](../examples/). If the stable package version does not suit your needs, you can manually build and install the latest version of Themis from source code. +### Python wheel + +A package suitable for installation in Python virtual environments + 1. [Build and install Themis Core library](/themis/installation/installation-from-sources/) into your system. 2. Install Python dependencies - Depending on how you want to install PyThemis, there are different requirements. - - To create a `.whl` package for installation inside virtualenv, you'll need `setuptools` and `wheel` + You'll need `setuptools` and `wheel` * Install globally @@ -105,97 +107,95 @@ you can manually build and install the latest version of Themis from source code pip install setuptools wheel ``` - --- + 3. Create a PyThemis package - To create a system package (i.e. `.deb` one for Debian) you will need `pip` and `fpm` + {{< hint info >}} + If you installed dependencies globally, virtualenv should not be activated during wheel + generation since needed packages won't be visible in an isolated environment. + {{< /hint >}} - * Install globally - - For Debian, Ubuntu: + ```bash + make pythemis_make_wheel + ``` - ```bash - sudo apt install lsb-release python3-pip ruby - sudo gem install fpm - ``` + Result package filename will be printed at the end, like this: + ``` + Result: src/wrappers/themis/python/dist/pythemis-0.14.0-py2.py3-none-any.whl + ``` - For CentOS, RHEL: + 4. Install PyThemis - ```bash - sudo yum install redhat-lsb-core python3-pip ruby rpm-build - sudo gem install fpm - ``` + ```bash + # activate virtualenv if not done yet + make pythemis_install_wheel + ``` - On RHEL you also need to have working `pip` command. If it's not, and you only got `pip3`, - create a symlink like this: `sudo ln -s $(which pip3) /usr/bin/pip`. ---> + Or manually run `pip install path/to/pythemis-...-none-any.whl` (the package file previously created). + If the virtual environment already contained PyThemis of the same version, + add `--force-reinstall` option to rewrite the previous package. - 3. Create a PyThemis package +### OS package - * Create a "wheel" for virtualenv +A package for system-wide installation, for Debian-like and RHEL-like distros - {{< hint info >}} - If you installed dependencies globally, virtualenv should not be activated during wheel - generation since needed packages won't be visible in an isolated environment. - {{< /hint >}} + 1. [Build and install Themis Core library](/themis/installation/installation-from-sources/) + into your system. - ```bash - make pythemis_make_wheel - ``` + 2. Install Python dependencies - Result package filename will be printed at the end, like this: - ``` - Result: src/wrappers/themis/python/dist/pythemis-0.14.0-py2.py3-none-any.whl - ``` + For Debian, Ubuntu: - * Create package for your distro + ```bash + sudo apt install lsb-release python3-pip ruby + sudo gem install fpm + ``` - For Debian, Ubuntu: + For CentOS, RHEL: - ```bash - make deb_python - ``` + ```bash + sudo yum install redhat-lsb-core python3-pip ruby rpm-build + sudo gem install fpm + ``` - For CentOS, RHEL: + On RHEL you also need to have working `pip` command. If it's not, and you only got `pip3`, + create a symlink like this: `sudo ln -s $(which pip3) /usr/bin/pip`. - ```bash - make rpm_python - ``` + 3. Create a PyThemis package - The result will be located at `build/deb/python3-pythemis_...all.deb` - or `build/rpm/python3-pythemis_...all.rpm` respectively. + For Debian, Ubuntu: - 4. Install PyThemis + ```bash + make deb_python + ``` - * Install a wheel into virtualenv + For CentOS, RHEL: - ```bash - # activate virtualenv if not done yet - make pythemis_install_wheel - ``` + ```bash + make rpm_python + ``` - Or manually run `pip install path/to/pythemis-...-none-any.whl` (the package file previously created). - If the virtual environment already contained PyThemis of the same version, - add `--force-reinstall` option to rewrite the previous package. + The result will be located at `build/deb/python3-pythemis_...all.deb` + or `build/rpm/python3-pythemis_...all.rpm` respectively. - * Install system package + 4. Install PyThemis - For Debian, Ubuntu: + For Debian, Ubuntu: - ```bash - sudo make pythemis_install_deb - ``` + ```bash + sudo make pythemis_install_deb + ``` - For manual installation, there are two ways: - 1. `sudo apt install ./path/to/package.deb` (the `./` is important here!) - 2. `sudo dpkg -i path/to/package.deb` (need `apt install python3-six` beforehands) + For manual installation, there are two ways: + 1. `sudo apt install ./path/to/package.deb` (the `./` is important here) + 2. `sudo dpkg -i path/to/package.deb` (need to install `python3-six` and `libthemis` beforehands) - For CentOS, RHEL: + For CentOS, RHEL: - ```bash - sudo make pythemis_install_rpm - ``` + ```bash + sudo make pythemis_install_rpm + ``` - Or manually run `sudo yum install ./path/to/package.rpm` + Or manually run `sudo yum install ./path/to/package.rpm` ## Building latest version from source (deprecated) diff --git a/content/themis/languages/wasm/installation.md b/content/themis/languages/wasm/installation.md index 5c2e5bc6..4799d579 100644 --- a/content/themis/languages/wasm/installation.md +++ b/content/themis/languages/wasm/installation.md @@ -168,6 +168,9 @@ to learn more about managing toolchain versions. emmake make wasmthemis ``` + Be aware that build may fail if non-WASM Themis was previously build in this same directory. + In that case, run `make clean` before building WasmThemis. + The resulting package will be placed into `build/wasm-themis.tgz` in Themis source tree. From bb172882807ae333f9e4787ca406525417558442 Mon Sep 17 00:00:00 2001 From: Anatolii Lishchynskyi Date: Tue, 28 Nov 2023 21:44:04 +0200 Subject: [PATCH 11/12] Update content/themis/languages/python/installation.md Co-authored-by: vixentael --- content/themis/languages/python/installation.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/content/themis/languages/python/installation.md b/content/themis/languages/python/installation.md index 678d15c0..d0a8d4a3 100644 --- a/content/themis/languages/python/installation.md +++ b/content/themis/languages/python/installation.md @@ -197,7 +197,11 @@ A package for system-wide installation, for Debian-like and RHEL-like distros Or manually run `sudo yum install ./path/to/package.rpm` -## Building latest version from source (deprecated) +## Building Themis < 0.15 version from sources (deprecated) + +{{< hint warning >}} +The instructions below are relevant only for Themis older than 0.15. Most likely, you don't need to follow them, and should install the latest Themis instead. +{{< /hint >}} {{< hint warning >}} [PEP 668](https://peps.python.org/pep-0668/) changed the way Python packages are managed. From 814d4d049de7e0e1df12d82fec8a5ef5dfc7c044 Mon Sep 17 00:00:00 2001 From: Anatolii Lishchynskyi Date: Wed, 29 Nov 2023 19:55:43 +0200 Subject: [PATCH 12/12] Update after review --- content/themis/languages/python/installation.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/themis/languages/python/installation.md b/content/themis/languages/python/installation.md index d0a8d4a3..345e0162 100644 --- a/content/themis/languages/python/installation.md +++ b/content/themis/languages/python/installation.md @@ -73,7 +73,7 @@ Once PyThemis is installed, you can [try out code examples](../examples/). ## Building latest version from source If the stable package version does not suit your needs, -you can manually build and install the latest version of Themis from source code. +you can manually build python wheel or `.deb`/`.rpm` package and install the latest version of Themis from source code. ### Python wheel