Closed dahlia closed 7 years ago
The build was broken due to setuppy
, but it seems the same to the latest master build. And it's not reproduced in my local environment…
setuppy create: /home/travis/build/PyCQA/flake8-import-order/.tox/setuppy
setuppy installdeps: docutils, Pygments
setuppy inst: /home/travis/build/PyCQA/flake8-import-order/.tox/dist/flake8-import-order-0.11.zip
setuppy installed: appdirs==1.4.0,docutils==0.13.1,flake8-import-order==0.11,packaging==16.8,pycodestyle==2.2.0,Pygments==2.2.0,pyparsing==2.1.10,six==1.10.0
setuppy runtests: PYTHONHASHSEED='2730747044'
setuppy runtests: commands[0] | python setup.py check --metadata --restructuredtext --strict
running check
warning: check: Could not finish the parsing.
error: Please correct your package.
ERROR: InvocationError: '/home/travis/build/PyCQA/flake8-import-order/.tox/setuppy/bin/python setup.py check --metadata --restructuredtext --strict'
@sigmavirus24 I made it to load a style entry point before ImportOrderChecker
is instantiated. Made available style names ordered as well.
What things would there be to change more?
@dahlia I don't merge on this repository. That's @pgjones call. I'll dismiss my review since GitHub's review system is so broken. I would suggest looking at the Travis-CI failures though.
Do you have a use case in mind for this? I'm not sure what the potential uptake is, and how to weigh it against the extra complexity. (I can't take a detailed look until next week, sorry).
My motivation was to implement some private rules of my work without changing flake8-import-order's code or maintaining its fork. I believe there would be other companies than my work which have their own modified rules of PEP 8 for some rationale.
Adding onto the use-case
discussion:
This would mean that new styles need not be added directly to this plugin. People can write other plugins that they distribute separately and which can be installed. Someone could then pip install
this plugin and say flake8-import-order-twisted
or flake8-import-order-django
.
Failure of tox -e setuppy
build was due to a bug of distutils.command.check
, and it was fixed at CPython 2.7.10. Since Travis CI provides CPython 2.7.9, I changed tox -e setuppy
to use Python 3.5 instead to workaround CPython 2.7.9's bug.
Ok, I'm convinced and this looks good to me. I'll merge and make a few tweaks before releasing.
Thanks for merging! 🙏
This patch replaces hardcoded style names with setuptools' entry points.
The group name of extensible entry points is
flake8_import_order.styles
(which follows the convention). Built-in styles also become discovered using entry points so that style names don't have to be hardcoded.Also wrote some docs about extending styles into README.rst, but I'm unsure that my English is fine. If anyone reviews my code and docs I would adjust the patch.
Thanks for the very useful program! :+1: