Skip to content

Commit 40c1863

Browse files
authored
Release 1.0.0 (#3236)
1 parent bca0a14 commit 40c1863

12 files changed

Lines changed: 193 additions & 227 deletions

File tree

CHANGELOG.md

Lines changed: 65 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,70 @@ Semantic versioning in our case means:
1717
change the client facing API, change code conventions significantly, etc.
1818

1919

20-
## 1.0.0 WIP
20+
## 1.0.0
21+
22+
### Ruff
23+
24+
This release introduces the new main concept: `ruff` compatibility.
25+
26+
Now `WPS` is the only `flake8` plugin that is installed.
27+
Other things are done by `ruff`.
28+
It is faster, it has autofixing, there are lots of rules.
29+
Basically, this way `WPS` just gain lots
30+
of new rule and plugins almost for free.
31+
It is now stricter than ever! `WPS` now officially supports
32+
**ALL** `ruff` existing rules. This means that there are no conflicts
33+
between two linters.
34+
35+
To run `WPS` and `ruff` together, use:
36+
37+
```bash
38+
ruff format && ruff check && flake8 --select=WSP .
39+
```
40+
41+
You can copy our configuration from [`pyproject.toml`](https://github.com/wemake-services/wemake-python-styleguide/blob/bca0a1452335619ee5898e2ab657ca6e4a741f5f/pyproject.toml#L103) (for `ruff`) and [`setup.cfg`](https://github.com/wemake-services/wemake-python-styleguide/blob/bca0a1452335619ee5898e2ab657ca6e4a741f5f/setup.cfg#L7) (for `flake8`).
42+
43+
### Black
44+
45+
`WPS` can now also be used with `black` with **default** configuration.
46+
However, we recommend using `ruff format` instead.
47+
48+
### Speed
49+
50+
`WPS` got a lot faster! Because:
51+
- We removed a lot of `flake8` plugins
52+
- We removed a lot of rules covered by `ruff`
53+
54+
Running `0.19.2` (previous version) on https://github.com/dry-python/returns
55+
56+
```bash
57+
» time flake8 .
58+
flake8 . 20.63s user 2.47s system 469% cpu 4.919 total
59+
```
60+
61+
The same on `1.0.0`:
62+
63+
```
64+
» time flake8 .
65+
flake8 . 8.56s user 0.54s system 898% cpu 1.013 total
66+
```
67+
68+
Which is **2.4x** times faster!
69+
70+
### Integrations
71+
72+
We also significantly improved all the integrations!
73+
`WPS` can now be used as first-class `pre-commit` hook with:
74+
75+
```yaml
76+
repos:
77+
- repo: https://github.com/wemake-services/wemake-python-styleguide
78+
rev: 1.0.0
79+
hooks:
80+
- id: wemake-python-styleguide
81+
```
82+
83+
Our [GitHub Action](https://github.com/marketplace/actions/wemake-python-styleguide) also got a lot of new options and fixes.
2184
2285
### Removals
2386
@@ -98,7 +161,7 @@ Semantic versioning in our case means:
98161
with code that you want to exclude, there's no need
99162
to create one more way of disabling some specific violations
100163

101-
## Features
164+
### Features
102165

103166
- Adds official `python3.13` support
104167
- Allows any compares in `assert` statements for `WPS520`, #3112

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ FROM python:3.12.7-alpine
2020
LABEL maintainer="mail@sobolevn.me"
2121
LABEL vendor="wemake.services"
2222

23-
ENV WPS_VERSION='0.19.2'
23+
ENV WPS_VERSION='1.0.0'
2424
ENV REVIEWDOG_VERSION='v0.20.3'
2525

2626
RUN apk add --no-cache bash git wget

README.md

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,9 @@ Welcome to the strictest and most opinionated Python linter ever.
1919
</p>
2020

2121
`wemake-python-styleguide` is actually a [flake8](http://flake8.pycqa.org/en/latest/)
22-
plugin with [some other plugins](https://wemake-python-styleguide.rtfd.io/en/latest/pages/usage/violations/index.html#external-plugins) as dependencies.
22+
plugin, the only one you will need as your [ruff](https://github.com/astral-sh/ruff) companion.
2323

24+
Fully compatible with **ALL** rules and format conventions from `ruff`.
2425

2526
## Quickstart
2627

@@ -40,7 +41,7 @@ We highly recommend to also use:
4041
## Running
4142

4243
```bash
43-
flake8 your_module.py
44+
flake8 your_module.py --select=WPS
4445
```
4546

4647
This app is still just good old `flake8`!
@@ -57,6 +58,15 @@ in the docs for examples and integrations.
5758
We also support [GitHub Actions](https://wemake-python-styleguide.rtfd.io/en/latest/pages/usage/integrations/github-actions.html) as first class-citizens.
5859
[Try it out](https://github.com/marketplace/actions/wemake-python-styleguide)!
5960

61+
Can (and should!) be used with `ruff`:
62+
63+
```bash
64+
ruff check && ruff format
65+
flake8 . --select=WPS
66+
```
67+
68+
See example `ruff` configuration in our [`pyproject.toml`](https://github.com/wemake-services/wemake-python-styleguide/blob/master/pyproject.toml#L103).
69+
6070

6171
## Strict is the new cool
6272

@@ -96,14 +106,14 @@ You can find all error codes and plugins [in the docs](https://wemake-python-sty
96106
We are *not* planning to do the following things:
97107

98108
0. Assume or check types, use `mypy` together with our linter
99-
1. [Reformat code](https://wemake-python-styleguide.rtfd.io/en/latest/pages/usage/integrations/auto-formatters.html), since we believe that developers should do that
109+
1. Format code or produce stylistic errors, use `ruff format` for that
100110
2. Check for `SyntaxError` or logical bugs, write tests instead
101111
3. Appeal to everyone. But, you can [switch off](https://wemake-python-styleguide.rtfd.io/en/latest/pages/usage/setup.html#ignoring-violations) any rules that you don't like
102112

103113

104114
## Supporting us :tada:
105115

106-
We in [wemake.services](https://wemake.services) make
116+
We in [wemake.services](https://github.com/wemake-services) make
107117
all our tools open-source by default, so the community can benefit from them.
108118
If you use our tools and they make your life easier and brings business value,
109119
you can return us a favor by supporting the work we do.

docs/pages/usage/configuration.rst

Lines changed: 0 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -15,53 +15,6 @@ the configuration to all ``python`` projects.
1515
.. automodule:: wemake_python_styleguide.options.config
1616
:no-members:
1717

18-
.. rubric:: Plugins
19-
20-
It is also important to configure different plugins that we ship with
21-
this module.
22-
23-
All recommended settings can be found in our `styleguide.toml <https://github.com/wemake-services/wemake-python-styleguide/blob/master/styles/styleguide.toml>`_.
24-
25-
You can basically configure them as you wish,
26-
including stylistic (like ``--quotes`` from ``flake8-quotes``)
27-
and important things (like ``--max-complexity`` from ``mccabe``).
28-
Our `flake8.toml <https://github.com/wemake-services/wemake-python-styleguide/blob/master/styles/flake8.toml>`_
29-
file is available with the core settings for ``flake8``.
30-
31-
**flake8-isort**
32-
33-
We use ``flake8-isort`` to check style of imports in our code.
34-
To avoid triggering these checks, you can either use `"wemake" isort profile <https://pycqa.github.io/isort/docs/configuration/profiles.html#wemake>`_
35-
or update your configuration with the following lines:
36-
37-
.. code:: ini
38-
39-
# Inside `setup.cfg`:
40-
41-
[isort]
42-
include_trailing_comma = true
43-
use_parentheses = true
44-
multi_line_output = 3
45-
46-
Our `isort.toml <https://github.com/wemake-services/wemake-python-styleguide/blob/master/styles/isort.toml>`_
47-
file is available with the core settings for ``isort``.
48-
49-
**darglint**
50-
51-
We use ``darglint`` to ensure that docstrings match NumPy documentation style.
52-
To avoid triggering these checks, please ensure that your configuration contains
53-
following settings:
54-
55-
.. code:: ini
56-
57-
# Inside `setup.cfg`
58-
59-
[darglint]
60-
strictness = long
61-
62-
Our `darglint.toml <https://github.com/wemake-services/wemake-python-styleguide/blob/master/styles/darglint.toml>`_
63-
file is available with the core settings for ``isort``.
64-
6518
.. rubric:: Ignoring violations
6619

6720
We know that people might not agree with 100% of our rules.
Lines changed: 11 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -1,78 +1,28 @@
11
Auto-formatters
22
---------------
33

4-
Autoformatters are very simple tools to do just a one thing:
5-
reformat some basic stuff in your code like quotes, commas, and line length.
4+
List of supported tools.
65

7-
The difference between a linter and auto-formatter is huge:
86

9-
- auto-formatters pretties your code a little bit
10-
- linters force you to write beautiful and correct code
7+
ruff
8+
~~~~
119

12-
For example, auto-formatters won't tell you that your code is too complex.
13-
When your linter will (in case it is a good linter).
10+
Fully supported.
11+
You can run ``ruff check && ruff format`` and there
12+
should be no conflicts with ``WPS`` at all.
1413

15-
Autoformatters are also useless
16-
when dealing with rewriting actually bad code.
17-
Like code with bad variable names, unreachable branches,
18-
statements that have no effect.
14+
But, ``wemake-python-styleguide`` can and will find additional
15+
problems that ``ruff`` missed.
1916

20-
We in ``wemake.services`` believe that these kind of tools are not required,
21-
because a good linter will just not let your badly formatted code pass the CI,
22-
so there would be no junk to reformat!
23-
All code is perfectly formatted all the time.
24-
25-
Rely on strict linters, not auto-formatters.
26-
27-
However, if you still want to use some autoformatter
28-
together with ``wemake-python-styleguide``
29-
we have made some research to help you!
3017

3118
isort
3219
~~~~~
3320

34-
``isort`` is a great tool to sort your imports.
35-
We already use it to validate that your imports are correct.
36-
We recommend to use ``isort`` and officially
37-
and support it in a way that all
38-
valid ``wemake-python-styleguide`` code is valid ``isort`` code.
39-
But, **not the other way around**.
40-
41-
You might be required to refactor your code manually after ``isort``
42-
reformat to make ``wemake-python-styleguide`` happy.
43-
44-
``isort`` can also `be invoked <https://github.com/timothycrosley/isort#using-isort>`_
45-
as a command line tool to fix all your import problems for you.
46-
47-
We recommend to run ``isort``. They are also compatible.
21+
We support ``isort``, but we recommend to use ``ruff`` instead.
22+
See https://docs.astral.sh/ruff/rules/#isort-i
4823

49-
There are also plugins for IDEs to run ``isort`` on safe:
50-
51-
- https://github.com/timothycrosley/isort/wiki/isort-Plugins
52-
- https://code.visualstudio.com/docs/python/editing
53-
54-
You can find the configuration we use in ``setup.cfg`` in this repository.
5524

5625
black
5726
~~~~~
5827

59-
``wemake-python-styleguide`` is not compatible with ``black``.
60-
Let's go deeper and see why.
61-
62-
``black`` itself is actually not compatible with ``PEP8`` and ``flake8``
63-
(`docs <https://black.readthedocs.io/en/stable/the_black_code_style.html?highlight=flake8>`_),
64-
that's why it is not compatible with ``wemake-python-styleguide`` either.
65-
Here are the violations that ``black`` produces:
66-
67-
- Quotes: for some reasons ``black`` uses ``"``
68-
that almost no one uses in the ``python`` world
69-
- Trailing commas: ``black`` strips trailing commas and this makes
70-
adding new code harder to review, since your ``git diff`` is polluted
71-
by a comma change, the sad thing that trailing commas as a best-practice
72-
are quite popular in ``python`` code
73-
- Line length. Violating rules by 10%-15% is not ok.
74-
You either violate them or not. ``black`` violates line-length rules.
75-
76-
And there's no configuration to fix it!
77-
Shame, that official ``python-org`` product violates the community standards
78-
and not enforcing them.
28+
Is supported since ``1.0.0``, but we recommend to use ``ruff format`` instead.

docs/pages/usage/integrations/github-actions.rst

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,11 @@ We support three reporting options:
2929
- ``terminal`` (default one) when we just dump the output into Action's logs.
3030
Is the easiest one to setup, that's why we use it by default
3131
- ``github-pr-review`` (recommended) when we use `inline comments <https://github.com/reviewdog/reviewdog#reporter-github-pullrequest-review-comment--reportergithub-pr-review>`_ inside code reviews
32-
- ``github-pr-check`` when we use `Github Checks <https://github.com/reviewdog/reviewdog#reporter-github-checks--reportergithub-pr-check>`_ for the output
32+
- ``github-pr-check`` when we use `GitHub Checks <https://github.com/reviewdog/reviewdog#reporter-github-checks--reportergithub-pr-check>`_ for the output
33+
- ``github-check`` another way to use `GitHub Checks <https://github.com/reviewdog/reviewdog?tab=readme-ov-file#reporter-github-checks--reportergithub-check>`_ for the output
3334

34-
Take a note that ``github-pr-review`` and ``github-pr-check`` requires
35-
``GITHUB_TOKEN`` environment variable to be set.
35+
Take a note that ``github-check``, ``github-pr-review`` and ``github-pr-check``
36+
requires ``GITHUB_TOKEN`` environment variable to be set.
3637

3738
Default reporter looks like so:
3839

@@ -64,6 +65,29 @@ We also support custom ``path`` to be specified:
6465
with:
6566
path: './your/custom/path'
6667
68+
.. rubric:: cwd
69+
70+
We also support custom ``cwd`` to be specified,
71+
it will be used to ``cd`` into before any other actions.
72+
It can be a custom subfolder with your configuration, etc.
73+
74+
.. code:: yaml
75+
76+
- name: wemake-python-styleguide
77+
uses: wemake-services/wemake-python-styleguide
78+
with:
79+
cwd: './your/custom/path'
80+
81+
.. rubric:: fail_workflow
82+
83+
Option which can be set to ``false`` with ``fail_workflow: false`` not
84+
to fail the workflow even if violations were found.
85+
86+
.. rubric:: filter_mode
87+
88+
Can be used to find only new violations and ignore old ones.
89+
See https://github.com/reviewdog/reviewdog?tab=readme-ov-file#filter-mode
90+
6791
Outputs
6892
~~~~~~~
6993

docs/pages/usage/integrations/index.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,5 @@
99
github-actions.rst
1010
ci.rst
1111
stubs.rst
12-
pylint.rst
1312
extras.rst
1413
jupyter_notebooks.rst

docs/pages/usage/integrations/pylint.rst

Lines changed: 0 additions & 44 deletions
This file was deleted.

0 commit comments

Comments
 (0)