diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 40149c54..564aa0c5 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -34,13 +34,9 @@ jobs: uses: actions/setup-python@v2 with: python-version: ${{ matrix.python }} - - name: Install tox - run: | - python -m pip install --upgrade pip - pip install tox - name: Test run: | - tox -e ${{ matrix.tox_env }} + pipx run tox -e ${{ matrix.tox_env }} deploy: diff --git a/py/_vendored_packages/apipkg-1.5.dist-info/RECORD b/py/_vendored_packages/apipkg-1.5.dist-info/RECORD deleted file mode 100644 index 8611704e..00000000 --- a/py/_vendored_packages/apipkg-1.5.dist-info/RECORD +++ /dev/null @@ -1,10 +0,0 @@ -../../../../home/ran/.cache/pycache/tmp/pip-target-oxds71ih/lib/python/apipkg/__init__.cpython-39.pyc,, -../../../../home/ran/.cache/pycache/tmp/pip-target-oxds71ih/lib/python/apipkg/version.cpython-39.pyc,, -apipkg-1.5.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4 -apipkg-1.5.dist-info/METADATA,sha256=tIG1DSBzSeqmSRpOKHSEBmT1eOPdK8xK01xAIADuks4,3800 -apipkg-1.5.dist-info/RECORD,, -apipkg-1.5.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 -apipkg-1.5.dist-info/WHEEL,sha256=gduuPyBvFJQSQ0zdyxF7k0zynDXbIbvg5ZBHoXum5uk,110 -apipkg-1.5.dist-info/top_level.txt,sha256=3TGS6nmN7kjxhUK4LpPCB3QkQI34QYGrT0ZQGWajoZ8,7 -apipkg/__init__.py,sha256=VogR4mDwYmeOdJnjGi-RoMB1qJnD6_puDYj_nRolzhM,6707 -apipkg/version.py,sha256=YN6DnKyEPqjDAauJuwJRG9vlKbWVLd9gAbH7mkQXXNo,114 diff --git a/py/_vendored_packages/apipkg-1.5.dist-info/INSTALLER b/py/_vendored_packages/apipkg-2.0.0.dist-info/INSTALLER similarity index 100% rename from py/_vendored_packages/apipkg-1.5.dist-info/INSTALLER rename to py/_vendored_packages/apipkg-2.0.0.dist-info/INSTALLER diff --git a/py/_vendored_packages/apipkg-2.0.0.dist-info/LICENSE b/py/_vendored_packages/apipkg-2.0.0.dist-info/LICENSE new file mode 100644 index 00000000..ff33b8f7 --- /dev/null +++ b/py/_vendored_packages/apipkg-2.0.0.dist-info/LICENSE @@ -0,0 +1,18 @@ + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all + copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE. diff --git a/py/_vendored_packages/apipkg-1.5.dist-info/METADATA b/py/_vendored_packages/apipkg-2.0.0.dist-info/METADATA similarity index 82% rename from py/_vendored_packages/apipkg-1.5.dist-info/METADATA rename to py/_vendored_packages/apipkg-2.0.0.dist-info/METADATA index ac14b4bb..7eea770a 100644 --- a/py/_vendored_packages/apipkg-1.5.dist-info/METADATA +++ b/py/_vendored_packages/apipkg-2.0.0.dist-info/METADATA @@ -1,12 +1,12 @@ Metadata-Version: 2.1 Name: apipkg -Version: 1.5 +Version: 2.0.0 Summary: apipkg: namespace control and lazy-import mechanism Home-page: https://github.com/pytest-dev/apipkg Author: holger krekel Maintainer: Ronny Pfannschmidt Maintainer-email: opensource@ronnypfannschmidt.de -License: MIT License +License: MIT Platform: unix Platform: linux Platform: osx @@ -15,10 +15,9 @@ Platform: win32 Classifier: Development Status :: 4 - Beta Classifier: Intended Audience :: Developers Classifier: License :: OSI Approved :: MIT License -Classifier: Operating System :: POSIX -Classifier: Operating System :: Microsoft :: Windows Classifier: Operating System :: MacOS :: MacOS X -Classifier: Topic :: Software Development :: Libraries +Classifier: Operating System :: Microsoft :: Windows +Classifier: Operating System :: POSIX Classifier: Programming Language :: Python Classifier: Programming Language :: Python :: 2 Classifier: Programming Language :: Python :: 2.7 @@ -26,10 +25,17 @@ Classifier: Programming Language :: Python :: 3 Classifier: Programming Language :: Python :: 3.4 Classifier: Programming Language :: Python :: 3.5 Classifier: Programming Language :: Python :: 3.6 -Requires-Python: >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.* +Classifier: Programming Language :: Python :: 3.7 +Classifier: Programming Language :: Python :: 3.8 +Classifier: Programming Language :: Python :: 3.9 +Classifier: Programming Language :: Python :: Implementation :: CPython +Classifier: Topic :: Software Development :: Libraries +Requires-Python: !=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,>=2.7 +Description-Content-Type: text/x-rst +License-File: LICENSE -Welcome to apipkg! ------------------------- +Welcome to apipkg ! +------------------- With apipkg you can control the exported namespace of a Python package and greatly reduce the number of imports for your users. @@ -47,6 +53,7 @@ Tutorial example Here is a simple ``mypkg`` package that specifies one namespace and exports two objects imported from different modules:: + # mypkg/__init__.py import apipkg apipkg.initpkg(__name__, { @@ -106,10 +113,13 @@ Feedback? If you have questions you are welcome to -* join the #pylib channel on irc.freenode.net -* create an issue on https://github.com/pytest-dev/apipkg/issues +* join the **#pytest** channel on irc.libera.chat_ + (using an IRC client, via webchat_, or via Matrix_). +* create an issue on the bugtracker_ -have fun, -holger krekel +.. _irc.libera.chat: ircs://irc.libera.chat:6697/#pytest +.. _webchat: https://web.libera.chat/#pytest +.. _matrix: https://matrix.to/#/%23pytest:libera.chat +.. _bugtracker: https://github.com/pytest-dev/apipkg/issues diff --git a/py/_vendored_packages/apipkg-2.0.0.dist-info/RECORD b/py/_vendored_packages/apipkg-2.0.0.dist-info/RECORD new file mode 100644 index 00000000..357b8b9c --- /dev/null +++ b/py/_vendored_packages/apipkg-2.0.0.dist-info/RECORD @@ -0,0 +1,11 @@ +apipkg-2.0.0.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4 +apipkg-2.0.0.dist-info/LICENSE,sha256=6J7tEHTTqUMZi6E5uAhE9bRFuGC7p0qK6twGEFZhZOo,1054 +apipkg-2.0.0.dist-info/METADATA,sha256=GqNwkxraK5UTxObLVXTLc2UqktOPwZnKqdk2ThzHX0A,4292 +apipkg-2.0.0.dist-info/RECORD,, +apipkg-2.0.0.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +apipkg-2.0.0.dist-info/WHEEL,sha256=WzZ8cwjh8l0jtULNjYq1Hpr-WCqCRgPr--TX4P5I1Wo,110 +apipkg-2.0.0.dist-info/top_level.txt,sha256=3TGS6nmN7kjxhUK4LpPCB3QkQI34QYGrT0ZQGWajoZ8,7 +apipkg/__init__.py,sha256=gpbD3O57S9f-LsO2e-XwI6IGISayicfnCq3B5y_8frg,6978 +apipkg/__pycache__/__init__.cpython-39.pyc,, +apipkg/__pycache__/version.cpython-39.pyc,, +apipkg/version.py,sha256=bgZFg-f3UKhgE-z2w8RoFrwqRBzJBZkM4_jKFiYB9eU,142 diff --git a/py/_vendored_packages/apipkg-1.5.dist-info/REQUESTED b/py/_vendored_packages/apipkg-2.0.0.dist-info/REQUESTED similarity index 100% rename from py/_vendored_packages/apipkg-1.5.dist-info/REQUESTED rename to py/_vendored_packages/apipkg-2.0.0.dist-info/REQUESTED diff --git a/py/_vendored_packages/apipkg-1.5.dist-info/WHEEL b/py/_vendored_packages/apipkg-2.0.0.dist-info/WHEEL similarity index 70% rename from py/_vendored_packages/apipkg-1.5.dist-info/WHEEL rename to py/_vendored_packages/apipkg-2.0.0.dist-info/WHEEL index 1316c41d..b733a60d 100644 --- a/py/_vendored_packages/apipkg-1.5.dist-info/WHEEL +++ b/py/_vendored_packages/apipkg-2.0.0.dist-info/WHEEL @@ -1,5 +1,5 @@ Wheel-Version: 1.0 -Generator: bdist_wheel (0.31.1) +Generator: bdist_wheel (0.37.0) Root-Is-Purelib: true Tag: py2-none-any Tag: py3-none-any diff --git a/py/_vendored_packages/apipkg-1.5.dist-info/top_level.txt b/py/_vendored_packages/apipkg-2.0.0.dist-info/top_level.txt similarity index 100% rename from py/_vendored_packages/apipkg-1.5.dist-info/top_level.txt rename to py/_vendored_packages/apipkg-2.0.0.dist-info/top_level.txt diff --git a/py/_vendored_packages/apipkg/__init__.py b/py/_vendored_packages/apipkg/__init__.py index 93180484..350d8c4b 100644 --- a/py/_vendored_packages/apipkg/__init__.py +++ b/py/_vendored_packages/apipkg/__init__.py @@ -9,7 +9,7 @@ import sys from types import ModuleType -from .version import version as __version__ +from .version import version as __version__ # NOQA:F401 def _py_abspath(path): @@ -17,7 +17,7 @@ def _py_abspath(path): special version of abspath that will leave paths from jython jars alone """ - if path.startswith('__pyclasspath__'): + if path.startswith("__pyclasspath__"): return path else: @@ -28,6 +28,7 @@ def distribution_version(name): """try to get the version of the named distribution, returs None on failure""" from pkg_resources import get_distribution, DistributionNotFound + try: dist = get_distribution(name) except DistributionNotFound: @@ -41,35 +42,37 @@ def initpkg(pkgname, exportdefs, attr=None, eager=False): attr = attr or {} oldmod = sys.modules.get(pkgname) d = {} - f = getattr(oldmod, '__file__', None) + f = getattr(oldmod, "__file__", None) if f: f = _py_abspath(f) - d['__file__'] = f - if hasattr(oldmod, '__version__'): - d['__version__'] = oldmod.__version__ - if hasattr(oldmod, '__loader__'): - d['__loader__'] = oldmod.__loader__ - if hasattr(oldmod, '__path__'): - d['__path__'] = [_py_abspath(p) for p in oldmod.__path__] - if hasattr(oldmod, '__package__'): - d['__package__'] = oldmod.__package__ - if '__doc__' not in exportdefs and getattr(oldmod, '__doc__', None): - d['__doc__'] = oldmod.__doc__ + d["__file__"] = f + if hasattr(oldmod, "__version__"): + d["__version__"] = oldmod.__version__ + if hasattr(oldmod, "__loader__"): + d["__loader__"] = oldmod.__loader__ + if hasattr(oldmod, "__path__"): + d["__path__"] = [_py_abspath(p) for p in oldmod.__path__] + if hasattr(oldmod, "__package__"): + d["__package__"] = oldmod.__package__ + if "__doc__" not in exportdefs and getattr(oldmod, "__doc__", None): + d["__doc__"] = oldmod.__doc__ + d["__spec__"] = getattr(oldmod, "__spec__", None) d.update(attr) if hasattr(oldmod, "__dict__"): oldmod.__dict__.update(d) mod = ApiModule(pkgname, exportdefs, implprefix=pkgname, attr=d) sys.modules[pkgname] = mod # eagerload in bypthon to avoid their monkeypatching breaking packages - if 'bpython' in sys.modules or eager: + if "bpython" in sys.modules or eager: for module in list(sys.modules.values()): if isinstance(module, ApiModule): module.__dict__ + return mod def importobj(modpath, attrname): """imports a module, then resolves the attrname on it""" - module = __import__(modpath, None, None, ['__doc__']) + module = __import__(modpath, None, None, ["__doc__"]) if not attrname: return module @@ -82,20 +85,22 @@ def importobj(modpath, attrname): class ApiModule(ModuleType): """the magical lazy-loading module standing""" + def __docget(self): try: return self.__doc except AttributeError: - if '__doc__' in self.__map__: - return self.__makeattr('__doc__') + if "__doc__" in self.__map__: + return self.__makeattr("__doc__") def __docset(self, value): self.__doc = value + __doc__ = property(__docget, __docset) def __init__(self, name, importspec, implprefix=None, attr=None): self.__name__ = name - self.__all__ = [x for x in importspec if x != '__onfirstaccess__'] + self.__all__ = [x for x in importspec if x != "__onfirstaccess__"] self.__map__ = {} self.__implprefix__ = implprefix or name if attr: @@ -104,47 +109,47 @@ def __init__(self, name, importspec, implprefix=None, attr=None): setattr(self, name, val) for name, importspec in importspec.items(): if isinstance(importspec, dict): - subname = '%s.%s' % (self.__name__, name) + subname = "{}.{}".format(self.__name__, name) apimod = ApiModule(subname, importspec, implprefix) sys.modules[subname] = apimod setattr(self, name, apimod) else: - parts = importspec.split(':') + parts = importspec.split(":") modpath = parts.pop(0) attrname = parts and parts[0] or "" - if modpath[0] == '.': + if modpath[0] == ".": modpath = implprefix + modpath if not attrname: - subname = '%s.%s' % (self.__name__, name) + subname = "{}.{}".format(self.__name__, name) apimod = AliasModule(subname, modpath) sys.modules[subname] = apimod - if '.' not in name: + if "." not in name: setattr(self, name, apimod) else: self.__map__[name] = (modpath, attrname) def __repr__(self): repr_list = [] - if hasattr(self, '__version__'): + if hasattr(self, "__version__"): repr_list.append("version=" + repr(self.__version__)) - if hasattr(self, '__file__'): - repr_list.append('from ' + repr(self.__file__)) + if hasattr(self, "__file__"): + repr_list.append("from " + repr(self.__file__)) if repr_list: - return '' % (self.__name__, " ".join(repr_list)) - return '' % (self.__name__,) + return "".format(self.__name__, " ".join(repr_list)) + return "".format(self.__name__) def __makeattr(self, name): """lazily compute value for name or raise AttributeError if unknown.""" # print "makeattr", self.__name__, name target = None - if '__onfirstaccess__' in self.__map__: - target = self.__map__.pop('__onfirstaccess__') + if "__onfirstaccess__" in self.__map__: + target = self.__map__.pop("__onfirstaccess__") importobj(*target)() try: modpath, attrname = self.__map__[name] except KeyError: - if target is not None and name != '__onfirstaccess__': + if target is not None and name != "__onfirstaccess__": # retry, onfirstaccess might have set attrs return getattr(self, name) raise AttributeError(name) @@ -163,10 +168,10 @@ def __makeattr(self, name): def __dict__(self): # force all the content of the module # to be loaded when __dict__ is read - dictdescr = ModuleType.__dict__['__dict__'] + dictdescr = ModuleType.__dict__["__dict__"] dict = dictdescr.__get__(self) if dict is not None: - hasattr(self, 'some') + hasattr(self, "some") for name in self.__all__: try: self.__makeattr(name) @@ -186,19 +191,22 @@ def getmod(): mod.append(x) return mod[0] - class AliasModule(ModuleType): + x = modpath + ("." + attrname if attrname else "") + repr_result = "".format(modname, x) + class AliasModule(ModuleType): def __repr__(self): - x = modpath - if attrname: - x += "." + attrname - return '' % (modname, x) + return repr_result def __getattribute__(self, name): try: return getattr(getmod(), name) except ImportError: - return None + if modpath == "pytest" and attrname is None: + # hack for pylibs py.test + return None + else: + raise def __setattr__(self, name, value): setattr(getmod(), name, value) diff --git a/py/_vendored_packages/apipkg/version.py b/py/_vendored_packages/apipkg/version.py index c25fc7c9..c5b4e0e7 100644 --- a/py/_vendored_packages/apipkg/version.py +++ b/py/_vendored_packages/apipkg/version.py @@ -1,4 +1,5 @@ # coding: utf-8 # file generated by setuptools_scm # don't change, don't track in version control -version = '1.5' +version = '2.0.0' +version_tuple = (2, 0, 0) diff --git a/py/_vendored_packages/iniconfig-1.1.1.dist-info/RECORD b/py/_vendored_packages/iniconfig-1.1.1.dist-info/RECORD index 73a6fe1e..16823333 100644 --- a/py/_vendored_packages/iniconfig-1.1.1.dist-info/RECORD +++ b/py/_vendored_packages/iniconfig-1.1.1.dist-info/RECORD @@ -1,4 +1,3 @@ -../../../../home/ran/.cache/pycache/tmp/pip-target-oxds71ih/lib/python/iniconfig/__init__.cpython-39.pyc,, iniconfig-1.1.1.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4 iniconfig-1.1.1.dist-info/LICENSE,sha256=KvaAw570k_uCgwNW0dPfGstaBgM8ui3sehniHKp3qGY,1061 iniconfig-1.1.1.dist-info/METADATA,sha256=_4-oFKpRXuZv5rzepScpXRwhq6DzqsgbnA5ZpgMUMcs,2405 @@ -8,4 +7,5 @@ iniconfig-1.1.1.dist-info/WHEEL,sha256=ADKeyaGyKF5DwBNE0sRE5pvW-bSkFMJfBuhzZ3rce iniconfig-1.1.1.dist-info/top_level.txt,sha256=7KfM0fugdlToj9UW7enKXk2HYALQD8qHiyKtjhSzgN8,10 iniconfig/__init__.py,sha256=-pBe5AF_6aAwo1CxJQ8i_zJq6ejc6IxHta7qk2tNJhY,5208 iniconfig/__init__.pyi,sha256=-4KOctzq28ohRmTZsqlH6aylyFqsNKxYqtk1dteypi4,1205 +iniconfig/__pycache__/__init__.cpython-39.pyc,, iniconfig/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 00000000..e386ea0b --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,6 @@ +[build-system] +requires = [ + "setuptools", + "setuptools_scm[toml]", +] +build-backend = "setuptools.build_meta" diff --git a/setup.py b/setup.py index d097daa5..5e2e0a8c 100644 --- a/setup.py +++ b/setup.py @@ -7,7 +7,7 @@ def main(): description='library with cross-python path, ini-parsing, io, code, log facilities', long_description=open('README.rst').read(), use_scm_version={"write_to": "py/_version.py"}, - setup_requires=["setuptools-scm"], + setup_requires=["setuptools_scm"], url='https://py.readthedocs.io/', license='MIT license', platforms=['unix', 'linux', 'osx', 'cygwin', 'win32'], diff --git a/testing/log/test_warning.py b/testing/log/test_warning.py index a460c319..36efec91 100644 --- a/testing/log/test_warning.py +++ b/testing/log/test_warning.py @@ -8,8 +8,7 @@ mypath = py.path.local(__file__).new(ext=".py") -win = sys.platform.startswith('win') -pytestmark = pytest.mark.skipif(win and LooseVersion(pytest.__version__) >= LooseVersion('3.1'), +pytestmark = pytest.mark.skipif(LooseVersion(pytest.__version__) >= LooseVersion('3.1'), reason='apiwarn is not compatible with pytest >= 3.1 (#162)')