Skip to content

Commit

Permalink
Replace pbr with setuptools (#65)
Browse files Browse the repository at this point in the history
Also adopts src/ layout
  • Loading branch information
ssbarnea authored Oct 9, 2022
1 parent 54bbe8a commit 94315a6
Show file tree
Hide file tree
Showing 37 changed files with 129 additions and 94 deletions.
1 change: 0 additions & 1 deletion .github/workflows/tox.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ jobs:
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: "pip"
- name: Install tox
run: |
python3 -m pip install --upgrade pip
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,4 @@ test-distribute.sh
/AUTHORS
/.pytest_cache
venv/*
src/tendo/_version.py
8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ repos:
rev: v2.1.0
hooks:
- id: trailing-whitespace
exclude: ^tendo/tests/.*\.txt$
exclude: ^src/tendo/tests/.*\.txt$
- id: end-of-file-fixer
exclude: ^tendo/tests/.*\.txt$
exclude: ^src/tendo/tests/.*\.txt$
- id: mixed-line-ending
exclude: ^tendo/tests/.*\.txt$
exclude: ^src/tendo/tests/.*\.txt$
- id: check-byte-order-marker
exclude: ^tendo/tests/.*\.txt$
exclude: ^src/tendo/tests/.*\.txt$
- id: check-executables-have-shebangs
- id: check-merge-conflict
- id: check-symlinks
Expand Down
3 changes: 0 additions & 3 deletions MANIFEST.in

This file was deleted.

11 changes: 0 additions & 11 deletions Makefile

This file was deleted.

2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ not (yet) provided by Python.
* [transparent Unicode support for text file operations (BOM detection)](https://tendo.readthedocs.org/en/latest/#module-tendo.singleton)
* [console logging coloring](https://tendo.readthedocs.org/en/latest/#module-tendo.colorer)
* enable you to use symlinks under windows
* [python tee implementation](https://tendo.readthedocs.org/en/latest/#module-tendo.colorer) for executing external programs and redirecting their output to both console/file)
* [python tee implementation](https://tendo.readthedocs.org/en/latest/#module-tendo.colorer) for executing external programs and redirecting their output to both console/file
* [improved execfile](https://tendo.readthedocs.org/en/latest/#module-tendo.execfile2)

Documentation
Expand Down
10 changes: 10 additions & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
codecov:
require_ci_to_pass: true
comment: false
coverage:
status:
patch: false
project:
default:
threshold: 0.5%
20 changes: 20 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
[build-system]
requires = [
"setuptools >= 65.4.0", # required by pyproject+setuptools_scm integration
"setuptools_scm[toml] >= 3.5.0", # required for "no-local-version" scheme
"setuptools_scm_git_archive >= 1.0",
"wheel",
]
build-backend = "setuptools.build_meta"

[tool.black]
target-version = ["py38"]

[tool.coverage.run]
source_pkgs = ["tendo"]
branch = true
Expand All @@ -9,3 +21,11 @@ source = ["src", ".tox/*/site-packages"]

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

[tool.isort]
profile = "black"
add_imports = "from __future__ import annotations"

[tool.setuptools_scm]
local_scheme = "no-local-version"
write_to = "src/tendo/_version.py"
44 changes: 44 additions & 0 deletions pytest.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# spell-checker:ignore filterwarnings norecursedirs optionflags
[pytest]
# do not add options here as this will likely break either console runs or IDE
# integration like vscode or pycharm
addopts =
# https://code.visualstudio.com/docs/python/testing
# coverage is re-enabled in `tox.ini`. That approach is safer than
# `--no-cov` which prevents activation from tox.ini and which also fails
# when plugin is effectively missing.
-p no:pytest_cov

doctest_optionflags = ALLOW_UNICODE ELLIPSIS
filterwarnings =
default
ignore:.*mode is deprecated:Warning
ignore:unclosed file.*:Warning
ignore:can't resolve package from.*:Warning
junit_duration_report = call
# Our github annotation parser from .github/workflows/tox.yml requires xunit1 format. Ref:
# https://github.com/shyim/junit-report-annotations-action/issues/3#issuecomment-663241378
junit_family = xunit1
junit_suite_name = ansible_lint_test_suite
minversion = 4.6.6
norecursedirs =
build
dist
docs
.cache
.eggs
.git
.github
.tox
*.egg
python_files =
test_*.py
# Ref: https://docs.pytest.org/en/latest/reference.html#confval-python_files
# Needed to discover legacy nose test modules:
Test*.py
# Needed to discover embedded Rule tests
# Using --pyargs instead of testpath as we embed some tests
# See: https://github.com/pytest-dev/pytest/issues/6451#issuecomment-687043537
# testpaths =
xfail_strict = true
13 changes: 0 additions & 13 deletions requirements-dev.txt

This file was deleted.

4 changes: 0 additions & 4 deletions requirements.txt

This file was deleted.

68 changes: 38 additions & 30 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@
name = tendo

author = Sorin Sbarnea
author-email = [email protected]
author_email = [email protected]
maintainer = Sorin Sbarnea
maintainer-email = [email protected]
maintainer_email = [email protected]
summary = A Python library that extends some core functionality
description-file = README.rst
home-page = https://github.com/pycontribs/tendo
long_description = file: README.rst
long_description_content_type = text/x-rst
home_page = https://github.com/pycontribs/tendo
license = BSD
classifier =
Development Status :: 5 - Production/Stable
Expand All @@ -31,19 +32,44 @@ keywords =
colorer
singleton


[options]
use_scm_version = True
python_requires = >=3.6
package_dir =
= src
packages = find:
# Do not use include_package_data as we mention them explicitly.
# see https://setuptools.pypa.io/en/latest/userguide/datafiles.html
# include_package_data = True
zip_safe = False
install_requires =
six

[files]
packages =
tendo
[options.extras_require]
test =
coverage[toml]>=6.5.0
coveralls~=3.3.1
pre-commit~=2.20.0
pytest-cache~=1.0
pytest-cov~=3.0.0
pytest-html~=3.1.1
pytest-instafail~=0.4.2
pytest-xdist~=2.5.0
pytest~=7.1.3
wheel~=0.37.1
docs =
Sphinx~=5.2.1
docutils~=0.19
MarkupSafe~=2.1.1

[entry_points]
pbr.config.drivers =
plain = pbr.cfg.driver:Plain
[options.package_data]
* =
py.typed
**/*.txt

[bdist_wheel]
universal = 1
[options.packages.find]
where = src

[build_sphinx]
source-dir = docs
Expand All @@ -58,21 +84,3 @@ enable-extensions = H106,H203,H204,H205,H210,H904
exclude = __pycache__,build,src,.tox
ignore = D
max-line-length=1024

[tool:pytest]
norecursedirs = . .svn _build tmp* lib/third lib *.egg bin distutils build docs demo
python_files = *.py
addopts = -p no:xdist --ignore=setup.py --tb=long --capture=fd -rxX --maxfail=10 tendo
# --maxfail=2 -n4
# -n4 runs up to 4 parallel procs
# --maxfail=2 fail fast, dude
# --durations=3 report the top 3 longest tests

# these are important for distributed testing, to speedup their execution we minimize what we sync
rsyncdirs = . tendo demo docs
rsyncignore = .hg .git
filterwarnings =
default
ignore:.*mode is deprecated:Warning
ignore:unclosed file.*:Warning
ignore:can't resolve package from.*:Warning
8 changes: 0 additions & 8 deletions setup.py

This file was deleted.

7 changes: 1 addition & 6 deletions tendo/__init__.py → src/tendo/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,7 @@
from __future__ import absolute_import
import sys

from pbr.version import VersionInfo


_v = VersionInfo('tendo').semantic_version()
__version__ = _v.release_string()
version_info = _v.version_tuple()
from ._version import __version__

__author__ = "Sorin Sbarnea"
__copyright__ = "Copyright 2010-2018, Sorin Sbarnea"
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Empty file added src/tendo/tests/__init__.py
Empty file.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Empty file added src/tendo/tests/py.typed
Empty file.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
23 changes: 10 additions & 13 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
[tox]
minversion = 2.3.1
envlist = lint,docs,{py37,py38,py39,py310}
skip_missing_interpreters = true
tox_pyenv_fallback=True
ignore_errors=False
envlist = lint,packaging,docs,py
tox_pyenv_fallback = True
ignore_errors = False
isolated_build = True

[testenv]
sitepackages=False
Expand All @@ -29,11 +29,12 @@ setenv =
COVERAGE_FILE={env:COVERAGE_FILE:{toxworkdir}/.coverage.{envname}}
COVERAGE_PROCESS_START={toxinidir}/pyproject.toml
commands=
python -m pip -q install -rrequirements-dev.txt -rrequirements.txt
coverage run -m pytest --color=yes --html={envlogdir}/report.html --self-contained-html
# --pyargs tendo
allowlist_externals =
sh
deps =
--editable .[test]

[testenv:coverage]
description = Combines and displays coverage results
Expand All @@ -42,19 +43,16 @@ commands =
# needed by codecov github actions:
coverage xml
# just for humans running it:
coverage report --skip-covered --fail-under=46
coverage report --skip-covered --fail-under=43
deps =
coverage[toml]>=6.5.0

[testenv:docs]
basepython=python
changedir=docs
deps=
sphinx
six
docutils
commands=
sphinx-build -W -b html -d {envtmpdir}/doctrees . {envtmpdir}/html
deps =
--editable .[docs]

[testenv:lint]
deps =
Expand All @@ -63,11 +61,10 @@ commands=
python -m pre_commit run --all

[testenv:packaging]
basepython = python3
description =
Build package, verify metadata, install package and assert behavior when ansible is missing.
deps =
build >= 0.7.0, < 0.8.0
build >= 0.7.0
twine
skip_install = true
# Ref: https://twitter.com/di_codes/status/1044358639081975813
Expand Down

0 comments on commit 94315a6

Please sign in to comment.