An open API service indexing awesome lists of open source software.

https://github.com/pep8speaks-org/pep8speaks

A GitHub :octocat: app to automatically review Python code style over Pull Requests
https://github.com/pep8speaks-org/pep8speaks

bot code-quality code-style flake8 github-app github-webhooks hacktoberfest linter pep8 pycodestyle python python-style review static-analysis static-code-analysis styleguide

Last synced: about 1 month ago
JSON representation

A GitHub :octocat: app to automatically review Python code style over Pull Requests

Awesome Lists containing this project

README

        

# PEP 8 Speaks

![GitHub release](https://img.shields.io/github/release/OrkoHunter/pep8speaks.svg) ![GitHub contributors](https://img.shields.io/github/contributors/OrkoHunter/pep8speaks.svg)

A GitHub :octocat: app to automatically review Python code style over Pull Requests



# Table of Contents

- [Installation](#installation)
- [Example](#example)
- [Main features](#main-features)
- [Configuration](#configuration)
- [Popular Users](#popular-users)
- [Miscellaneous features](#miscellaneous-features)
- [Private repos](#private-repos)
- [How to fix PEP 8 issues?](#how-to-fix-pep-8-issues)
- [Release announcements](#release-announcements)
- [Contributing](#contributing)
- [Updates](#updates)

# Installation

- Go to the homepage of the app - https://github.com/apps/pep8-speaks
- Click on the Configure button
- Add repositories or organizations to activate PEP 8 Speaks

# Example

# Main features

- The bot makes **a single comment on the Pull Request and keeps updating it** on new commits. No hustle on emails !
- The bot **comments only if Python files are involved**. So, install the integration on all of your repositories. The bot would not comment where it should not.
- By default, the bot does not comment if there are no PEP 8 issues. You can change this in configuration.
- **You can use choose between `pycodestyle` or `flake8` as your linter.** The bot can read configurations for both.
- The bot can read your `setup.cfg` for `[flake8]` and `[pycodestyle]` sections. Check out the `Configuration` section below.

# Configuration

**A config file is not required for the integration to work**. However it can be configured additionally by adding a `.pep8speaks.yml` file in the root of the project. Here is an example :

```yaml
# File : .pep8speaks.yml

scanner:
diff_only: True # If False, the entire file touched by the Pull Request is scanned for errors. If True, only the diff is scanned.
linter: pycodestyle # Other option is flake8

pycodestyle: # Same as scanner.linter value. Other option is flake8
max-line-length: 100 # Default is 79 in PEP 8
ignore: # Errors and warnings to ignore
- W504 # line break after binary operator
- E402 # module level import not at top of file
- E731 # do not assign a lambda expression, use a def
- C406 # Unnecessary list literal - rewrite as a dict literal.
- E741 # ambiguous variable name

no_blank_comment: True # If True, no comment is made on PR without any errors.
descending_issues_order: False # If True, PEP 8 issues in message will be displayed in descending order of line numbers in the file

message: # Customize the comment made by the bot
opened: # Messages when a new PR is submitted
header:
"Hello @{name}! Thanks for opening this PR. "
# The keyword {name} is converted into the author's username
footer:
"Do see the [Hitchhiker's guide to code style](https://goo.gl/hqbW4r)"
# The messages can be written as they would over GitHub
updated: # Messages when new commits are added to the PR
header: "Hello @{name}! Thanks for updating this PR. "
footer: "" # Why to comment the link to the style guide everytime? :)
no_errors: "There are currently no PEP 8 issues detected in this Pull Request. Cheers! :beers: "
```

**Notes:**

- Default settings are in [data/default_pep8speaks.yml](/data/default_pep8speaks.yml). Your `.pep8speaks.yml` will override these values.
- For every Pull Request, the bot looks for `.pep8speaks.yml` in the `base` branch (the existing one). If the file is not found, it then searches the `head` branch (the incoming changes).
- Set the value of `scanner.linter` to either `pycodestyle` or `flake8`
- flake8 is a wrapper around pycodestyle with additional enforcements.
- For linter configurations (like `ignore` or `max-line-length`), PEP8Speaks will look and prioritize configurations in the following order :
- `pycodestyle:` or `flake8:` section of `.pep8speaks.yml`.
- This depends upon the `scanner.linter` value.
- `[pycodestyle]` or `[flake8]` section of `setup.cfg` file in the root of the project.
- This is independent of `scanner.linter`. So, `[flake8]` section of `setup.cfg` will also work for pycodestyle.
- Read more on [pycodestyle](http://pycodestyle.pycqa.org/en/latest/) and [flake8](http://flake8.pycqa.org/en/latest/) documentation.

# Popular Users

| | Organization | Description |
| ----------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------- | ------------------------------------------------------------ |
| | [Pandas](https://github.com/pandas-dev/pandas) | Powerful data manipulation tools for Python |
| | [Adobe](https://github.com/adobe) | Open source from Adobe |
| | [openSUSE](https://github.com/openSUSE) | Linux distribution |
| | [PyTorch Lightning](https://github.com/PyTorchLightning/pytorch-lightning) | The lightweight PyTorch wrapper for ML researchers. |
| | [NetworkX](https://github.com/NetworkX/NetworkX) | Python library for graph theory and complex networks |
| | [Statsmodels](https://github.com/statsmodels/statsmodels) | Statistical modeling and econometrics in Python |
| | [xarray (PyData)](https://github.com/pydata/xarray) | N-D labeled arrays and datasets in Python (Python for Data) |
| | [SunPy](https://github.com/sunpy) | Python for Solar Physics |
| | [Astropy](https://github.com/astropy) | Astronomy in Python |
| | [Scikit Learn Contrib](https://github.com/scikit-learn-contrib) | scikit-learn compatible projects |
| | [Scikit Image](https://github.com/scikit-image) | Image processing in Python |
| | [Spyder IDE](https://github.com/spyder-ide/spyder) | The Scientific Python Development Environment |
| | [Catalyst](https://github.com/catalyst-team/catalyst) | PyTorch framework for Deep Learning research and development |

See the [complete list of organizations and users](https://github.com/OrkoHunter/pep8speaks/wiki/List-of-users-and-orgs).

# Miscellaneous features

- Comment `@pep8speaks suggest diff` in a comment of the PR, and it will comment a gist of diff suggesting fixes for the PR. [Example](https://github.com/OrkoHunter/test-pep8speaks/pull/22#issuecomment-270826241)
- Comment `@pep8speaks pep8ify` on the PR and it will create a Pull Request with changes suggested by [`autopep8`](https://github.com/hhatto/autopep8) against the branch of the author of the PR. `autopep8` fixes most of the errors reported by [`pycodestyle`](https://github.com/PyCQA/pycodestyle).
- Add `[skip pep8]` anywhere in the commit message, PR title or PR description to prohibit pep8speaks from commenting on the Pull Request.

# Private repos

This app will only work for publicly hosted repositories. So if you are looking to deploy a fork or **use the app for private repositories**, [here are the instructions](https://github.com/OrkoHunter/pep8speaks/wiki/Instructions-to-deploy-a-fork).

# How to fix PEP 8 issues?

- Check the errors locally by the command line tool [pycodestyle](https://github.com/PyCQA/pycodestyle) (previously known as `pep8`).
- [autopep8](https://github.com/hhatto/autopep8) is another command line tool to fix the issues.
- Also, see [black](https://github.com/ambv/black)

# Release announcements

Updates to the app are announced using the GitHub Release feature over [here](https://github.com/OrkoHunter/pep8speaks/releases). A lot of major changes are made as the community grows bigger. Click on `Watch` -> `Releases only` on top of the page, to get notified about new configurations or feature updates.

Usually, the master branch is deployed as soon as Pull Requests are merged in the repository. However, on every Friday, I make a release and make sure the latest code is deployed. You do not need to do anything to use the latest version. If you use a fork of PEP 8 Speaks, check out the Release space.

Sponsors

[Become a Gold Sponsor](https://github.com/OrkoHunter/pep8speaks/wiki/Funding#how-to-donate) and get your logo and name with a link to your site on our README and our [website](https://pep8speaks.org).









Samagra Governance










SamagraX




Previous Sponsors

Gold Sponsors

[Become a Gold Sponsor](https://github.com/OrkoHunter/pep8speaks/wiki/Funding#how-to-donate) and get your logo and name with a link to your site on our README and our [website](https://pep8speaks.org).










Python Software Foundation










Weblate




Silver Sponsors

[Become a Silver Sponsor](https://github.com/OrkoHunter/pep8speaks/wiki/Funding#how-to-donate) and get your logo and name with a link to your site on our README and our [website](https://pep8speaks.org).









CCExtractor










Sudhanshu Mishra




# Contributing

You can support the project by contributing to its development. If you have any suggestions for new features or improvements, please [create an issue](https://github.com/OrkoHunter/pep8speaks/issues/new). Pull Requests are most welcome ! Read [CONTRIBUTING](/.github/CONTRIBUTING.md) doc to understand how the project works and how you can make changes.

The project requires to be hosted on a server and due to which, it needs financial support as well.

Please read the [case for funding PEP 8 Speaks](https://github.com/OrkoHunter/pep8speaks/wiki/Funding).

[![Donate](https://img.shields.io/liberapay/receives/OrkoHunter.svg?logo=liberapay)](https://liberapay.com/OrkoHunter)
[![paypal](https://www.paypalobjects.com/en_US/i/btn/btn_donate_LG.gif)](https://www.paypal.me/orkohunter)

If you use this project and you like it, [please let me know](https://saythanks.io/to/OrkoHunter). Thanks!

:heart:

This project does not endorse all of the rules of the original PEP 8 and thus believes in customizing pycodestyle.

[.](https://github.com/OrkoHunter/python-easter-eggs)

# Updates

- April 5, 2020 - [PEP8Speaks - Now helping 5,000 open source projects write neat and clean Python](https://orkohunter.net/blog/pep8speaks-5000-projects/)

# Star History

[![Star History Chart](https://api.star-history.com/svg?repos=pep8speaks-org/pep8speaks&type=Date)](https://star-history.com/#pep8speaks-org/pep8speaks&Date)

# Recent Activity

1. 🗣 Commented on [#553](https://github.com/payu-org/payu/pull/553#issuecomment-2617224952) in [payu-org/payu](https://github.com/payu-org/payu)
2. 🗣 Commented on [#2200](https://github.com/rpm-software-management/dnf/pull/2200#issuecomment-2617011647) in [rpm-software-management/dnf](https://github.com/rpm-software-management/dnf)
3. 🗣 Commented on [#1132](https://github.com/scilus/scilpy/pull/1132#issuecomment-2616654081) in [scilus/scilpy](https://github.com/scilus/scilpy)
4. 🗣 Commented on [#9493](https://github.com/statsmodels/statsmodels/pull/9493#issuecomment-2616645465) in [statsmodels/statsmodels](https://github.com/statsmodels/statsmodels)
5. 🗣 Commented on [#1018](https://github.com/ToFuProject/tofu/pull/1018#issuecomment-2616523281) in [ToFuProject/tofu](https://github.com/ToFuProject/tofu)
6. 🗣 Commented on [#3152](https://github.com/metabrainz/listenbrainz-server/pull/3152#issuecomment-2616347427) in [metabrainz/listenbrainz-server](https://github.com/metabrainz/listenbrainz-server)
7. 🗣 Commented on [#8](https://github.com/This-is-XiaoDeng/nonebot-plugin-maimai-qrhelper/pull/8#issuecomment-2616092074) in [This-is-XiaoDeng/nonebot-plugin-maimai-qrhelper](https://github.com/This-is-XiaoDeng/nonebot-plugin-maimai-qrhelper)
8. 🗣 Commented on [#10](https://github.com/ERPGulf/myinvois/pull/10#issuecomment-2615479217) in [ERPGulf/myinvois](https://github.com/ERPGulf/myinvois)
9. 🗣 Commented on [#1](https://github.com/Code-Institute-Solutions/streamlit-lesson/pull/1#issuecomment-2615385069) in [Code-Institute-Solutions/streamlit-lesson](https://github.com/Code-Institute-Solutions/streamlit-lesson)
10. 🗣 Commented on [#1077](https://github.com/avaframe/AvaFrame/pull/1077#issuecomment-2615376308) in [avaframe/AvaFrame](https://github.com/avaframe/AvaFrame)