and3rson / flake8-colors

ANSI colors highlight for Flake8
MIT License
14 stars 6 forks source link

Error with tox when format string is in setup.cfg #4

Open scolby33 opened 6 years ago

scolby33 commented 6 years ago

With the suggested format string in setup.cfg and the following tox.ini:

[testenv:flake8]
basepython = python3
skip_install = true
deps =
    flake8
    flake8-colors
    flake8-docstrings
    flake8-import-order
    pep8-naming
commands =
    flake8 src/project tests/ setup.py

I receive the following error:

$ tox -e flake8
GLOB sdist-make: /Users/scott/dev/project/setup.py
ERROR: invocation failed (exit code 1), logfile: /Users/scott/dev/project/.tox/log/tox-0.log
ERROR: actionid: tox
msg: packaging
cmdargs: ['/Users/scott/.virtualenvs/project/bin/python', local('/Users/scott/dev/project/setup.py'), 'sdist', '--formats=zip', '--dist-dir', local('/Users/scott/dev/project/.tox/dist')]

Traceback (most recent call last):
  File "setup.py", line 102, in <module>
    entry_points=ENTRY_POINTS
  File "/Users/scott/.virtualenvs/project/lib/python3.6/site-packages/setuptools/__init__.py", line 128, in setup
    _install_setup_requires(attrs)
  File "/Users/scott/.virtualenvs/project/lib/python3.6/site-packages/setuptools/__init__.py", line 121, in _install_setup_requires
    dist.parse_config_files(ignore_option_errors=True)
  File "/Users/scott/.virtualenvs/project/lib/python3.6/site-packages/setuptools/dist.py", line 492, in parse_config_files
    _Distribution.parse_config_files(self, filenames=filenames)
  File "/Users/scott/.pyenv/versions/3.6.5/lib/python3.6/distutils/dist.py", line 402, in parse_config_files
    val = parser.get(section,opt)
  File "/Users/scott/.pyenv/versions/3.6.5/lib/python3.6/configparser.py", line 800, in get
    d)
  File "/Users/scott/.pyenv/versions/3.6.5/lib/python3.6/configparser.py", line 394, in before_get
    self._interpolate_some(parser, option, L, value, section, defaults, 1)
  File "/Users/scott/.pyenv/versions/3.6.5/lib/python3.6/configparser.py", line 434, in _interpolate_some
    option, section, rawval, var) from None
configparser.InterpolationMissingOptionError: Bad value substitution: option 'format' in section 'flake8' contains an interpolation key 'text' which is not a valid option name. Raw value: '${cyan}${reset}:${yellow_bold}${reset}:${green_bold}${reset}: ${red_bold}${reset} %(text)s'

ERROR: FAIL could not package project - v = InvocationError('/Users/scott/.virtualenvs/project/bin/python /Users/scott/dev/project/setup.py sdist --formats=zip --dist-dir /Users/scott/dev/project/.tox/dist (see /Users/scott/dev/project/.tox/log/tox-0.log)', 1)

Any idea what's going on here? If this plugin isn't compatible with configuration in setup.cfg, that should be noted in the documentation.

marsfan commented 3 years ago

I have the same issue with using pip if I use the format string in setup.cfg. It seems that most packages parse setup.cfg using the configparser module, which seems to be attempting to parse the format string as some sort of special command, which then fails. Either this package will need to change the format string syntax, or configparser needs to change something about how it works on the back-end. Until then, trying to configure this setting in setup.cfg will break things.