%global _empty_manifest_terminate_build 0 Name: python-dephell-venvs Version: 0.1.18 Release: 1 Summary: Manage virtual environments License: MIT URL: https://pypi.org/project/dephell-venvs/ Source0: https://mirrors.nju.edu.cn/pypi/web/packages/76/79/646c78687f459deb5e7a03568907039cd0c87403540571633b044e53b184/dephell_venvs-0.1.18.tar.gz BuildArch: noarch Requires: python3-attrs Requires: python3-dephell-pythons Requires: python3-requests %description ## Dephell VEnvs [![travis](https://travis-ci.org/dephell/dephell_venvs.svg?branch=master)](https://travis-ci.org/dephell/dephell_venvs) [![appveyor](https://ci.appveyor.com/api/projects/status/github/dephell/dephell_venvs?svg=true)](https://ci.appveyor.com/project/orsinium/dephell-venvs) [![MIT License](https://img.shields.io/pypi/l/dephell-venvs.svg)](https://github.com/dephell/dephell_venvs/blob/master/LICENSE) Manage Python virtual environments. ## Installation Install from [PyPI](https://pypi.org/project/dephell-venvs): ```bash python3 -m pip install --user dephell_venvs ``` ## Get venv from manager ```python from pathlib import Path from dephell_venvs import VEnv, VEnvs # pass here path with substitutions: venvs = VEnvs(path=Path() / '{project}-{digest}' / '{env}') ``` `VEnvs` gets argument `path` that is path to the virtual environment with substitutions: + `{project}` - last part of the path to the project. + `{digest}` - short hash of full path to the project to avoid collisions. + `{env}` - name of sub-environment because most of project need more than one environment. For example, `tests`, `docs`, `tests-py35`. Ways to get `VEnv` object from `VEnvs`: + `venvs.get(project_path, env)`. Pass here path to the project and sub-environment name and DepHell will substitute them is the path template and return `VEnv` instance for this path. + `venvs.get_by_name(name)`. Pass only name and this will be substituted as `{project}` and other substitutions (`{digest}`, `{env}`) will be just dropped out. + `venvs.current` -- returns current active venv if some venv is active. Example: ```python venv = venvs.get(project_path=Path('dephell_venvs'), env='pytest') # VEnv(path=PosixPath('dephell_venvs/pytest'), project='dephell_venvs', env='pytest') ``` ## Manage venv `VEnv` can be got from `VEnvs` ot created manually: ```python venv = VEnv(path=Path('venv')) ``` Check existence: ```python venv.exists() # False ``` Create and destroy: ```python venv.create() venv.destroy() ``` Some other useful information: ```python venv.bin_path # PosixPath('dephell_venvs-njyT/pytest/bin') venv.lib_path # PosixPath('dephell_venvs-njyT/pytest/lib/python3.7/site-packages') venv.python_path # PosixPath('dephell_venvs-njyT/pytest/bin/python3.7') venv.prompt # 'dephell_venvs/pytest' venv.python # Python(path=PosixPath('dephell_venvs-njyT/pytest/bin/python3.7'), version='3.7.0', implementation='python', abstract=False) ``` For details about `Python` object see [dephell_pythons](https://github.com/dephell/dephell_pythons). %package -n python3-dephell-venvs Summary: Manage virtual environments Provides: python-dephell-venvs BuildRequires: python3-devel BuildRequires: python3-setuptools BuildRequires: python3-pip %description -n python3-dephell-venvs ## Dephell VEnvs [![travis](https://travis-ci.org/dephell/dephell_venvs.svg?branch=master)](https://travis-ci.org/dephell/dephell_venvs) [![appveyor](https://ci.appveyor.com/api/projects/status/github/dephell/dephell_venvs?svg=true)](https://ci.appveyor.com/project/orsinium/dephell-venvs) [![MIT License](https://img.shields.io/pypi/l/dephell-venvs.svg)](https://github.com/dephell/dephell_venvs/blob/master/LICENSE) Manage Python virtual environments. ## Installation Install from [PyPI](https://pypi.org/project/dephell-venvs): ```bash python3 -m pip install --user dephell_venvs ``` ## Get venv from manager ```python from pathlib import Path from dephell_venvs import VEnv, VEnvs # pass here path with substitutions: venvs = VEnvs(path=Path() / '{project}-{digest}' / '{env}') ``` `VEnvs` gets argument `path` that is path to the virtual environment with substitutions: + `{project}` - last part of the path to the project. + `{digest}` - short hash of full path to the project to avoid collisions. + `{env}` - name of sub-environment because most of project need more than one environment. For example, `tests`, `docs`, `tests-py35`. Ways to get `VEnv` object from `VEnvs`: + `venvs.get(project_path, env)`. Pass here path to the project and sub-environment name and DepHell will substitute them is the path template and return `VEnv` instance for this path. + `venvs.get_by_name(name)`. Pass only name and this will be substituted as `{project}` and other substitutions (`{digest}`, `{env}`) will be just dropped out. + `venvs.current` -- returns current active venv if some venv is active. Example: ```python venv = venvs.get(project_path=Path('dephell_venvs'), env='pytest') # VEnv(path=PosixPath('dephell_venvs/pytest'), project='dephell_venvs', env='pytest') ``` ## Manage venv `VEnv` can be got from `VEnvs` ot created manually: ```python venv = VEnv(path=Path('venv')) ``` Check existence: ```python venv.exists() # False ``` Create and destroy: ```python venv.create() venv.destroy() ``` Some other useful information: ```python venv.bin_path # PosixPath('dephell_venvs-njyT/pytest/bin') venv.lib_path # PosixPath('dephell_venvs-njyT/pytest/lib/python3.7/site-packages') venv.python_path # PosixPath('dephell_venvs-njyT/pytest/bin/python3.7') venv.prompt # 'dephell_venvs/pytest' venv.python # Python(path=PosixPath('dephell_venvs-njyT/pytest/bin/python3.7'), version='3.7.0', implementation='python', abstract=False) ``` For details about `Python` object see [dephell_pythons](https://github.com/dephell/dephell_pythons). %package help Summary: Development documents and examples for dephell-venvs Provides: python3-dephell-venvs-doc %description help ## Dephell VEnvs [![travis](https://travis-ci.org/dephell/dephell_venvs.svg?branch=master)](https://travis-ci.org/dephell/dephell_venvs) [![appveyor](https://ci.appveyor.com/api/projects/status/github/dephell/dephell_venvs?svg=true)](https://ci.appveyor.com/project/orsinium/dephell-venvs) [![MIT License](https://img.shields.io/pypi/l/dephell-venvs.svg)](https://github.com/dephell/dephell_venvs/blob/master/LICENSE) Manage Python virtual environments. ## Installation Install from [PyPI](https://pypi.org/project/dephell-venvs): ```bash python3 -m pip install --user dephell_venvs ``` ## Get venv from manager ```python from pathlib import Path from dephell_venvs import VEnv, VEnvs # pass here path with substitutions: venvs = VEnvs(path=Path() / '{project}-{digest}' / '{env}') ``` `VEnvs` gets argument `path` that is path to the virtual environment with substitutions: + `{project}` - last part of the path to the project. + `{digest}` - short hash of full path to the project to avoid collisions. + `{env}` - name of sub-environment because most of project need more than one environment. For example, `tests`, `docs`, `tests-py35`. Ways to get `VEnv` object from `VEnvs`: + `venvs.get(project_path, env)`. Pass here path to the project and sub-environment name and DepHell will substitute them is the path template and return `VEnv` instance for this path. + `venvs.get_by_name(name)`. Pass only name and this will be substituted as `{project}` and other substitutions (`{digest}`, `{env}`) will be just dropped out. + `venvs.current` -- returns current active venv if some venv is active. Example: ```python venv = venvs.get(project_path=Path('dephell_venvs'), env='pytest') # VEnv(path=PosixPath('dephell_venvs/pytest'), project='dephell_venvs', env='pytest') ``` ## Manage venv `VEnv` can be got from `VEnvs` ot created manually: ```python venv = VEnv(path=Path('venv')) ``` Check existence: ```python venv.exists() # False ``` Create and destroy: ```python venv.create() venv.destroy() ``` Some other useful information: ```python venv.bin_path # PosixPath('dephell_venvs-njyT/pytest/bin') venv.lib_path # PosixPath('dephell_venvs-njyT/pytest/lib/python3.7/site-packages') venv.python_path # PosixPath('dephell_venvs-njyT/pytest/bin/python3.7') venv.prompt # 'dephell_venvs/pytest' venv.python # Python(path=PosixPath('dephell_venvs-njyT/pytest/bin/python3.7'), version='3.7.0', implementation='python', abstract=False) ``` For details about `Python` object see [dephell_pythons](https://github.com/dephell/dephell_pythons). %prep %autosetup -n dephell-venvs-0.1.18 %build %py3_build %install %py3_install install -d -m755 %{buildroot}/%{_pkgdocdir} if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi pushd %{buildroot} if [ -d usr/lib ]; then find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst fi if [ -d usr/lib64 ]; then find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst fi if [ -d usr/bin ]; then find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst fi if [ -d usr/sbin ]; then find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst fi touch doclist.lst if [ -d usr/share/man ]; then find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst fi popd mv %{buildroot}/filelist.lst . mv %{buildroot}/doclist.lst . %files -n python3-dephell-venvs -f filelist.lst %dir %{python3_sitelib}/* %files help -f doclist.lst %{_docdir}/* %changelog * Wed Apr 12 2023 Python_Bot - 0.1.18-1 - Package Spec generated