Skip to content

Commit

Permalink
Config with pure python (#1)
Browse files Browse the repository at this point in the history
* Configuring for pure-python
* Lint the code.

Co-authored-by: Marius Gedminas <marius@gedmin.as>
  • Loading branch information
Michael Howitz and mgedmin committed Jan 8, 2021
2 parents 0ade816 + c09150e commit e43d44c
Show file tree
Hide file tree
Showing 12 changed files with 257 additions and 88 deletions.
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}]
# 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
54 changes: 54 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# Generated from:
# https://github.com/zopefoundation/meta/tree/master/config/pure-python
name: tests

on:
push:
branches: [ master ]
pull_request:
schedule:
- cron: '0 12 * * 0' # run once a week on Sunday

jobs:
build:
strategy:
matrix:
config:
# [Python version, tox env]
- ["3.8", "lint"]
- ["2.7", "py27"]
- ["3.5", "py35"]
- ["3.6", "py36"]
- ["3.7", "py37"]
- ["3.8", "py38"]
- ["3.9", "py39"]
- ["3.8", "coverage"]

runs-on: ubuntu-latest
name: ${{ matrix.config[1] }}
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.config[0] }}
- name: Pip cache
uses: actions/cache@v2
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('setup.*', 'tox.ini') }}
restore-keys: |
${{ 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 coverage-python-version
coveralls
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
32 changes: 19 additions & 13 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,19 +1,25 @@
*.egg
*.egg-info
# Generated from:
# https://github.com/zopefoundation/meta/tree/master/config/pure-python
*.egg-info/
*.profraw
*.pyc
*$py.class
*.pt.py
*.txt.py
*~
.*.swp
*.pyo
.coverage
.coverage.*
.eggs/
.installed.cfg
.mr.developer.cfg
.tox/
nosetests.xml
coverage.xml
pyramid_zope_request/coverage.xml
__pycache__/
bin/
build/
coverage.xml
develop-eggs/
dist/
bin/
docs/_build
eggs/
htmlcov/
lib/
include/
distribute-*.tar.gz
lib64
parts/
pyvenv.cfg
14 changes: 14 additions & 0 deletions .meta.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Generated from:
# https://github.com/zopefoundation/meta/tree/master/config/pure-python
[meta]
template = "pure-python"
commit-id = "3ecb8f5a831f41f5bf44a4f5c4357ecefb62a50b"

[python]
with-pypy = false
with-legacy-python = true
with-docs = false
with-sphinx-doctests = false

[coverage]
fail-under = 100
11 changes: 0 additions & 11 deletions .travis.yml

This file was deleted.

4 changes: 3 additions & 1 deletion CHANGES.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
0.3 (unreleased)
----------------

- Nothing changed yet.
- Add support for Python 3.5, 3.6, 3.7, 3.8 and 3.9.

- Drop support for Python 2.6 and 3.3.


0.2 (2013-04-30)
Expand Down
9 changes: 9 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
# Generated from:
# https://github.com/zopefoundation/meta/tree/master/config/pure-python
include *.rst
include *.txt
include buildout.cfg
include tox.ini

recursive-include src *.pt
recursive-include src *.py
recursive-include src *.rst
recursive-include src *.txt
recursive-include src *.zcml
21 changes: 10 additions & 11 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
[easy_install]
zip_ok = false
# Generated from:
# https://github.com/zopefoundation/meta/tree/master/config/pure-python
[bdist_wheel]
universal = 1

[nosetests]
match=^test
where=pyramid_zope_request
nocapture=1
cover-package=pyramid_zope_request
cover-erase=1
[flake8]
doctests = 1

[aliases]
dev = develop easy_install pyramid_zope_request[testing]
docs = develop easy_install pyramid_zope_request[docs]
[check-manifest]
ignore =
.editorconfig
.meta.toml
44 changes: 25 additions & 19 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,42 +31,48 @@

tests_require = install_requires

testing_extras = ['six', # some zope.publisher versions miss to declare the dep.
'zope.browserpage', # some z3c.form misses this
'z3c.form [test]']
testing_extras = [
'six', # some zope.publisher versions miss to declare the dep.
'zope.browserpage', # some z3c.form misses this
'z3c.form [test]',
]

setup(name='pyramid_zope_request',
version='0.3.dev0',
description='Zope publisher request support for Pyramid',
long_description=README + '\n\n' + CHANGES,
classifiers=[
"Intended Audience :: Developers",
"Programming Language :: Python",
"Programming Language :: Python :: 2",
"Programming Language :: Python :: 2.6",
"Programming Language :: Python :: 2.7",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.3",
"Programming Language :: Python :: Implementation :: CPython",
"Framework :: Pylons",
'Framework :: Zope :: 3',
"Topic :: Internet :: WWW/HTTP",
"Topic :: Internet :: WWW/HTTP :: WSGI",
'License :: OSI Approved :: Zope Public License',
"Intended Audience :: Developers",
"Programming Language :: Python",
"Programming Language :: Python :: 2",
"Programming Language :: Python :: 2.7",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.5",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: Implementation :: CPython",
"Framework :: Pylons",
'Framework :: Zope :: 3',
"Topic :: Internet :: WWW/HTTP",
"Topic :: Internet :: WWW/HTTP :: WSGI",
'License :: OSI Approved :: Zope Public License',
],
keywords='web wsgi pylons pyramid zope3 webob',
author="Adam Groszer and the Zope Community",
author_email="zope-dev@zope.org",
url='http://pypi.python.org/pypi/pyramid_zope_request',
url='https://github.com/zopefoundation/pyramid_zope_request',
license='ZPL 2.1',
packages=find_packages(),
packages=find_packages('src'),
package_dir={'': 'src'},
include_package_data=True,
zip_safe=False,
install_requires=install_requires,
tests_require=tests_require,
test_suite="pyramid_zope_request",
extras_require={
'testing': testing_extras,
'test': testing_extras,
},
entry_points="""
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ def __getattr__(self, name):
return getattr(self._response, name)

def __setattr__(self, name, value):
# there are some attributes on Response that can be set, e.g. ``charset``
# there are some attributes on Response that can be set,
# e.g. ``charset``
setattr(self._response, name, value)

def getHeader(self, name):
Expand Down Expand Up @@ -100,7 +101,7 @@ def keys(self):
'See Interface.Common.Mapping.IEnumerableMapping'
d = {}
d.update(self.environment)
#d.update(self._cookies)
# d.update(self._cookies)
d.update(self.form)
return d.keys()

Expand All @@ -112,6 +113,7 @@ def get(self, key, default=None):
class PyramidToPublisher(object):
"""View decorator that sets a skin on the request then wraps the request
"""

def __init__(self, skin):
self.skin = skin

Expand Down
Loading

0 comments on commit e43d44c

Please sign in to comment.