Skip to content

Commit

Permalink
Configuring for pure-python
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Howitz committed Feb 10, 2023
1 parent 26e7bcf commit d407fed
Show file tree
Hide file tree
Showing 10 changed files with 288 additions and 69 deletions.
6 changes: 0 additions & 6 deletions .coveragerc

This file was deleted.

39 changes: 39 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Generated from:
# https://github.com/zopefoundation/meta/tree/master/config/pure-python
#
# EditorConfig Configuration file, for more details see:
# http://EditorConfig.org
# EditorConfig is a convention description, that could be interpreted
# by multiple editors to enforce common coding conventions for specific
# file types

# top-most EditorConfig file:
# Will ignore other EditorConfig files in Home directory or upper tree level.
root = true


[*] # For All Files
# Unix-style newlines with a newline ending every file
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
# Set default charset
charset = utf-8
# Indent style default
indent_style = space
# Max Line Length - a hard line wrap, should be disabled
max_line_length = off

[*.{py,cfg,ini}]
# 4 space indentation
indent_size = 4

[*.{yml,zpt,pt,dtml,zcml}]
# 2 space indentation
indent_size = 2

[{Makefile,.gitmodules}]
# Tab indentation (no size specified, but view as 4 spaces)
indent_style = tab
indent_size = unset
tab_width = unset
62 changes: 62 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# Generated from:
# https://github.com/zopefoundation/meta/tree/master/config/pure-python
name: tests

on:
push:
pull_request:
schedule:
- cron: '0 12 * * 0' # run once a week on Sunday
# Allow to run this workflow manually from the Actions tab
workflow_dispatch:

jobs:
build:
strategy:
# We want to see all failures:
fail-fast: false
matrix:
os:
- ["ubuntu", "ubuntu-20.04"]
config:
# [Python version, tox env]
- ["3.9", "lint"]
- ["3.7", "py37"]
- ["3.8", "py38"]
- ["3.9", "py39"]
- ["3.10", "py310"]
- ["3.11", "py311"]
- ["pypy-3.9", "pypy3"]
- ["3.9", "docs"]
- ["3.9", "coverage"]

