jayvdb created this task. jayvdb added subscribers: XZise, Aklapper, Gallaecio, jayvdb, pywikibot-bugs-list. jayvdb added a project: pywikibot-core.
TASK DESCRIPTION One of the problems with a `pywikibot` package is that it will effectively break whenever a new language is added to a family. One way to reduce the impact of this problem is to allow family files to be distributed separately from the core library. It would also be nice to allow people to manage their own wiki family class on http://pypi.python.org , which pywikibot loads dynamically. With [[https://www.python.org/dev/peps/pep-0420/|PEP420]], it is possible to set up a namespace package that doesnt depend on setuptools' pkg_resources and pkgutil , which have problems described in that PEP. PEP420 is Python 3.3+ , however as `Family.load` is already doing class loader voodoo, and is the only entry point for new family classes, we can probably provide similar functionality on Python 2, and [[https://pypi.python.org/pypi/importlib2|importlib2]] might do all of the hard work to provide backwards compatibility. Also worth mentioning is openstack is moving away from pkg_resources/pkgutil because of their oddities. See http://specs.openstack.org/openstack/oslo-specs/specs/kilo/drop-namespace-packages.html and https://etherpad.openstack.org/p/kilo-oslo-namespace-packages setuptools doesn't have good support for PEP420 (e.g. https://bitbucket.org/pypa/setuptools/issue/98/having-two-pep-420-implicit-namespace), however pywikibot family needs are simple , and the setuptools problems can be worked around quite easily. It doesnt seem possible to install new family classes into pywikibot.family from another package, due to `pywikibot/__init__.py` not being empty. Unless a solution can be found for that, `Family.load` could load family classes from a new namespace `pywikibot_families`. setuptools eggs appear to not be PEP420-able, so to create a PEP420 package using setuptools, the `setup` call needs to include `zip_safe=False`, and looks like: ``` from setuptools import setup setup( name='PywikibotWikimediaFamily', version='0.1', description='Wikimedia configuration for Pywikibot', long_description='Wikimedia configuration for Pywikibot', maintainer='The Pywikibot team', maintainer_email='[email protected]', license='MIT License', packages=['pywikibot.families', 'pywikibot.families.wikimedia'], install_requires='pywikibot', url='https://www.mediawiki.org/wiki/Pywikibot', classifiers=[ 'License :: OSI Approved :: MIT License', 'Development Status :: 4 - Beta', 'Operating System :: OS Independent', 'Intended Audience :: Developers', 'Environment :: Console', 'Programming Language :: Python :: 3.3', ], use_2to3=False, zip_safe=False ) ``` with family modules in `pywikibot/families/wikimedia/` and no other files in the `pywikibot/` directory tree. TASK DETAIL https://phabricator.wikimedia.org/T104130 EMAIL PREFERENCES https://phabricator.wikimedia.org/settings/panel/emailpreferences/ To: jayvdb Cc: pywikibot-bugs-list, jayvdb, Gallaecio, Aklapper, XZise, Malyacko, P.Copp _______________________________________________ pywikibot-bugs mailing list [email protected] https://lists.wikimedia.org/mailman/listinfo/pywikibot-bugs
