From 7e6b38664d4452b1b34f9bfe4c3eb03e64db1b1f Mon Sep 17 00:00:00 2001 From: Ryuichi Yamamoto Date: Wed, 11 Aug 2021 11:17:46 +0900 Subject: [PATCH] enable pysen on CI --- .github/workflows/ci.yaml | 7 ++--- setup.py | 60 ++++++++++++++++++++++++++------------- 2 files changed, 43 insertions(+), 24 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index cbb60b3..f4b97e3 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -29,11 +29,10 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install -e . - - name: Lint with flake8 + pip install -e ".[lint]" + - name: Lint with pysen run: | - pip install flake8 - flake8 + pysen run lint - name: Test with pytest run: | pip install pytest diff --git a/setup.py b/setup.py index b233005..f218905 100644 --- a/setup.py +++ b/setup.py @@ -95,16 +95,18 @@ def test_quoted_arg_change(): file_encoding = "utf8" arg_value = '"ARG"' - spawn([ - sys.executable, - "-c", - child_script, - package_build_dir, - file_name, - output_mode, - file_encoding, - arg_value - ]) + spawn( + [ + sys.executable, + "-c", + child_script, + package_build_dir, + file_name, + output_mode, + file_encoding, + arg_value, + ] + ) # read with open(file_name, mode="r", encoding=file_encoding) as fd: @@ -114,7 +116,7 @@ def test_quoted_arg_change(): def escape_string_macro_arg(s): - return s.replace('\\', '\\\\').replace('"', '\\"') + return s.replace("\\", "\\\\").replace('"', '\\"') def escape_macro_element(x): @@ -177,14 +179,16 @@ def escape_macros(macros): extra_compile_args=[], extra_link_args=[], language="c++", - define_macros=custom_define_macros([ - ("HAVE_CONFIG_H", None), - ("DIC_VERSION", 102), - ("MECAB_DEFAULT_RC", '"dummy"'), - ("PACKAGE", '"open_jtalk"'), - ("VERSION", '"1.10"'), - ("CHARSET_UTF_8", None), - ]), + define_macros=custom_define_macros( + [ + ("HAVE_CONFIG_H", None), + ("DIC_VERSION", 102), + ("MECAB_DEFAULT_RC", '"dummy"'), + ("PACKAGE", '"open_jtalk"'), + ("VERSION", '"1.10"'), + ("CHARSET_UTF_8", None), + ] + ), ) ] @@ -269,7 +273,23 @@ def run(self): ], tests_require=["nose", "coverage"], extras_require={ - "docs": ["sphinx_rtd_theme", "nbsphinx>=0.8.6", "Jinja2>=3.0.1", "pandoc", "ipython", "jupyter"], + "docs": [ + "sphinx_rtd_theme", + "nbsphinx>=0.8.6", + "Jinja2>=3.0.1", + "pandoc", + "ipython", + "jupyter", + ], + "lint": [ + "pysen", + "types-setuptools", + "mypy<=0.910", + "black>=19.19b0,<=20.8", + "flake8>=3.7,<4", + "flake8-bugbear", + "isort>=4.3,<5.2.0", + ], "test": ["pytest", "scipy"], }, classifiers=[