diff --git a/MANIFEST.in b/MANIFEST.in index f067455..185f6f7 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -9,3 +9,6 @@ recursive-include tests *.py include pylintrc include tox.ini exclude appveyor.yml +exclude bors.toml +exclude azure-pipelines.yml +recursive-exclude ci * diff --git a/azure-pipelines.yml b/azure-pipelines.yml new file mode 100644 index 0000000..d35fd72 --- /dev/null +++ b/azure-pipelines.yml @@ -0,0 +1,87 @@ +# from matplotlib's azure setup + + +schedules: +- cron: "0 0 * * 4" + displayName: Weekly build + branches: + include: + - releases/* + always: true + + +trigger: + tags: + include: + - '*' + branches: + include: + - '*' + + +variables: + PIP_CACHE_DIR: $(Pipeline.Workspace)/cache/pip + + +jobs: +- job: 'static_checks' + pool: + vmImage: ubuntu-16.04 + variables: + TOXENV: flake8,pylint,docs,doctest,check-manifest,checkreadme + steps: + - task: UsePythonVersion@0 + inputs: + versionSpec: '3.8' + architecture: 'x64' + - script: | + pip install tox + displayName: Install tox + - script: | + tox + displayName: tox + +- job: 'ubuntu1604' + pool: + vmImage: ubuntu-16.04 + strategy: + matrix: + py36: + python.version: '3.6' + TOXENV: py36 + py37: + python.version: '3.7' + TOXENV: py37 + py38: + python.version: '3.8' + TOXENV: py38 + py39: + python.version: '3.9' + TOXENV: py39 + maxParallel: 4 + + steps: + - template: ci/azure-pipelines-steps.yml + parameters: + platform: linux + +- job: 'macOS1015' + pool: + vmImage: macOS-10.15 + strategy: + matrix: + py37: + python.version: '3.7' + TOXENV: py37 + py38: + python.version: '3.8' + TOXENV: py38 + py39: + python.version: '3.9' + TOXENV: py39 + maxParallel: 4 + + steps: + - template: ci/azure-pipelines-steps.yml + parameters: + platform: macos diff --git a/bors.toml b/bors.toml new file mode 100644 index 0000000..84b2d1e --- /dev/null +++ b/bors.toml @@ -0,0 +1,6 @@ +status = [ + "venv_tools.venv_tools", + "codecov/patch", + "codecov/project", +] + diff --git a/ci/azure-pipelines-steps.yml b/ci/azure-pipelines-steps.yml new file mode 100644 index 0000000..831c65d --- /dev/null +++ b/ci/azure-pipelines-steps.yml @@ -0,0 +1,38 @@ +steps: +- task: UsePythonVersion@0 + inputs: + versionSpec: '$(python.version)' + architecture: 'x64' + displayName: 'Use Python $(python.version)' + condition: and(succeeded(), ne(variables['python.version'], 'Pre')) + +- script: | + python -m pip install --upgrade pip + pip install tox codecov twine wheel + displayName: 'Install pip dependencies' + +- task: TwineAuthenticate@0 + inputs: + externalFeeds: 'pypi' + condition: startsWith(variables['Build.SourceBranch'], 'refs/tags/') + +- script: env + displayName: 'print env' + +- script: | + tox + displayName: 'tox' + +#- script: | +# codecov +# displayName: 'codecov' +# hopefully the bash uploader will work +- script: | + bash <(curl -s https://codecov.io/bash) + displayName: 'Upload to codecov.io' + +- script: | + python setup.py sdist bdist_wheel + twine upload --skip-existing -r pypi --config-file $(PYPIRC_PATH) dist/* + displayName: 'Upload to PyPI' + condition: startsWith(variables['Build.SourceBranch'], 'refs/tags/') diff --git a/pylintrc b/pylintrc index f50dbac..653de87 100644 --- a/pylintrc +++ b/pylintrc @@ -65,7 +65,7 @@ evaluation=10.0 - ((float(5 * error + warning + refactor + convention) / stateme # --enable=similarities". If you want to run only the classes checker, but have # no Warning level messages displayed, use"--disable=all --enable=classes # --disable=W" -disable=bad-continuation,invalid-name,too-few-public-methods,logging-format-interpolation +disable=bad-continuation,invalid-name,too-few-public-methods,logging-format-interpolation,useless-object-inheritance [SIMILARITIES] diff --git a/tox.ini b/tox.ini index 89a6953..878a703 100644 --- a/tox.ini +++ b/tox.ini @@ -1,12 +1,22 @@ [tox] -envlist = py35,py36,py37,docs,flake8,pylint,check-manifest,checkreadme +envlist = py35,py36,py37,py38,py39,docs,flake8,pylint,check-manifest,checkreadme [testenv] deps = -rtest-requirements.txt -commands = py.test --cov={envsitepackagesdir}/venv_tools -s {posargs} -passenv = - TOXPYTHON +commands = pytest --cov={envsitepackagesdir}/venv_tools -s {posargs} +basepython = + py35: {env:TOXPYTHON:python3.5} + py36: {env:TOXPYTHON:python3.6} + py37: {env:TOXPYTHON:python3.7} + py38: {env:TOXPYTHON:python3.8} + py39: {env:TOXPYTHON:python3.9} + flake8: {env:TOXPYTHON:python3} + pylint: {env:TOXPYTHON:python3} + docs: {env:TOXPYTHON:python3} + doctest: {env:TOXPYTHON:python3} + check-manifest: {env:TOXPYTHON:python3} + checkreadme: {env:TOXPYTHON:python3} [testenv:docs] changedir=docs @@ -14,21 +24,18 @@ deps= -rdoc-requirements.txt commands= sphinx-build -W -b html -d {envtmpdir}/doctrees . {envtmpdir}/html -basepython= {env:TOXPYTHON:python3} [testenv:flake8] deps= flake8 commands= flake8 --exclude={envsitepackagesdir}/venv_tools/_version.py {envsitepackagesdir}/venv_tools -basepython= {env:TOXPYTHON:python3} [testenv:pylint] deps= pylint commands= pylint {envsitepackagesdir}/venv_tools -basepython= {env:TOXPYTHON:python3} [testenv:check-manifest] deps= @@ -37,11 +44,9 @@ setenv = CHECK_MANIFEST=true commands= check-manifest -basepython= {env:TOXPYTHON:python3} [testenv:checkreadme] deps= readme_renderer commands= python setup.py check -s -r -basepython= {env:TOXPYTHON:python3} diff --git a/venv_tools/__init__.py b/venv_tools/__init__.py index e96f84e..6a2aca8 100644 --- a/venv_tools/__init__.py +++ b/venv_tools/__init__.py @@ -206,9 +206,8 @@ def __init__( path_to_python_exe = abspath_python_exe(python_exe) self._kwargs = kwargs - self._venv_builder = ( - venv_builder or - get_default_venv_builder(use_virtualenv, path_to_python_exe) + self._venv_builder = venv_builder or get_default_venv_builder( + use_virtualenv, path_to_python_exe, ) self._path_to_python_exe = path_to_python_exe self.env_dir = None diff --git a/venv_tools/_utils.py b/venv_tools/_utils.py index 2f97e8f..07a4d6d 100644 --- a/venv_tools/_utils.py +++ b/venv_tools/_utils.py @@ -75,10 +75,10 @@ def get_default_venv_builder(use_virtualenv, path_to_python_exe): """ if path_to_python_exe: return VirtualenvBuilder - elif use_virtualenv: + if use_virtualenv: return VirtualenvBuilder try: - import venv + import venv # pylint: disable=import-outside-toplevel if sys.version_info[0:2] == (3, 3): return VirtualenvBuilder return venv.EnvBuilder @@ -89,6 +89,8 @@ def get_default_venv_builder(use_virtualenv, path_to_python_exe): def is_virtualenv(path): """ Checks whether `path` is a virtualenv. + + This function is somewhat redundant now that virtualenv uses venv """ if pth.exists(pth.join(path, BIN_DIR, "python")): # we might have a virtualenv (/usr would pass the above test) @@ -96,7 +98,7 @@ def is_virtualenv(path): pth.exists(pth.join(path, BIN_DIR, f)) for f in ACTIVATE_FILENAMES ) - if activate_exists and not is_pep_405_venv(path): + if activate_exists: return True return False