Package: python-plus
Overviewpython-plus adds various features to python 2 and python 3 programs.
It is designed to be used as integration of pypi future to help to port your code from
Python 2 to Python 3 and still have it run on Python 2.Overviewlist_requirements.py: list environment requirementsThis command is an internal command of python-plus but may be used as own command.
list_requirements.py displays the pypi and binaries packages needed to create a virtual
environment.
It is specially designed to show Odoo requirements.
Passing Odoo path it reads requirements.txt files in path and setup directories of OCA
repositories.vem: virtual environment managerThis command is an interactive tool with some nice features to manage standard virtual
environment.
Mainly it works ad standard pip but inside a specific virtual environment.UsageCode exampleclass / type testTest if a string is unicode.On Py2, this gives us:>>> s = 'Hello World'
>>> isinstance(object, str)
TrueOn Py3, this gives us:>>> s = b'Hello World'
>>> isinstance(object, bytes)
TrueThen, for example, the following code has the same effect on Py2 as on Py3:>>> from python_plus import isbytestr
>>> s = b'Hello World'
>>> isbytestr(s)
Truequoted stringUsing class __:>>> from python_plus import __>>> my_str_list = __('abc,"d,e",fgh')
>>> my_list = my_str_list.qsplit(my_str_list)
>>> print my_list
['abc', 'd,e', 'fgh']General function:>>> from python_plus import qsplit>>> my_str_list = 'abc,"d,e",fgh'
>>> my_list = qsplit(my_str_list)
>>> print my_list
['abc', 'd,e', 'fgh']Code reference`` str.qslit(sep=None, maxsplit=-1, quotes=[‘”’, ‘”’], escape=None, enquote=None, strip=None)``Like split function return a list of the words in the string, using sep as the delimiter string. If maxsplit is given, at most maxsplit splits are done (thus, the list will have at most maxsplit+1 elements). If maxsplit is not specified or -1, then there is no limit on the number of splits (all possible splits are made).If sep is given, consecutive delimiters are not grouped together and are deemed to delimit empty strings (for example, ‘1,,2’.split(‘,’) returns [‘1’, ‘’, ‘2’]). The sep argument may consist of multiple characters (for example, ‘1<>2<>3’.split(‘<>’) returns [‘1’, ‘2’, ‘3’]). Splitting an empty string with a specified separator returns [‘’].If quotes is given, it is used to recognize quoted string: the sep tokens inside quoted string are ignored. The paramters quotes may be a string or a list. If it is a string trailing and ending delimiters are the same, like usual python string; if list is given, the first element is initial delimiter and the second element is the final delimiter like in html tag.If escape is given, it is used to escape delimiters.If enquote is True, returned list elements are enquoted by delimiters.If strip is Tru, trailing and tailing spaces in returned list elements are removed.For example:>>> my_str_list = __('abc,"d,e",fgh')
>>> print my_str_list.qsplit(my_str_list)
['abc', 'd,e', 'fgh']vem: virtual environment managerUsage: vem.sh [-h][-a list][-BCD][-d paths][-E distro][-f][-F name][-gkIi][-l iso][-n][-O version][-o dir][-p pyver][-q][-r file][-stVvy] p3 p4 p5 p6 p7 p8 p9
Manage virtual environment
action may be: help amend cp check create exec info inspect install merge mv python shell rm show uninstall update test
 -h --help            this help
 -a list              bin packages to install (* means wkhtmltopdf,lessc)
 -B                   use unstable packages: -B testpypi / -BB from ~/tools / -BBB from ~/pypi / -BBBB link to local ~/pypi
 -C                   clear cache before executing pip command
 -D --devel           create v.environment with development packages
 -d --dep-path paths
                      odoo dependencies paths (comma separated)
 -E --distro distro
                      simulate Linux distro: like Ubuntu20 Centos7 etc (requires -n switch)
 -f --force           force v.environment create, even if exists or inside another virtual env
 -F name              simulate Linux family: may be RHEL or Debian (requires -n switch)
 -g --global          install npm packages globally
 -k --keep            keep python2 executable as python (deprecated)
 -I --indipendent     run pip in an isolated mode and set home virtual directory
 -i --isolated        run pip in an isolated mode, ignoring environment variables and user configuration
 -l --lang iso
                      set default language
 -n --dry_run         do nothing (dry-run)
 -O --odoo-ver version
                      install pypi required by odoo version (amend or create)
 -o --odoo-path dir
                      odoo path used to search odoo requirements
 -p --python pyver
                      python version
 -q --quiet           silent mode
 -r --requirement file
                      after created v.environment install from the given requirements file
 -s --system-site-pack
                      create v.environment with access to the global site-packages
 -t --travis          activate environment for travis test
 -V --version         show version
 -v --verbose         verbose mode
 -y --yes             assume yesvem is an interactive tool with some nice features to manage standard virtual environment.Action is one of:helpamend [OPTIONS] [SRC_VENV]check [OPTIONS] [SRC_VENV]cp [OPTIONS] SRC_VENV TGT_ENVcreate -p PYVER [OPTIONS] [VENV]exec [OPTIONS] [VENV] CMDinfo [OPTIONS] [VENV] PKGinstall [OPTIONS] [VENV] PKGmerge [OPTIONS] SRC_VENV TGT_ENVmv [OPTIONS] SRC_VENV TGT_ENVupdate [OPTIONS] [VENV] PKGuninstall [OPTIONS] [VENV] PKGtest [OPTIONS] [VENV]reset [OPTIONS] [VENV]show [OPTIONS] [VENV] PKGamend [OPTIONS] [SRC_VENV]Amend package versions against requirements.  May used after ‘create’ or ‘reset’ when requirements are changed.check [OPTIONS] [SRC_VENV]Compare package versions against requirements.  May be used after ‘create’ or ‘reset’ to check virtual environment
