Skip to content
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

rewrite feedback #1481

Closed
wants to merge 15 commits 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
28 changes: 28 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
[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
src/virtualenv/seed/embed/wheels/pip-*.whl/*

[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*
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ 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:
Expand Down
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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if it's worth it to make this work, an orphan branch (see https://stackoverflow.com/a/30284471/1931274 for how to). Then we'd rename the current master to legacy (+ add a tag) and rename rewrite to master instead of doing a merge. :P

That'd also allow for the rewrite to be more representative of the degree of work. :P

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm pushing an orphan branch takes a while 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
31 changes: 22 additions & 9 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,19 +28,15 @@ schedules:
always: true

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, windows, macOs]
py37:
Expand All @@ -51,15 +47,32 @@ 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'], 'py38', 'py37', 'py36', 'py35', 'py34', 'py27'))
condition: and(succeeded(), eq(variables['image_name'], 'linux'), in(variables['TOXENV'], 'py38', 'py37', 'py36', 'py35', 'py27'))
displayName: install fish and csh via apt-get
- script: 'brew update -vvv && brew install fish tcsh'
condition: and(succeeded(), eq(variables['image_name'], 'macOs'), in(variables['TOXENV'], 'py38', 'py37', 'py36', 'py35', 'py34', 'py27'))
condition: and(succeeded(), eq(variables['image_name'], 'macOs'), in(variables['TOXENV'], 'py38', 'py37', 'py36', 'py35', 'py27'))
displayName: install fish and csh via brew
- task: UsePythonVersion@0
condition: and(succeeded(), in(variables['TOXENV'], 'py27'))
displayName: provision python 3
inputs:
versionSpec: '3.8'
- task: UsePythonVersion@0
condition: and(succeeded(), in(variables['TOXENV'], 'py38', 'py37', 'py36', 'py35'))
displayName: provision python 2
inputs:
versionSpec: '2.7'
coverage:
with_toxenv: 'coverage' # generate .tox/.coverage, .tox/coverage.xml after test run
for_envs: [py38, py37, py36, py35, py27]
Expand Down
5 changes: 3 additions & 2 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 All @@ -30,8 +31,8 @@ def generate_draft_news():
env = os.environ.copy()
env["PATH"] += os.pathsep.join([os.path.dirname(sys.executable)] + env["PATH"].split(os.pathsep))
changelog = subprocess.check_output(
["towncrier", "--draft", "--version", "DRAFT"], cwd=str(ROOT_SRC_TREE_DIR), env=env
).decode("utf-8")
["towncrier", "--draft", "--version", "DRAFT"], cwd=str(ROOT_SRC_TREE_DIR), env=env, universal_newlines=True
)
if "No significant changes" in changelog:
content = ""
else:
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
127 changes: 77 additions & 50 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,81 +1,108 @@
[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 = gaborjbernat@gmail.com
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
gaborbernat marked this conversation as resolved.
Show resolved Hide resolved
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
gaborbernat marked this conversation as resolved.
Show resolved Hide resolved
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
appdirs >= 1.4.3
entrypoints >= 0.3, <1
gaborbernat marked this conversation as resolved.
Show resolved Hide resolved
pathlib2 >= 2.3.3, < 3; python_version < '3.4' and sys.platform != 'win32'
distlib >= 0.3.0, <1; sys.platform == 'win32'
gaborbernat marked this conversation as resolved.
Show resolved Hide resolved
[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.1, <6
pytest-mock >= 1.12.1, <2
xonsh >= 0.9.13, <1; python_version > '3.4'
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.embed.wheels = *.whl
virtualenv.activation.bash = *.sh
virtualenv.activation.cshell = *.csh
virtualenv.activation.batch = *.bat
virtualenv.activation.fish = *.fish
virtualenv.activation.powershell = *.ps1
virtualenv.activation.xonosh = *.xsh
gaborbernat marked this conversation as resolved.
Show resolved Hide resolved

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

console_scripts =
virtualenv=virtualenv.__main__:run
virtualenv.discovery =
builtin = virtualenv.interpreters.discovery.builtin:Builtin
virtualenv.create =
cpython3-posix = virtualenv.interpreters.create.cpython.cpython3:CPython3Posix
cpython3-win = virtualenv.interpreters.create.cpython.cpython3:CPython3Windows
cpython2-posix = virtualenv.interpreters.create.cpython.cpython2:CPython2Posix
cpython2-win = virtualenv.interpreters.create.cpython.cpython2:CPython2Windows
venv = virtualenv.interpreters.create.venv:Venv
virtualenv.seed =
none = virtualenv.seed.none:NoneSeeder
pip = virtualenv.seed.embed.pip_invoke:PipInvoke
app-data = virtualenv.seed.via_app_data.via_app_data:FromAppData
virtualenv.activate =
bash = virtualenv.activation.bash:BashActivator
cshell = virtualenv.activation.cshell:CShellActivator
batch = virtualenv.activation.batch:BatchActivator
fish = virtualenv.activation.fish:FishActivator
power-shell = virtualenv.activation.powershell:PowerShellActivator
gaborbernat marked this conversation as resolved.
Show resolved Hide resolved
python = virtualenv.activation.python:PythonActivator
xonosh = virtualenv.activation.xonosh:XonoshActivator
gaborbernat marked this conversation as resolved.
Show resolved Hide resolved
[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
junit_family = xunit2
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}
gaborbernat marked this conversation as resolved.
Show resolved Hide resolved
"""
).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()
Loading