Skip to content

Commit 9c7a93c

Browse files
Merge pull request #5 from hugovk/rm-eol
Update Travis CI to only test supported versions
2 parents f13f7c1 + d1fdab4 commit 9c7a93c

File tree

6 files changed

+30
-31
lines changed

6 files changed

+30
-31
lines changed

.travis.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
language: python
22
python:
3-
- "2.6"
43
- "2.7"
5-
- "3.3"
64
- "3.4"
75
- "3.5"
86
- "3.5-dev" # 3.5 development branch
@@ -18,4 +16,4 @@ install:
1816
- pip install -U setuptools pip setuptools_scm pytest
1917
- pip install $EDITABLE .
2018
# command to run tests
21-
script: pytest
19+
script: pytest

README.rst

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
Welcome to apipkg!
22
------------------------
33

4-
With apipkg you can control the exported namespace of a
5-
python package and greatly reduce the number of imports for your users.
6-
It is a `small pure python module`_ that works on virtually all Python
7-
versions, including CPython2.3 to Python3.1, Jython and PyPy. It co-operates
8-
well with Python's ``help()`` system, custom importers (PEP302) and common
9-
command line completion tools.
4+
With apipkg you can control the exported namespace of a Python package and
5+
greatly reduce the number of imports for your users.
6+
It is a `small pure Python module`_ that works on CPython 2.7 and 3.4+,
7+
Jython and PyPy. It cooperates well with Python's ``help()`` system,
8+
custom importers (PEP302) and common command-line completion tools.
109

1110
Usage is very simple: you can require 'apipkg' as a dependency or you
12-
can copy paste the <200 Lines of code into your project.
11+
can copy paste the ~200 lines of code into your project.
1312

1413

1514
Tutorial example
@@ -32,7 +31,7 @@ The package is initialized with a dictionary as namespace.
3231
You need to create a ``_mypkg`` package with a ``somemodule.py``
3332
and ``othermodule.py`` containing the respective classes.
3433
The ``_mypkg`` is not special - it's a completely
35-
regular python package.
34+
regular Python package.
3635

3736
Namespace dictionaries contain ``name: value`` mappings
3837
where the value may be another namespace dictionary or
@@ -53,7 +52,7 @@ loaded when they are accessed. This means:
5352
* lazy loading - only what is actually needed is ever loaded
5453

5554
* only the root "mypkg" ever needs to be imported to get
56-
access to the complete functionality.
55+
access to the complete functionality
5756

5857
* the underlying modules are also accessible, for example::
5958

@@ -69,7 +68,7 @@ for example ``_mypkg/apipkg.py`` in the above example. You
6968
then import the ``initpkg`` function from that new place and
7069
are good to go.
7170

72-
.. _`small pure python module`:
71+
.. _`small pure Python module`:
7372
.. _`apipkg.py`: https://github.com/pytest-dev/apipkg/blob/master/src/apipkg/__init__.py
7473

7574
Feedback?

setup.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import re
21
from setuptools import setup, find_packages
32

43

@@ -12,14 +11,15 @@ def main():
1211
name='apipkg',
1312
description='apipkg: namespace control and lazy-import mechanism',
1413
long_description=readme(),
14+
python_requires='>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*',
1515
setup_requires=[
1616
'setuptools_scm',
1717
'setuptools>=30.3.0', # introduced setup.cfg metadata
1818
],
1919
use_scm_version={
2020
'write_to': 'src/apipkg/version.py'
2121
},
22-
url='http://github.com/pytest-dev/apipkg',
22+
url='https://github.com/pytest-dev/apipkg',
2323
license='MIT License',
2424
platforms=['unix', 'linux', 'osx', 'cygwin', 'win32'],
2525
author='holger krekel',
@@ -34,19 +34,21 @@ def main():
3434
'Operating System :: Microsoft :: Windows',
3535
'Operating System :: MacOS :: MacOS X',
3636
'Topic :: Software Development :: Libraries',
37-
# Specify the Python versions you support here. In particular, ensure
38-
# that you indicate whether you support Python 2, Python 3 or both.
37+
# Specify the Python versions you support here.
38+
# In particular, ensure that you indicate whether
39+
# you support Python 2, Python 3 or both.
3940
'Programming Language :: Python',
4041
'Programming Language :: Python :: 2',
4142
'Programming Language :: Python :: 2.7',
4243
'Programming Language :: Python :: 3',
4344
'Programming Language :: Python :: 3.4',
4445
'Programming Language :: Python :: 3.5',
4546
'Programming Language :: Python :: 3.6',
46-
],
47+
],
4748
packages=find_packages('src'),
4849
package_dir={'': 'src'},
4950
)
5051