consistency.cp [OPTIONS] SRC_VENV TGT_ENVCopy SOURCE environment directory to TGT_ENV, like the bash command ‘cp’ and  set  relative  path  inside  virtual
environment to aim the new directory name.
Copying virtual environments is not well supported.
Each virtualenv has path information hard-coded into it, and there may be cases where the copy code does not know it needs to update a particular file.
Use with caution.create -p PYVER [OPTIONS] VENVCreate  a  new  virtual environment directory VENV like virtualenv command but with some nice features.  Switch -p
declare which python version will be used to create new environment.
This action can install various python packages to create a ready to use environment directory.
See -I -D -O -o -r switches to furthermore information.exec [OPTIONS] [SRC_VENV] CMD …Execute a command in virtual environment. Enclose command by quotes.info [OPTIONS] [SRC_VENV] PKGShow information about pypi package if installed in virtual environment (alias of show)install [OPTIONS] [SRC_VENV] PKGInstall pypi package or bin package into virtual environment.
Warning! currently just 2 bin packages can be installed: wkhtmltopdf and lesscshow [OPTIONS] [SRC_VENV] PKGShow information about pypi package if installed in virtual environment (alias of info)uninstall [OPTIONS] [SRC_VENV] PKGUninstall pypi package from virtual environment.update [OPTIONS] [SRC_VENV] PKGUpgrade pypi package in virtual environment.Getting startedPrerequisitesZeroincombenze tools requires:Linux Centos 7/8 or Debian 9/10 or Ubuntu 18/20/22python 2.7+, some tools require python 3.6+, best python 3.8+bash 5.0+InstallationStable version via Python Packagepip install python_plusCurrent version via Gitcd $HOME
git clone https://github.com/zeroincombenze/tools.git
cd ./tools
./install_tools.sh -p
source /opt/odoo/devel/activate_toolsUpgradeStable version via Python Packagepip install --upgrade python_plusCurrent version via Gitcd ./tools
./install_tools.sh -pUT
source $HOME/devel/activate_toolsChangeLog History2.0.11 (2024-02-05)[FIX] vem: show right python version if 3.10+[IMP] list_requirements.py improvements[IMP] new python version assignment from odoo version2.0.10 (2023-07-18)[IMP] list_requirements.py: werkzeug for Odoo 16.0[FIX] vem create: sometimes “virtualenv create” fails for python 2.7[IMP] pip install packages with use2to3 is backupgrdae to < 232.0.9 (2023-06-26)[IMP] list_requirements.py: werkzeug for Odoo 16.0[IMP] list_requirements.py: best recognize mixed version odoo/python[FIX] vem: commands return application status2.0.7 (2023-05-08)[IMP] list_requirements.py: upgrade version for Odoo 16.0[REF] vem: partial refactoring[IMP] Mots coverage test2.0.6 (2023-03-24)[IMP] list_requirements.py: cryptography, pypdf2, requests & urllib3 version adjustment[IMP] list_requirements.py: pypdf and pypdf2 version adjustment[IMP] list_requirements.py: best resolution when versions conflict[IMP] vem: set list_requirements.py executable2.0.5 (2022-12-23)[IMP] list_requirements.py: refactoring version control[IMP] vem: now amend can check current version (with -f switch)2.0.4 (2022-12-15)[IMP] Package version adjustment[IMP] vem: amend show current package version[IMP] vem: no python2 warning in linux kernel 3[FIX] vem: best recognition of python version2.0.3 (2022-11-08)[IMP] npm management[IMP] compute_date: refdate may be a string2.0.2.1 (2022-11-01)[FIX] Ensure coverage 5.0+2.0.2 (2022-10-20)[FIX] vem: wrong behavior with > o < in version[IMP] list_requirements.py: “Crypto.Cipher”: “pycrypto”2.0.1 (2022-10-12)[IMP] stable version2.0.0.3 (2022-09-14)[FIX] vem: install package with list_requirements.py2.0.0.2 (2022-09-10)[FIX] vem: no input inquire2.0.0.1 (2022-09-06)[IMP] vem: new switch -d for Odoo dependencies path[FIX] vem: create with best package list[FIX] vem: install odoo/openerp2.0.0 (2022-08-10)[IMP] Stable versionCreditsCopyrightSHS-AV s.r.l. <https://www.shs-av.com/>AuthorsSHS-AV s.r.l.ContributorsAntonio Maria VigliottiAntonio Maria Vigliotti