I: Design by contract: Guaranteeing and assuming type hint conformity
Functions
- Arguments: All function arguments must be type hinted.
- Passing the correct type in arguments is caller responsibility:
- Guarantee in call and assume in definition: Passsed argument conform to type hint
- Returns: All functions return an object that conforms to its type hint or raise an error. Note that returning and raising are mutually exclusive.
- Returning the correct type , assuming type conformity of the passed arguments, is callee responsbility:
- Guarantee function definition and assume in function call: Returned object conforms to type hint or raises Exception
- Functions without a type hint are implicitly assumed to return None
Classes
- Attributes: All class attributes must be type hinted and conform to their type hints - The init method must guarantee the integrity of the type hint, assuming argument type conformity - All methods manipulating attributes must guarantee type conformity - All methods retrieving attributes assume the integrity of the type hints
- Inheritance: Inherited attributes and methods implicitly inherit their type hints
II: Naming
- Stick to pythonic case and spacing conventions (see also: python-naming-convention:
- source files: lowercase w/ snake_case,
- functions: lowercase w/ snake_case; use verbs
- classes: everything else: CamelCase; use nouns
- Function naming templates:
- Functions that retrieve something that already exists
get_[object]or - Functions that create and then return an object
create_[object]ormake_[object]
- Functions that retrieve something that already exists
- Names are searchable and distinguishable:
- No shadowing of outer scope
- Word trees are distinguished by prefix not suffix (e.g. plot_reference_fourier, plot_original_fourier instead of plot_fourier_reference, plot_fourier_original)
- Loop variables contract the list variable (e.g. instead of for number in numbers -> for n in numbers)
- Hungarian notations only used when the object appears as several types throughout the program
III: Vertical arrangement
- Downward dependency rule: Arrange modules so that dependency points downward. This is also referred to as the stepdown rule.
- For functions: Top level function first, then functions called by that function below. If lower level functions call each other, sort recursively, else sort by order of call in top level
- For modules/files: Consider l0, l1, etc. structure to establish downward dependency of modules within directories
IV: Size rules
- Minimal nesting: Max indentation level === 3
- Small directories: Each dir ideally contains only 2-4 files/folders; max 5 files/folders
- Short files: Max ~200 loc, Ideally < 120 loc
- Short functions: Max ~30 loc, ideally <= 15 loc; Ideally <= 2 args, max ~ 5 args
- Commit messges: ~ 5 words
- kwargs only: Pass function arguments only by keyword
V: Imports
- Ordering: First import stdlib/pypi packages, then own code arranged by how far away nearest common ancestor
- Package inteerfaces: Define interface of a package through init file
Metadata
Release files for cryptoalgos 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| cryptoalgos-0.1.0.tar.gz | 4.6 kB | Without provenance | Details for cryptoalgos-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| cryptoalgos-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for cryptoalgos-0.1.0-py3-none-any.whl |
Total release size: 10.8 kB
Release files / cryptoalgos-0.1.0.tar.gz
| Download URL | cryptoalgos-0.1.0.tar.gz |
|---|---|
| Size | 4.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1a0a5ffde60c095e6e24eafd7c157f45c437018991f0cf07b0f6e4f062ed848e
|
|
BLAKE2b-256 checksum How to use checksums |
c01025831613dbb1d98b98bb6c7306204e9077dc6928cbdcb12926ca05284211
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.0.0 CPython/3.10.12
|
Release files / cryptoalgos-0.1.0-py3-none-any.whl
| Download URL | cryptoalgos-0.1.0-py3-none-any.whl |
|---|---|
| Size | 6.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ada297e062a075970f104cf8f0723128a65e19c20f06e5f32e10288d75eeb0db
|
|
BLAKE2b-256 checksum How to use checksums |
4130e8ff4bf5b3e96ed671bd7344d6872302cda1641b885a3b3f22441e7e8813
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.0.0 CPython/3.10.12
|
Security for cryptoalgos 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.