52+
5153
if __name__ == '__main__':
5254
main()

src/apipkg/__init__.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"""
2-
apipkg: control the exported namespace of a python package.
2+
apipkg: control the exported namespace of a Python package.
33
4-
see http://pypi.python.org/pypi/apipkg
4+
see https://pypi.python.org/pypi/apipkg
55
66
(c) holger krekel, 2009 - MIT license
77
"""
@@ -11,6 +11,7 @@
1111

1212
from .version import version as __version__
1313

14+
1415
def _py_abspath(path):
1516
"""
1617
special version of abspath
@@ -122,13 +123,13 @@ def __init__(self, name, importspec, implprefix=None, attr=None):
122123
self.__map__[name] = (modpath, attrname)
123124

124125
def __repr__(self):
125-
l = []
126+
repr_list = []
126127
if hasattr(self, '__version__'):
127-
l.append("version=" + repr(self.__version__))
128+
repr_list.append("version=" + repr(self.__version__))
128129
if hasattr(self, '__file__'):
129-
l.append('from ' + repr(self.__file__))
130-
if l:
131-
return '<ApiModule %r %s>' % (self.__name__, " ".join(l))
130+
repr_list.append('from ' + repr(self.__file__))
131+
if repr_list:
132+
return '<ApiModule %r %s>' % (self.__name__, " ".join(repr_list))
132133
return '<ApiModule %r>' % (self.__name__,)
133134

134135
def __makeattr(self, name):

test_apipkg.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ def test_realmodule_dict_import(self):
8585
def test_realmodule___doc__(self):
8686
"""test whether the __doc__ attribute is set properly from initpkg"""
8787
import realtest.x.module
88-
print (realtest.x.module.__map__)
88+
print(realtest.x.module.__map__)
8989
assert realtest.x.module.__doc__ == 'test module'
9090

9191

@@ -121,7 +121,7 @@ def test_recursive_import(self, monkeypatch, tmpdir):
121121
pkgdir.join('submod.py').write(py.code.Source("""
122122
import recmodule
123123
class someclass: pass
124-
print (recmodule.__dict__)
124+
print(recmodule.__dict__)
125125
"""))
126126
monkeypatch.syspath_prepend(tmpdir)
127127
import recmodule
@@ -174,7 +174,7 @@ def test_parsenamespace():
174174
test.raises __.test.outcome::raises
175175
"""
176176
d = parsenamespace(spec)
177-
print (d)
177+
print(d)
178178
assert d == {
179179
'test': {'raises': '__.test.outcome::raises'},
180180
'path': {
@@ -364,7 +364,7 @@ def init():
364364
if mode == 'attr':
365365
assert mod.newattr == 42
366366
elif mode == "dict":
367-
print (list(mod.__dict__.keys()))
367+
print(list(mod.__dict__.keys()))
368368
assert 'newattr' in mod.__dict__
369369
elif mode == "onfirst":
370370
assert not hasattr(mod, '__onfirstaccess__')

tox.ini

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[tox]
2-
envlist=py27,py26,py33,py34,jython,flakes
2+
envlist=py27,py34,py35,py36,jython,flakes
33

44
[tox:hudson]
55
sdistsrc={distshare}/apipkg-*
@@ -16,7 +16,6 @@ commands=py.test-jython []
1616
deps=flake8
1717
commands=flake8
1818

19-
2019
[flake8]
2120
exclude=.tox/,.env/,dist/,build/,example/
2221
max_complexity=11

0 commit comments

Comments
 (0)