Skip to content

[WIP] The next-gen virtualenv (rewrite) #1377

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
[coverage:report]
skip_covered = False
show_missing = True
exclude_lines =
\#\s*pragma: no cover
^\s*raise AssertionError\b
^\s*raise NotImplementedError\b
^\s*raise$
^if __name__ == ['"]__main__['"]:$
omit =
# site.py is ran before the coverage can be enabled, no way to measure coverage on this
src/virtualenv/interpreters/create/impl/cpython/site.py

[coverage:paths]
source =
src
.tox/*/lib/python*/site-packages
.tox/pypy*/site-packages
.tox\*\Lib\site-packages\
*/src
*\src

[coverage:run]
branch = false
parallel = true
source =
${_COVERAGE_SRC}
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,7 @@ dist
.vscode

/docs/_draft.rst
/pip-wheel-metadata
/src/virtualenv/version.py
/src/virtualenv/out
/*env*
10 changes: 5 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/ambv/black
rev: 19.3b0
rev: 19.10b0
hooks:
- id: black
args: [--safe]
Expand All @@ -15,13 +15,13 @@ repos:
rev: v1.9.3
hooks:
- id: seed-isort-config
args: [--application-directories, '.']
args: [--application-directories, '.:src']
- repo: https://github.com/pre-commit/mirrors-isort
rev: v4.3.21
hooks:
- id: isort
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.3.0
rev: v2.4.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
Expand All @@ -34,10 +34,10 @@ repos:
additional_dependencies: ["flake8-bugbear == 19.8.0"]
language_version: python3.7
- repo: https://github.com/asottile/pyupgrade
rev: v1.24.1
rev: v1.25.1
hooks:
- id: pyupgrade
- repo: https://github.com/pre-commit/pygrep-hooks
rev: v1.4.1
rev: v1.4.2
hooks:
- id: rst-backticks
30 changes: 10 additions & 20 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,22 +1,12 @@
include virtualenv.py
recursive-include virtualenv_support *.whl
recursive-include virtualenv_embedded *
include virtualenv_support/__init__.py
include pyproject.toml

include AUTHORS.txt
include LICENSE.txt

recursive-include tests *
recursive-include docs *
include tasks/*
include tox.ini
# setuptools-scm by default adds all SCM tracked files, we prune the following maintenance related ones (sdist only)
exclude .gitattributes
exclude .gitignore
exclude .github/*

exclude readthedocs.yml
exclude CONTRIBUTING.rst
exclude .pre-commit-config.yaml
exclude azure-run-tox-env.yml
exclude azure-pipelines.yml
exclude .gitignore
exclude .gitattributes
recursive-exclude .github *
exclude CONTRIBUTING.rst
exclude readthedocs.yml
exclude MANIFEST.in

exclude tasks/release.py
exclude tasks/upgrade_wheels.py
19 changes: 12 additions & 7 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,17 @@ pr:
- master

variables:
PYTEST_ADDOPTS: "-v -v -ra --showlocals"
PYTEST_ADDOPTS: "-v -v -ra --showlocals --durations=15"
PYTEST_XDIST_PROC_NR: 'auto'
CI_RUN: 'yes'
UPGRADE_ADVISORY: 'yes'

jobs:
- template: run-tox-env.yml@tox
parameters:
jobs:
fix_lint: null
embed: null
cross_python2: null
cross_python3: null
docs: null
py38:
image: [linux]
py37:
image: [linux, windows, macOs]
py36:
Expand All @@ -42,8 +40,15 @@ jobs:
image: [linux, windows, macOs]
py27:
image: [linux, windows, macOs]
fix_lint:
image: [linux, windows]
docs:
image: [linux, windows]
package_readme:
image: [linux, windows]
upgrade:
image: [linux, windows]
dev: null
package_readme: null
before:
- script: 'sudo apt-get update -y && sudo apt-get install fish csh'
condition: and(succeeded(), eq(variables['image_name'], 'linux'), in(variables['TOXENV'], 'py37', 'py36', 'py35', 'py34', 'py27'))
Expand Down
1 change: 1 addition & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
source_suffix = ".rst"
master_doc = "index"
project = "virtualenv"
# noinspection PyShadowingBuiltins
copyright = "2007-2018, Ian Bicking, The Open Planning Project, PyPA"

ROOT_SRC_TREE_DIR = Path(__file__).parents[1]
Expand Down
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
[build-system]
requires = [
"setuptools >= 40.6.3",
"setuptools >= 40.0.0",
"wheel >= 0.29.0",
"setuptools-scm >= 2, < 4",
]
build-backend = 'setuptools.build_meta'

Expand Down
97 changes: 48 additions & 49 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,81 +1,80 @@
[metadata]
name = virtualenv
version = attr: virtualenv.__version__
description = Virtual Python Environment builder
long_description = file: README.rst
keywords = virtual, environments, isolated
maintainer = Bernat Gabor
author = Ian Bicking
author = Bernat Gabor
maintainer-email = [email protected]
author-email = ianb@colorstudy.com
author-email = gaborjbernat@gmail.com
url = https://virtualenv.pypa.io/
project_urls =
Source=https://github.com/pypa/virtualenv
Tracker=https://github.com/pypa/virtualenv/issues
classifiers = Development Status :: 5 - Production/Stable
Intended Audience :: Developers
License :: OSI Approved :: MIT License
Operating System :: POSIX
Operating System :: Microsoft :: Windows
Operating System :: MacOS :: MacOS X
Topic :: Software Development :: Testing
Topic :: Software Development :: Libraries
Topic :: Utilities
Programming Language :: Python :: 2
Programming Language :: Python :: 2.7
Programming Language :: Python :: 3
Programming Language :: Python :: 3.4
Programming Language :: Python :: 3.5
Programming Language :: Python :: 3.6
Programming Language :: Python :: 3.7
classifiers =
Development Status :: 3 - Alpha
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.7
Programming Language :: Python :: 3.6
Programming Language :: Python :: 3.5
Programming Language :: Python :: 3.4
Programming Language :: Python :: 3
Programming Language :: Python :: 2
Programming Language :: Python :: 2.7
Intended Audience :: Developers
License :: OSI Approved :: MIT License
Operating System :: POSIX
Operating System :: Microsoft :: Windows
Operating System :: MacOS :: MacOS X
Topic :: Software Development :: Testing
Topic :: Software Development :: Libraries
Topic :: Utilities
platforms = any
license = MIT
license_file = LICENSE.txt

[options]
packages = find:
include_package_data = True
package_dir =
=src
zip_safe = True
python_requires = >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*
install_requires =
six >= 1.12.0, < 2
attrs
pathlib2 >= 2.3.3, < 3
appdirs >= 1.4.3
[options.packages.find]
where = src

[options.extras_require]
testing = mock;python_version<"3.3"
pytest >= 4.0.0, <5
coverage >= 4.5.0, <5
pytest-timeout >= 1.3.0, <2
xonsh; python_version>="3.5"
six >= 1.10.0, < 2
pytest-xdist
pytest-localserver
pypiserver
docs = sphinx >= 1.8.0, < 2
towncrier >= 18.5.0
sphinx_rtd_theme >= 0.4.2, < 1

[options.packages.find]
where = .
testing =
pytest >= 4.0.0, <6
coverage >= 4.5.0, < 5
pytest-mock
docs =
sphinx >= 2.0.0, < 3
towncrier >= 18.5.0
sphinx_rtd_theme >= 0.4.2, < 1

[options.package_data]
virtualenv_support = *.whl
virtualenv.seed.wheels = *.whl

[options.entry_points]
console_scripts = virtualenv=virtualenv:main
console_scripts =
virtualenv=virtualenv.__main__:run

[sdist]
formats = gztar

[bdist_wheel]
universal = true

[coverage:run]
branch = false
parallel = true

[coverage:report]
skip_covered = True
show_missing = True

[coverage:paths]
source = .
.tox/*/*/site-packages
.tox/*/*/*/site-packages
*/s
[tool:pytest]
markers =
bash
csh
fish
pwsh
xonsh
27 changes: 14 additions & 13 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
import os
import re
# -*- coding: utf-8 -*-
import textwrap

from setuptools import setup


def get_version():
with open(os.path.join(os.path.dirname(os.path.abspath(__file__)), "virtualenv.py")) as file_handler:
version_file = file_handler.read()
version_match = re.search(r"^__version__ = ['\"]([^'\"]*)['\"]", version_file, re.M)
if version_match:
return version_match.group(1)
raise RuntimeError("Unable to find version string.")


setup(version=get_version(), py_modules=["virtualenv"], setup_requires=["setuptools >= 40.6.3"])
setup(
use_scm_version={
"write_to": "src/virtualenv/version.py",
"write_to_template": textwrap.dedent(
"""
# coding: utf-8
from __future__ import unicode_literals
__version__ = {version!r}
"""
).lstrip(),
}
)
File renamed without changes.
5 changes: 5 additions & 0 deletions src/virtualenv/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from __future__ import absolute_import, unicode_literals

from .version import __version__

__all__ = ("__version__", "run")
22 changes: 22 additions & 0 deletions src/virtualenv/__main__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
from __future__ import absolute_import, print_function, unicode_literals

import sys

from virtualenv.error import ProcessCallFailed
from virtualenv.run import run_via_cli


def run(args=None):
if args is None:
args = sys.argv[1:]
try:
run_via_cli(args)
except ProcessCallFailed as exception:
print("subprocess call failed for {}".format(exception.cmd))
print(exception.out, file=sys.stdout, end="")
print(exception.err, file=sys.stderr, end="")
raise SystemExit(exception.code)


if __name__ == "__main__":
run()
6 changes: 6 additions & 0 deletions src/virtualenv/config/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from __future__ import absolute_import, unicode_literals

from .cli import parse_base_cli, parse_core_cli
from .options import BaseOption, RunOption

__all__ = ("parse_core_cli", "RunOption", "BaseOption", "parse_base_cli")
Loading