When running pycodestyle 2.3.1 with Python 3.7, I get:
/home/florian/proj/qutebrowser/git/.tox/flake8/lib/python3.7/site-packages/pycodestyle.py:113: FutureWarning: Possible nested set at position 1
EXTRANEOUS_WHITESPACE_REGEX = re.compile(r'[[({] | []}),;:]')
See https://docs.python.org/dev/whatsnew/3.7.html
Support of nested sets and set operations in regular expressions as ..... To avoid a warning escape them with a backslash.
Let me see if I can fix this :)
Getting the same thing in Atom while using Python 3.7.
Installed linter-flake8 and got
python37\lib\site-packages\pycodestyle.py:113: FutureWarning: Possible nested set at position 1
EXTRANEOUS_WHITESPACE_REGEX = re.compile(r'[[({] | []}),;:]')
As a python noob, I really don't know what else to add :(
@RawrBear Make sure that your pycodestyle version is v2.4.0 or higher as that was the first release that included the fix.
@Arcanemagus I didn't get notified about your message until now.
Thanks for the fix. I updated pycodestyle through pip which worked but broke flake8 because apparently its only compatible with version 2.3.1. so linter-flake8 is a no go right now :/
Fix one problem, find another ten lol
@RawrBear I had the same problem, so I just copied the escaped version of the line to my code:
Fixed version: https://github.com/PyCQA/pycodestyle/blob/master/pycodestyle.py#L133
@RawrBear I've found in the meantime that installing flake8 from master works around the problem:
pip install -e git+https://gitlab.com/pycqa/flake8#egg=flake8
Hope this helps.
@declantraynor Maybe I'm nitpicking but pip install -e without a specific commit is prone to changes and breakage. I think it's a good idea to pin a specific commit, the newest is 9631dac5 as of time of writing
pip install -e git+https://gitlab.com/pycqa/flake8@9631dac5#egg=flake8
In addition you can specify the directory where flake8 will be installed with the option --src. So personally I used this command to install flake8 in my global site package :
pip3 install -e git+https://gitlab.com/pycqa/flake8@9631dac5#egg=flake
8 --src /usr/local/lib/python3.7/site-packages
The workaround doesn't seem to function in Pipenv-based projects, where the specified flake8 dependency gets discarded and 3.5.0 is used regardless.
Should we open a ticket on the flake8 repo? It is still broken for me.
The workaround ... doesn't work, as I cannot access gitlab.
$ pip install -e git+https://gitlab.com/pycqa/flake8@9631dac5#egg=flake8
Obtaining flake8 from git+https://gitlab.com/pycqa/flake8@9631dac5#egg=flake8
Cloning https://gitlab.com/pycqa/flake8 (to revision 9631dac5) to ./venv/src/flake8
fatal: unable to access 'https://gitlab.com/pycqa/flake8/': LibreSSL SSL_connect: SSL_ERROR_SYSCALL in connection to gitlab.com:443
Command "git clone -q https://gitlab.com/pycqa/flake8 /xxx/venv/src/flake8" failed with error code 128 in None
But I can reach gitlab at port 443 though.
$ telnet gitlab.com 443
Trying 52.167.219.168...
Connected to gitlab.com.
Escape character is '^]'.
Downstream flake8 issue: https://gitlab.com/pycqa/flake8/issues/437
FYI if you want to fix this yourself modify the file, as it is a simple problem with the regex.
my error:
flake8 --select=F test.py
/Users/jkirchoff/Documents/GitHub/test/venv/lib/python3.7/site-packages/pep8.py:110:
FutureWarning: Possible nested set at position 1
EXTRANEOUS_WHITESPACE_REGEX = re.compile(r'[[({] | []}),;:]')
I modified the regex, to my best guess until this is resolved by escaping the literals.
EXTRANEOUS_WHITESPACE_REGEX = re.compile(r'[\[\(\{]\s|\s\[\]\}\)\,\;\:]')
My understanding of this is that there is a self-defining-loop that causes this error.
anyway if you modify the line 110, this fixes the error.
=)
@hongqn , you are correct the exact path on my machine is
/usr/local/lib/python3.7/site-packages/pycodestyle.py
Hi All,
I know this is closed but anyone that used my regex, cc: @VarunDelft
please update using this one.
This finds the intended targets, any spaces after ({[ and before ]}),:;
EXTRANEOUS_WHITESPACE_REGEX = re.compile(r'((\(|\[|\{) | (\}|\]|\)|\;|\:|\,))')
Request: As I am unaware of your PR process please pass along to whom it concerns. =)
Have a great day all!
@JayRizzo Thanks for the workaround! Just to clarify, it should be pep8.py in your environment's site-packages where you make that edit?
Thanks @JayRizzo
Given that flake8 is still stuck at 3.5.0, because of an incompatibly change in pycodestyle==2.4.0, could there be a release of pycodestyle==2.3.2 with just that regex fix ?
Editing /usr/local/lib/python3.7/site-packages/pycodestyle.py in place feels like a hack ... I guess I should make a PR, but I don't know if there are branches or infrastructure in place to release a 2.3.2; is there a branch for 2.3 or something like that ?
Here is a tag for 2.3.1 (it is the latest with a tag before 2.4.0) https://github.com/PyCQA/pycodestyle/tree/2.3.1
Thanks for the link / I tried to use 2.3.1 explicitly, but it doesn't have that regex fix.
flake8 `find src -name '*.py'`
/xxx/venv/lib/python3.7/site-packages/pycodestyle.py:113: FutureWarning: Possible nested set at position 1
EXTRANEOUS_WHITESPACE_REGEX = re.compile(r'[[({] | []}),;:]')
(venv) $ pip freeze | grep pycodes
pycodestyle==2.3.1
(venv) $ pip freeze | grep flake8
flake8==3.5.0
I opened a PR, but I'm not sure what branch to target with it- it is at master for now https://github.com/PyCQA/pycodestyle/pull/796
If you are using pytest-flake8 you can disable this warning with:
filterwarnings =
ignore::FutureWarning
Place these two lines in your setup.cfg or similar file. Full example: https://github.com/wemake-services/wemake-python-styleguide/blob/master/setup.cfg#L35-L38
FYI flake8 3.6.0 has been released which includes support for pycodestyle 2.4.0 and thus removes this warning if you're using flake8! Just make sure to upgrade to 3.6.0. 馃帀
Most helpful comment
@declantraynor Maybe I'm nitpicking but
pip install -ewithout a specific commit is prone to changes and breakage. I think it's a good idea to pin a specific commit, the newest is9631dac5as of time of writing