Skip to content

Require py37+ and adopt PEP-517 packaging #77

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

Merged
merged 1 commit into from
Mar 25, 2022
Merged
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
11 changes: 9 additions & 2 deletions .github/workflows/tox.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ on:
workflow_call:

jobs:
unit:
tox_envs:
name: ${{ matrix.tox_env }}
runs-on: ${{ matrix.os }}
strategy:
Expand All @@ -24,7 +24,12 @@ jobs:
os:
# https://help.github.com/en/actions/reference/virtual-environments-for-github-hosted-runners
- ubuntu-20.04
unit: ["true"]
include:
- tox_env: packaging
os: ubuntu-20.04
python-version: 3.7
unit: false
- tox_env: py37
os: ubuntu-20.04
python-version: 3.7
Expand Down Expand Up @@ -69,10 +74,12 @@ jobs:
run: python3 -m tox

- name: Combine coverage data
if: ${{ matrix.unit }}
# produce a single .coverage file at repo root
run: coverage combine .tox/.coverage.*

- name: Upload coverage data
if: ${{ matrix.unit }}
uses: codecov/codecov-action@v1
with:
name: ${{ matrix.tox_env }}
Expand All @@ -95,7 +102,7 @@ jobs:
if: always()

needs:
- unit
- tox_envs

runs-on: ubuntu-latest

Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@ Vagrantfile
/build/
/dist/
/python_vagrant.egg-info/
*.egg-info/
26 changes: 26 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
[build-system]
requires = [
"setuptools >= 45.0.0", # required by pyproject+setuptools_scm integration
"setuptools_scm >= 6.3.1", # required for "no-local-version" scheme
"setuptools_scm_git_archive >= 1.0",
"wheel",
]
build-backend = "setuptools.build_meta"

[tool.coverage.run]
source = ["src"]
branch = true

[tool.coverage.report]
exclude_lines = ["pragma: no cover", "if TYPE_CHECKING:"]

[tool.isort]
profile = "black"

[tool.pytest.ini_options]
addopts = "--no-success-flaky-report"
# ensure we treat warnings as error
filterwarnings = ["error"]

[tool.setuptools_scm]
local_scheme = "no-local-version"
39 changes: 39 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
[metadata]
name = python-vagrant
url = https://github.com/pycontribs/python-vagrant
project_urls =
Bug Tracker = https://github.com/pycontribs/python-vagrant/issues
CI: GitHub = https://github.com/pycontribs/python-vagrant/actions?query=workflow:gh+branch:main+event:push
Source Code = https://github.com/pycontribs/python-vagrant
description = Python bindings for interacting with Vagrant virtual machines.
long_description = file: README.md
long_description_content_type = text/markdown
author = Todd Francis DeLuca
author_email = todddeluca@yahoo.com
license = MIT
license_file = LICENSE.txt
classifiers =
Development Status :: 4 - Beta
License :: OSI Approved :: MIT License
Operating System :: OS Independent
Programming Language :: Python :: 3.10
Programming Language :: Python :: 3.7
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
Topic :: Utilities
keywords =
box
vagrant
vagrantfile
virtual-machine
virtualbox

[options]
use_scm_version = True
python_requires = >=3.7
; package_dir =
; = src
; packages = find:

; [options.packages.find]
; where = src
32 changes: 0 additions & 32 deletions setup.py

This file was deleted.

27 changes: 26 additions & 1 deletion tox.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
[tox]
envlist =
packaging
py

[testenv]
Expand All @@ -13,7 +14,31 @@ passenv =
# Pass HOME to the test environment as it is required by
# vagrant. Otherwise error happens due to missing HOME env variable.
HOME
allowlist_externals =
sh

[testenv:dev]

commands = {posargs}

[testenv:packaging]
description =
Build package, verify metadata, install package and assert behavior when ansible is missing.
deps =
build >= 0.7.0
twine
skip_install = true
# Ref: https://twitter.com/di_codes/status/1044358639081975813
commands =
# build wheel and sdist using PEP-517
{envpython} -c 'import os.path, shutil, sys; \
dist_dir = os.path.join("{toxinidir}", "dist"); \
os.path.isdir(dist_dir) or sys.exit(0); \
print("Removing \{!s\} contents...".format(dist_dir), file=sys.stderr); \
shutil.rmtree(dist_dir)'
{envpython} -m build \
--outdir {toxinidir}/dist/ \
{toxinidir}
# Validate metadata using twine
twine check --strict {toxinidir}/dist/*
# Install the wheel
sh -c "python3 -m pip install {toxinidir}/dist/*.whl"