Giter VIP home page Giter VIP logo

pysanity's Introduction


````¯¯¯¯\____philosophy____/¯¯¯¯````

__Practicality Beats Purity__ ___Automation Brings Salvation___ ____Abstraction is Chaos, Concealed by Confusion____

 

 

What is this?

This is an ever evolving, battle tested and marginally opinionated python coding guideline that is currently being enforced at my company ShopUp. Primarily, it is an attempt to document some of the implicit lessons and good practices that we have picked up while writing, maintaining and documenting python code in production. You may not agree with all the conventions mentioned here but other than the style guide where everyone has different ideas about how code should be formatted, the conventions mentioned here are almost universally accepted as good practices by the python community. The aim is not to have a strict guideline that is imposed upon every codebase, rather it exists to provide a baseline and reduce unnecessary cognitive overload that arises from disagreements during internal code reviews. The guideline is divided into three major segments.

Styling Guideline: A mashup of simplified pep8, pep257 and a few tools for styling automation

Coding Guideline: Conventions, best practices and design patterns

Documentation Guideline: An attempt to streamline API documentation

 

Read the guideline here.

 

Contribution Instructions

Fork the repo
Go to docs/README.md
Make your edit, push to a new branch & send a pull request

pysanity's People

Contributors

markpbaggett avatar rednafi avatar sobolevn avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pysanity's Issues

Please add an entry for avoiding mutable global variables

Please add an entry for avoiding mutable global variables, because it makes code less modular, harder to test, debug and understand. The reasons are:

  • They hide the dependencies between the functions and classes and it is really hard to see how different parts of code are related to each other. This makes the usage, refactoring and testing hard, because you have no idea in what state the global variables should be in order to run the code successfully. This means you have to understand the whole code base in order to modify a single point of global variable usage. If your code base is changing actively, you are new in the project or is so big that it is hard to remember it completely this means you have to bublesort through all N previous functions and classes that use the global variable in order to write the function 'N+1'. This makes the usage of the global variables literally exponentially worse way to program compared to the usage of technique called dependency injection in large software projects.

  • If you run tests in parallel the tests mess up the global state.

  • If you debug a deep chain of functions, it is not easy to pick all the variables you have to monitor.

  • They tend to waste developer time in the form of merge conflicts.

  • They tend to put more workload to the persons responsible for the variables or manager classes and functions which manipulate these variables because of their central role and might cause mental breakdown if the work load is too high

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.