From 654f63ce37b95ee0d4711f5105dbe2b1cab9a2e9 Mon Sep 17 00:00:00 2001 From: Rahul Mahajan Date: Mon, 10 Jul 2023 18:52:59 -0400 Subject: [PATCH] =?UTF-8?q?Remove=20black=20and=20flake8=20deps.=20=20They?= =?UTF-8?q?=20are=20not=20available=20on=20wcoss2.=20keep=E2=80=A6=20(#8)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/pull_request_template.md | 7 +++---- .github/workflows/pynorms.yaml | 24 +++++++++--------------- .pre-commit-config.yaml | 18 ++++++++---------- docs/contributing.rst | 9 ++++----- setup.cfg | 11 +++++------ 5 files changed, 29 insertions(+), 40 deletions(-) diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 4afe44d..b1f05da 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -19,7 +19,7 @@ Before opening a PR, please note these guidelines: **Type of change** -Please delete options that are not relevant. + - [ ] Bug fix (non-breaking change which fixes an issue) - [ ] New feature (non-breaking change which adds functionality) @@ -31,11 +31,10 @@ Please delete options that are not relevant. + - - **Checklist** diff --git a/.github/workflows/pynorms.yaml b/.github/workflows/pynorms.yaml index c05075f..42e4206 100644 --- a/.github/workflows/pynorms.yaml +++ b/.github/workflows/pynorms.yaml @@ -1,22 +1,16 @@ name: pynorms -on: [push, pull_request] +on: [push, pull_request, workflow_dispatch] jobs: check_norms: runs-on: ubuntu-latest - name: Check Python coding norms with pycodestyle + name: Check Python coding norms steps: - - - name: Install dependencies - run: | - pip install --upgrade pip - pip install pycodestyle - - - name: Checkout - uses: actions/checkout@v3 - - - name: Run pycodestyle - run: | - cd $GITHUB_WORKSPACE - pycodestyle --verbose --config ./.pycodestyle ./ + - uses: actions/setup-python@v4 + - name: Install (upgrade) python dependencies (pycodestyle) + run: | + pip install --upgrade pip + pip install pycodestyle + - uses: actions/checkout@v3 + - uses: pre-commit/action@v3.0.0 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 33ecd63..68d1ec8 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -3,14 +3,12 @@ repos: rev: 5.12.0 hooks: - id: isort - name: isort (python) - - repo: https://github.com/psf/black - rev: 23.3.0 + name: isort + - repo: local hooks: - - id: black - language_version: python3 - - repo: https://github.com/pycqa/flake8 - rev: 6.0.0 - hooks: - - id: flake8 - language_version: python3 + - id: pycodestyle + name: pycodestyle + entry: pycodestyle + language: system + types: [python] + args: ['--config=.pycodestyle'] diff --git a/docs/contributing.rst b/docs/contributing.rst index b07422f..4688716 100644 --- a/docs/contributing.rst +++ b/docs/contributing.rst @@ -11,7 +11,7 @@ To help speed up the review process please ensure the following: - The PR addresses an open issue. - All tests are passing locally with ``pytest``. -- The project passes linting with ``black`` and ``flake8``. +- The project passes linting with ``isort`` and ``pycodestyle``. - If adding a new feature you also add documentation. Developing @@ -25,13 +25,13 @@ and then clone it locally. $ git clone https://github.com/yourusername/wxflow $ cd wxflow -This project uses ``isort`` to sort Python import definitions alphabetically, ``black`` to format code and ``flake8`` for linting. We also support ``pre-commit`` to ensure +This project uses ``isort`` to sort Python import definitions alphabetically and ``pycodestyle`` as the Python style checker against conventions in PEP8. We also support ``pre-commit`` to ensure these have been run. To configure your local environment please install these development dependencies and set up the commit hooks. .. code-block:: bash - $ pip install isort black flake8 pre-commit + $ pip install isort pycodestyle pre-commit $ pre-commit install You can check that things are working correctly by calling pre-commit directly. @@ -40,8 +40,7 @@ You can check that things are working correctly by calling pre-commit directly. $ pre-commit run --all-files isort......................................Passed - black......................................Passed - flake8.....................................Passed + pycodestyle................................Passed These checks will be run automatically when you make a commit (if ``pre-commit`` has been installed). diff --git a/setup.cfg b/setup.cfg index 280cb8b..a59b431 100644 --- a/setup.cfg +++ b/setup.cfg @@ -44,7 +44,7 @@ install_requires = PyYAML>=6.0 Jinja2>=3.1.2 tests_require = - pytest, pytest-cov, isort, black, flake8 + pytest, pytest-cov, isort, pycodestyle [options.packages.find] where=src @@ -53,8 +53,8 @@ where=src * = *.txt, *.md [options.extras_require] -dev = pytest>=7; pytest-cov>=3; isort>=5; black>=21; flake8>=4; pre-commit>=2; tox>=3 -docs = sphinx>=4; sphinx-autobuild; sphinx_rtd_theme>=0.5; furo>=2023.03.23; sphinx-copybutton +dev = pytest>=7; pytest-cov>=3; isort>=5; pycodestyle>=2; pre-commit>=2; tox>=3 +docs = sphinx>=4; sphinx-autobuild; sphinx_td_theme>=0.5; furo>=2023.03.23; sphinx-copybutton [green] file-pattern = test_*.py @@ -66,7 +66,6 @@ run-coverage = true [tool:pytest] addopts = --cov=wxflow --cov-report=term-missing --cov-report=xml --cov-report=html -[tool:flake8] -exclude = .git,.github,venv,__pycache__,docs/conf.py,old,build,dist +[tool:pycodestyle] +exclude = .git,.github,venv,.vscode,docs/conf.py max-line-length = 160 -per-file-ignores = __init__.py: F401