GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - mafda/python_best_practices: How to make your code shine with isort, Black, Flake8, and Pylint. Guidelines and best practice suggestions on how to write Python code.

BranchesTags
Open more actions menu

Latest commit

 

History

10 Commits
10 Commits

Folders and files

NameName
Last commit message
Last commit date
assets
assets
 
 
data
data
 
 
src
src
 
 
.flake8
.flake8
 
 
README.md
README.md
 
 
environment-dev.yml
environment-dev.yml
 
 
environment.yml
environment.yml
 
 
pep8.sh
pep8.sh
 
 

Repository files navigation

Python Best Practices

How can you make your code shine with isort, Black, Flake8 and Pylint?

In this repository, I would like to show some guidelines and best practice tips on how to write Python code.

We can use a simple deck of programs to get our code styling done. We can use isort for sorting the library imports (yes, imports have a suggested order), we can check the existence of undesired artifacts using Flake8 and Pylint, and we can keep the code within the same style using Black.

Those tools can be configured to be PEP8 compliant. PEP8 — Python Enhancement Proposal, is a style guide that provides guidelines and best practices suggestions on how to write Python code.

Python tools

  • Importing sorting with isort
  • Formatting with Black
  • Linting with Flake8
  • Bug and quality checking with Pylint

Project Setup

Clone this repository

(base)$: git clone [email protected]:mafda/python_best_practices.git
(base)$: cd python_best_practices 

Configure environment

  • Create the conda environment
(base)$: conda env create -f environment.yml
  • Activate the environment
(base)$: conda activate linear-regression
  • And run
(linear-regression)$: sh pep8.sh

Use these tools in your project and clean your code!

(base)$: conda env create -f environment-dev.yml
(base)$: conda activate best-practices
(best-practices)$: cd your-project

isort

You could use isort . or isort . --check-only

isort

Black

You could use black --line-length 79 . or black --line-length 79 --check .

black

Flake8

You could use flake8 .

flake8

Fix errors:

flake8

PyLint

You could use find . -type f -name "*.py" | xargs pylint


made with 💙 by mafda

About

How to make your code shine with isort, Black, Flake8, and Pylint. Guidelines and best practice suggestions on how to write Python code.

Topics

best-practicesblackclean-codeflake8formattergood-practicesisortlintingpep8pep8-checkerpylintpythonpython-best-practicespython-clean-codestyleguide

Resources

Readme
Activity

Stars

35 stars

Watchers

2 watching

Forks

2 forks
Report repository

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.