runs-on: ${{ matrix.os[1] }}
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name
name: ${{ matrix.config[1] }}
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.config[0] }}
- name: Pip cache
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ matrix.config[0] }}-${{ hashFiles('setup.*', 'tox.ini') }}
restore-keys: |
${{ runner.os }}-pip-${{ matrix.config[0] }}-
${{ runner.os }}-pip-
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install tox
- name: Test
run: tox -e ${{ matrix.config[1] }}
- name: Coverage
if: matrix.config[1] == 'coverage'
run: |
pip install coveralls
coveralls --service=github
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
32 changes: 24 additions & 8 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,16 +1,32 @@
# Generated from:
# https://github.com/zopefoundation/meta/tree/master/config/pure-python
*.dll
*.egg-info/
*.profraw
*.pyc
*.pyo
*.so
*.dll
__pycache__
src/*.egg-info

.coverage
.coverage.*
.eggs/
.installed.cfg
.tox
.mr.developer.cfg
.tox/
.vscode/
__pycache__/
bin/
build/
coverage.xml
develop-eggs/
develop/
dist/
docs/_build
eggs/
etc/
lib/
lib64
log/
parts/
.coverage
htmlcov/
docs/_build/
pyvenv.cfg
testing.log
var/
34 changes: 34 additions & 0 deletions .meta.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Generated from:
# https://github.com/zopefoundation/meta/tree/master/config/pure-python
[meta]
template = "pure-python"
commit-id = "f6bd0f55"

[python]
with-sphinx-doctests = false
with-docs = true
with-future-python = false
with-pypy = true
with-macos = false
with-windows = false

[tox]
use-flake8 = true

[coverage]
fail-under = 99

[manifest]
additional-rules = [
"recursive-include src *.csv",
"recursive-include src *.gif",
"recursive-include src *.png",
"recursive-include src *.rst",
"recursive-include src *.txt",
"recursive-include src *.zcml",
]

[check-manifest]
additional-ignores = [
"docs/_build/html/_sources/api/*",
]
28 changes: 0 additions & 28 deletions .travis.yml

This file was deleted.

23 changes: 23 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<!--
Generated from:
https://github.com/zopefoundation/meta/tree/master/config/pure-python
-->
# Contributing to zopefoundation projects

The projects under the zopefoundation GitHub organization are open source and
welcome contributions in different forms:

* bug reports
* code improvements and bug fixes
* documentation improvements
* pull request reviews

For any changes in the repository besides trivial typo fixes you are required
to sign the contributor agreement. See
https://www.zope.dev/developer/becoming-a-committer.html for details.

Please visit our [Developer
Guidelines](https://www.zope.dev/developer/guidelines.html) if you'd like to
contribute code changes and our [guidelines for reporting
bugs](https://www.zope.dev/developer/reporting-bugs.html) if you want to file a
bug report.
20 changes: 12 additions & 8 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
# Generated from:
# https://github.com/zopefoundation/meta/tree/master/config/pure-python
include *.md
include *.rst
include *.txt
include *.py
include buildout.cfg
include tox.ini
include .travis.yml
include .coveragerc

recursive-include docs *.py
recursive-include docs *.rst
recursive-include docs *.txt
recursive-include docs Makefile

recursive-include src *

global-exclude *.pyc
global-exclude *.so
global-exclude *.dll
recursive-include src *.py
recursive-include src *.csv
recursive-include src *.gif
recursive-include src *.png
recursive-include src *.rst
recursive-include src *.txt
recursive-include src *.zcml
25 changes: 24 additions & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,2 +1,25 @@
# Generated from:
# https://github.com/zopefoundation/meta/tree/master/config/pure-python
[bdist_wheel]
universal = 1
universal = 0

[flake8]
doctests = 1

[check-manifest]
ignore =
.editorconfig
.meta.toml
docs/_build/html/_sources/*
docs/_build/html/_sources/api/*

[isort]
force_single_line = True
combine_as_imports = True
sections = FUTURE,STDLIB,THIRDPARTY,ZOPE,FIRSTPARTY,LOCALFOLDER
known_third_party = six, docutils, pkg_resources, pytz
known_zope =
known_first_party =
default_section = ZOPE
line_length = 79
lines_after_imports = 2
88 changes: 70 additions & 18 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,33 +1,85 @@
# Generated from:
# https://github.com/zopefoundation/meta/tree/master/config/pure-python
[tox]
minversion = 3.18
envlist =
py27,py35,py36,py37,py38,pypy,pypy3,coverage,minimal,docs
lint
py37
py38
py39
py310
py311
pypy3
docs
coverage

[testenv]
usedevelop = true
deps =
commands =
zope-testrunner --test-path=src []
zope-testrunner --test-path=src {posargs:-vc}
extras =
test
setenv =
ZOPE_INTERFACE_STRICT_IRO=1

[testenv:minimal]
extras =
[testenv:lint]
basepython = python3
skip_install = true
commands =
isort --check-only --diff {toxinidir}/src {toxinidir}/setup.py
flake8 src setup.py
check-manifest
check-python-versions
deps =
zope.testrunner
zope.testing
check-manifest
check-python-versions >= 0.19.1
wheel
flake8
isort

[testenv:coverage]
usedevelop = true
basepython =
python2.7
commands =
coverage run -m zope.testrunner --test-path=src []
coverage report --fail-under=100
[testenv:isort-apply]
basepython = python3
skip_install = true
commands_pre =
deps =
coverage
isort
commands =
isort {toxinidir}/src {toxinidir}/setup.py []

[testenv:docs]
commands =
sphinx-build -b html -d docs/_build/doctrees docs docs/_build/html
basepython = python3
skip_install = false
extras =
docs
commands_pre =
commands =
sphinx-build -b html -d docs/_build/doctrees docs docs/_build/html

[testenv:coverage]
basepython = python3
allowlist_externals =
mkdir
deps =
coverage
commands =
mkdir -p {toxinidir}/parts/htmlcov
coverage run -m zope.testrunner --test-path=src {posargs:-vc}
coverage html --ignore-errors
coverage report --ignore-errors --show-missing --fail-under=99

[coverage:run]
branch = True
source = zope.mimetype

[coverage:report]
precision = 2
exclude_lines =
pragma: no cover
pragma: nocover
except ImportError:
raise NotImplementedError
if __name__ == '__main__':
self.fail
raise AssertionError

[coverage:html]
directory = parts/htmlcov

0 comments on commit d407fed

Please sign in to comment.