Last updated:
0 purchases
ouro 0.2.0
Ouro
Ouro
Description
Name Origin
Demo
Installation
Using PIP
Using Poetry
From Source
Usage
Using the CLI tool
Basic Usage
Entry Point
Available Options
As a pre-commit hook
Features
Description
OURO (OUROboros) is a Python package that checks your code for circular (cyclic) imports.
Currently, ouro only supports absolute imports
Name Origin
The name "ouro" is derived from the term "ouroboros", a symbol from ancient mythology depicting a snake consuming its own tail, representing the concept of infinity and cyclicality. This name was chosen for its apt metaphorical representation of the package's functionality. Just as the ouroboros symbolizes a cycle, the "ouro" package checks for circular imports in Python. The connection to Python, a language named after a type of snake, further reinforces this symbolic link.
Demo
Installation
You can install ouro in multiple ways, as follows.
Using PIP
pip install ouro
Using Poetry
poetry add ouro
From Source
Clone this repo
git clone https://github.com/abdelrahman0w/ouro
Or you can download it as a zip file
Naviage to the repo directory
cd ouro
Once you have a copy of the source, you can install it as follows:
Using make
make install
Using pip
pip install .
Or directly from the setup.py file
python setup.py install
Usage
Using the CLI tool
Basic Usage
Navigage to your project
cd path/to/your/project
Run ouro
ouro
Entry Point
ouro [-h] [-v] [--verbose] [--no-categorize] [-e] [-i IGNORE [IGNORE ...]] [path]
Available Options
<path> path to the Python project to be checked (default: current working directory)
-h, --help show this help message and exit
-v, --version show version number and exit
--verbose increase output verbosity (print report to console)
--no-categorize don't categorize cycles (mark all cycles as critical)
-e, --export export the report to a json file
-i. --ignore list of files, directories, or glob patterns to ignore
As a pre-commit hook
Check pre-commit for instructions
Sample usage in .pre-commit-config.yaml file:
Add ouro to repos as follows:
- repo: https://github.com/abdelrahman0w/ouro
rev: v0.2.0
hooks:
- id: ouro
Features
Current features are checked
CLI tool for checking circular imports in a Python code
Get the context of the import to ignore imports within a function scope
Ignore .git dir in case of git repo
Ignore paths and patterns in .gitignore file
Ability to ignore a file name, directory name, or a glob pattern
Show imports in context with file name and line number
Support for absolute imports
Support for relative imports
Changelog
0.2.0 (2024-02-13)
Features
Enhance performance by around %60
0.1.3 (2024-01-31)
Fixed
add missing instsll requirements
0.1.2 (2024-01-31)
Fixed
bug fixes
0.1.1 (2024-01-29)
Fixed
pre-commit hook
bug in possible origins func
0.1.0 (2024-01-27)
Features
CLI tool for checking circular imports in a python package
Currently, supports absolute imports only
Gets the context of the import to ignore imports within a function scope
Ignores .git dir in case of git repo
Ignores paths in .gitignore file
Ability to ignore a file name, directory name, or a glob pattern
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.