diff --git a/pre_commit_hooks/autopep8_wrapper.py b/pre_commit_hooks/autopep8_wrapper.py
index a79a120..f6f55fb 100644
--- a/pre_commit_hooks/autopep8_wrapper.py
+++ b/pre_commit_hooks/autopep8_wrapper.py
@@ -10,7 +10,7 @@ import autopep8
 
 def main(argv=None):
     argv = argv if argv is not None else sys.argv[1:]
-    args = autopep8.parse_args(argv)
+    args = autopep8.parse_args(argv, apply_config=True)
 
     retv = 0
     for filename in args.files:
diff --git a/setup.py b/setup.py
index 4fb9139..b86acd1 100644
--- a/setup.py
+++ b/setup.py
@@ -27,7 +27,7 @@ setup(
     packages=find_packages('.', exclude=('tests*', 'testing*')),
     install_requires=[
         'argparse',
-        'autopep8',
+        'autopep8>=1.1',
         'flake8',
         'plumbum',
         'pyflakes',

Autopep8 doesn't respect pep8 section in setup.cfg
Since https://github.com/hhatto/autopep8/pull/167 autopep8 has started reading the ```pep8``` section from ```tox.ini``` or ```setup.cfg``` of a project. However, the autopep8 hook ignores this as it calls ```autopep8.parse_args()``` and ```autopep8.fix_code()``` without a second value (which defaults to ```False```).

Any way we could get this to work?
diff --git a/tests/autopep8_wrapper_test.py b/tests/autopep8_wrapper_test.py
index f32e8a0..9a395c9 100644
--- a/tests/autopep8_wrapper_test.py
+++ b/tests/autopep8_wrapper_test.py
@@ -2,7 +2,7 @@ from __future__ import absolute_import
 from __future__ import unicode_literals
 
 import io
-import os.path
+import os
 
 import pytest
 
@@ -17,9 +17,30 @@ from pre_commit_hooks.autopep8_wrapper import main
     ),
 )
 def test_main_failing(tmpdir, input_src, expected_ret, output_src):
-    filename = os.path.join(tmpdir.strpath, 'test.py')
+    filename = tmpdir.join('test.py').strpath
     with io.open(filename, 'w') as file_obj:
         file_obj.write(input_src)
     ret = main([filename, '-i', '-v'])
     assert ret == expected_ret
     assert io.open(filename).read() == output_src
+
+
+@pytest.yield_fixture
+def in_tmpdir(tmpdir):
+    pwd = os.getcwd()
+    os.chdir(tmpdir.strpath)
+    try:
+        yield
+    finally:
+        os.chdir(pwd)
+
+
+@pytest.mark.usefixtures('in_tmpdir')
+def test_respects_config_file():
+    with io.open('setup.cfg', 'w') as setup_cfg:
+        setup_cfg.write('[pep8]\nignore=E221')
+
+    with io.open('test.py', 'w') as test_py:
+        test_py.write('print(1    + 2)\n')
+
+    assert main(['test.py', '-i', '-v']) == 0

pip install -e .
parse_log_pytest
requirements.txt
pytest flake8 pylint
apt-get update apt-get install -y gcc
3.9
requirements.txt
pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning
astroid==3.3.9
autopep8==2.3.2
dill==0.3.9
exceptiongroup==1.2.2
flake8==7.2.0
iniconfig==2.1.0
isort==6.0.1
mccabe==0.7.0
packaging==24.2
platformdirs==4.3.7
pluggy==1.5.0
plumbum==1.9.0
-e git+https://github.com/pre-commit/pre-commit-hooks.git@9f107a03276857c668fe3e090752d3d22a4195e5#egg=pre_commit_hooks
pycodestyle==2.13.0
pyflakes==3.3.1
pylint==3.3.6
pytest==8.3.5
PyYAML==6.0.2
simplejson==3.20.1
swebench_matterhorn @ file:///swebench_matterhorn
tomli==2.2.1
tomlkit==0.13.2
typing_extensions==4.13.0

name: pre-commit-hooks
channels:
  - defaults
  - https://repo.anaconda.com/pkgs/main
  - https://repo.anaconda.com/pkgs/r
  - conda-forge
dependencies:
  - _libgcc_mutex=0.1=main
  - _openmp_mutex=5.1=1_gnu
  - ca-certificates=2025.2.25=h06a4308_0
  - ld_impl_linux-64=2.40=h12ee557_0
  - libffi=3.4.4=h6a678d5_1
  - libgcc-ng=11.2.0=h1234567_1
  - libgomp=11.2.0=h1234567_1
  - libstdcxx-ng=11.2.0=h1234567_1
  - ncurses=6.4=h6a678d5_0
  - openssl=3.0.16=h5eee18b_0
  - pip=25.0=py39h06a4308_0
  - python=3.9.21=he870216_1
  - readline=8.2=h5eee18b_0
  - setuptools=75.8.0=py39h06a4308_0
  - sqlite=3.45.3=h5eee18b_0
  - tk=8.6.14=h39e8969_0
  - tzdata=2025a=h04d1e81_0
  - wheel=0.45.1=py39h06a4308_0
  - xz=5.6.4=h5eee18b_1
  - zlib=1.2.13=h5eee18b_1
  - pip:
      - argparse==1.4.0
      - astroid==3.3.9
      - autopep8==2.3.2
      - dill==0.3.9
      - exceptiongroup==1.2.2
      - flake8==7.2.0
      - iniconfig==2.1.0
      - isort==6.0.1
      - mccabe==0.7.0
      - packaging==24.2
      - platformdirs==4.3.7
      - pluggy==1.5.0
      - plumbum==1.9.0
      - pycodestyle==2.13.0
      - pyflakes==3.3.1
      - pylint==3.3.6
      - pytest==8.3.5
      - pyyaml==6.0.2
      - simplejson==3.20.1
      - swebench-matterhorn==0.0.0
      - tomli==2.2.1
      - tomlkit==0.13.2
      - typing-extensions==4.13.0
prefix: /opt/conda/envs/pre-commit-hooks

tests/autopep8_wrapper_test.py::test_respects_config_file
tests/autopep8_wrapper_test.py::test_main_failing[print(1
setup.py pre_commit_hooks/autopep8_wrapper.py
setup.py pre_commit_hooks/autopep8_wrapper.py