Pyeo is an advanced static analysis tool tailored specifically to enforce the principles advocated by Elegant Objects (elegantobjects.org) in Python projects. It serves as a quality control instrument to ensure that your Python code adheres to the core tenets of elegance, simplicity, and maintainability.
Project description
pyeo
Pyeo is an advanced static analysis tool tailored specifically to enforce the principles advocated by Elegant Objects (elegantobjects.org) in Python projects. It serves as a quality control instrument to ensure that your Python code adheres to the core tenets of elegance, simplicity, and maintainability.
pip install eo-styleguide
Simple example of usage:
from typing import Protocol, final
import attrs
from pyeo import elegant
class House(Protocol):
def area(self) -> int: ...
@elegant
@final
@attrs.define(frozen=True)
class HttpHouse(House):
def area(self) -> int:
return 10
-
No null(why?)
Mypy helps prevent AttributeError and other type-related errors by providing static type checking for Python code. It allows specifying variable types, function arguments, and return types to catch potential type issues before the program runs. By using Mypy, developers can identify and fix problems related to attribute access and other type mismatches, leading to improved code quality and easier maintenance.
attrs.define(frozen=True)
is a parameter used in the attrs library to create classes with attributes that cannot be modified after the instance is created (i.e., immutable or "frozen" classes).
The attrs library allows defining classes using the @attr.s
decorator or by explicitly calling the attr.define
function, and frozen=True
is one of the parameters for specifying attribute behavior in the class.
When you use attrs.define(frozen=True)
for a class, all its attributes become read-only after the instance is created, making the class "frozen" or "immutable," preventing any changes to its attribute values.
-
No readers, parsers, controllers, sorters, and so on (why?)
-
No static methods, not even private ones (why?)
-
No instanceof, type casting, or reflection (why?)
-
No public methods without a contract (interface) (why?)
-
No statements in test methods except assert (why?)
Detect using ORM or ActiveRecord tools on project by design/code review
Each @elegant
object must be typing.final
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for eo_styleguide-0.0.1a4-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9cbcd094174caba22e280d29c6c4c08259c4973450f0595af52cf5fbcc2cdc0c |
|
MD5 | 305390ea3f3f0bba2cf88a3314e6b686 |
|
BLAKE2b-256 | 5ff52cd1409971dc41c5745873921053ab920a18171e4722f2b57520fb1ddd5f |