![]() |
pyenv-virtualenv for Windows 1.2
A 'pyenv' plugin to manage Python virtual environments, depending on different Python versions, for various Python projects.
|
Functions | |
| str | fName (str natural_name) |
| Convert a natural name into stripped functional name, without spaces, which is lowercase, is file name safe and is technical safe. | |
| int | auditPlatform (str name) |
| Check if the program in running on the required platform. | |
| int | auditGlobalPythonVersion (str min_ver) |
| Check if Python version is greater or equal the given minimal version. | |
| int | auditPyEnv (str min_ver) |
| Check if "pyenv" version is greater or equal the given minimal version. | |
| str | getPyEnvVersion () |
| Get "pyenv" version. | |
| (str, str) | getPythonVersion () |
| Get selected global/local Python version in "pyenv". | |
| str | scanCwdAndAncestorsForFile (str file_name) |
| Scan the CWD and its path ancestors for a specific file. | |
| str | getGlobalStar (str ver) |
| Get the "*" marker for this version, if it is the globally selected version in "pyenv". | |
| bool | isPythonVenvVersion (str ver) |
| Check if the Python version is capable to run virtual environment. | |
| tuple[(str, None), int] | selectVersionDir (str ver, str realm, venv_capable=False) |
| Find the best version, matching the requirements. | |
| str | getColoredVenvCapability (str ver) |
| Get the colored virtual environment capability str for the specific version number or path. | |
| list[str] | getPythonVersions (str version=' *', bool venv_capable=False, bool as_paths=False) |
| Get list of installed Python version directories in "pyenv". | |
| bool | isJunction (str path) |
| Check if path is a junction, which has been created e.g. | |
| list[str] | getEnvJunctions (str path) |
| Scan the Pythons versions in "pyenv" for junctions, which points to a specific virtual environment directory path. | |
| str | getProjectPropertyFileStr (str file_path) |
| Get the content of project property file. | |
| int | setProjectProperties (str ver, str env) |
| Set/override project property files. | |
| list[str] | getEnvs (str ver, str name=' *', bool as_paths=False) |
| Get list of installed virtual environments for a specific Python version in "pyenv". | |
| list[str] | getAllEnvs (str name=' *', bool as_paths=False) |
| Get list of installed virtual environments for a specific Python version in "pyenv". | |
| tuple[str, str, str] | parseEnvDir (str env_dir) |
| Parse virtual environment directory path. | |
| int | unsetProjectProperties () |
| Set project property files. | |
| int | listProjectProperties (bool show_tree=False) |
| Display the table, which shows a list about project properties. | |
| (tuple, tuple[str]) | getTreeFoldersToExclude () |
| Get the directory tree folder names to exclude from project property file ".tree-excludes". | |
| str hlp.fName | ( | str | natural_name | ) |
Convert a natural name into stripped functional name, without spaces, which is lowercase, is file name safe and is technical safe.
NOTE: The resulting name is file name safe and also excludes all kind of technical used characters, including those to insert variables or HTML tags. By this pattern excluded characters are replaced by underscore "_".
| natural_name | Natural name to convert. |
Definition at line 71 of file hlp.py.
| int hlp.auditPlatform | ( | str | name | ) |
Check if the program in running on the required platform.
NOTE: Due the program is possibly started in an outdated Python 3 version, it is not permitted to use the library "log" inside this function. So, the "print" output must be manually leveled and colorized.
| name | Required platform name. |
Definition at line 85 of file hlp.py.
| int hlp.auditGlobalPythonVersion | ( | str | min_ver | ) |
Check if Python version is greater or equal the given minimal version.
NOTE: Due the program is possibly started in an outdated Python 3 version, it is not permitted to use the library "log" inside this function. So, the "print" output must be manually leveled and colorized.
| min_ver | Minimal permitted version in max. 3 numbers separated by dot (e.g. "3", "3.6", "3.6.5", etc.). |
Definition at line 148 of file hlp.py.
| int hlp.auditPyEnv | ( | str | min_ver | ) |
Check if "pyenv" version is greater or equal the given minimal version.
| min_ver | Minimal permitted version in max. 3 numbers separated by dot (e.g. "3", "3.6", "3.6.5", etc.). |
Definition at line 213 of file hlp.py.
| str hlp.getPyEnvVersion | ( | ) |
Get "pyenv" version.
Definition at line 315 of file hlp.py.
| (str, str) hlp.getPythonVersion | ( | ) |
Get selected global/local Python version in "pyenv".
Definition at line 331 of file hlp.py.
| str hlp.scanCwdAndAncestorsForFile | ( | str | file_name | ) |
Scan the CWD and its path ancestors for a specific file.
| file_name | Name of the file to find. |
Definition at line 353 of file hlp.py.
| str hlp.getGlobalStar | ( | str | ver | ) |
Get the "*" marker for this version, if it is the globally selected version in "pyenv".
| ver | Version to check as directory path or version string. |
Definition at line 375 of file hlp.py.
| bool hlp.isPythonVenvVersion | ( | str | ver | ) |
Check if the Python version is capable to run virtual environment.
| ver | Python version string or path to Python version folder to check. |
Definition at line 393 of file hlp.py.
| tuple[(str, None), int] hlp.selectVersionDir | ( | str | ver, |
| str | realm, | ||
| venv_capable = False ) |
Find the best version, matching the requirements.
Select best Python version directory.
| ver | Number of required version. |
| realm | Name of the realm, which sources the version number. |
| venv_capable | Flag to filter for venv-capable versions only. Default: False = no restrictions. |
Definition at line 431 of file hlp.py.
| str hlp.getColoredVenvCapability | ( | str | ver | ) |
Get the colored virtual environment capability str for the specific version number or path.
| ver | Python version number or path to observe. |
Definition at line 481 of file hlp.py.
| list[str] hlp.getPythonVersions | ( | str | version = '*', |
| bool | venv_capable = False, | ||
| bool | as_paths = False ) |
Get list of installed Python version directories in "pyenv".
| version | Exact or wildcard version name. Default: '*' = all. |
| venv_capable | Flag to filter for venv-capable versions only. Default: False = no restrictions. |
| as_paths | Flag to permit output as paths. Default: False = output as names. |
Definition at line 496 of file hlp.py.
| bool hlp.isJunction | ( | str | path | ) |
Check if path is a junction, which has been created e.g.
using the "mklink /J" command in Windows.
| path | The path to the possible junction. |
Definition at line 550 of file hlp.py.
| list[str] hlp.getEnvJunctions | ( | str | path | ) |
Scan the Pythons versions in "pyenv" for junctions, which points to a specific virtual environment directory path.
| path | Specific virtual environment directory path. |
Definition at line 561 of file hlp.py.
| str hlp.getProjectPropertyFileStr | ( | str | file_path | ) |
Get the content of project property file.
| file_path | Path to project property file. |
Definition at line 594 of file hlp.py.
| int hlp.setProjectProperties | ( | str | ver, |
| str | env ) |
Set/override project property files.
NOTE: The files are written into CWD.
| ver | Python version number. |
| env | Name of Python virtual environment under that version in "pyenv". |
Definition at line 611 of file hlp.py.
| list[str] hlp.getEnvs | ( | str | ver, |
| str | name = '*', | ||
| bool | as_paths = False ) |
Get list of installed virtual environments for a specific Python version in "pyenv".
Output as names or paths.
| ver | Number of required Python version as str or path to Python version. |
| name | Virtual environment name as str or wildcard str. Default: '*' = all. |
| as_paths | Flag to permit output as paths. Default: False = output as names. |
Definition at line 714 of file hlp.py.
| list[str] hlp.getAllEnvs | ( | str | name = '*', |
| bool | as_paths = False ) |
Get list of installed virtual environments for a specific Python version in "pyenv".
Output as names or paths.
| name | Virtual environment name as str or wildcard str. Default: '*' = all. |
| as_paths | Flag to permit output as paths. Default: False = output as names. |
Definition at line 765 of file hlp.py.
| tuple[str, str, str] hlp.parseEnvDir | ( | str | env_dir | ) |
Parse virtual environment directory path.
| env_dir | Path to version-based virtual environment directory in "pyenv". |
Definition at line 819 of file hlp.py.
| int hlp.unsetProjectProperties | ( | ) |
Set project property files.
NOTE: The files will be removed from CWD.
Definition at line 831 of file hlp.py.
| int hlp.listProjectProperties | ( | bool | show_tree = False | ) |
Display the table, which shows a list about project properties.
NOTE: The project property files are located in the project folder with the application executable/script. Change directory to that location before you use a feature, which outputs the project properties.
| show_tree | Enable tree output. Default: False. |
Definition at line 868 of file hlp.py.
| (tuple, tuple[str]) hlp.getTreeFoldersToExclude | ( | ) |
Get the directory tree folder names to exclude from project property file ".tree-excludes".
Definition at line 999 of file hlp.py.