ouro is a Python package that checks your code for circular (cyclic) imports.
Project description
Ouro
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
filepython 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
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
File details
Details for the file ouro-0.2.0.tar.gz
.
File metadata
- Download URL: ouro-0.2.0.tar.gz
- Upload date:
- Size: 15.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 766b969d1f32921d44f821def431a846364d41adfddcd86b681463d9341facd5 |
|
MD5 | e1936a0a43fc451694a1a3bb858b3a44 |
|
BLAKE2b-256 | d7084ed304c6f4348c1bf7552e291aceef9dd858ccb55d879f987dfe0e893bb1 |
File details
Details for the file ouro-0.2.0-py2.py3-none-any.whl
.
File metadata
- Download URL: ouro-0.2.0-py2.py3-none-any.whl
- Upload date:
- Size: 11.5 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | fe17eb8432ee5f3f9d775beb8729d87db0dcff72fc8549f9cd42dccd2e45bae8 |
|
MD5 | 1da614d75aa3b4b73f1e30e4bbbac580 |
|
BLAKE2b-256 | 3f6d6cd6927c2684d6b8c194b928f91e12b3642db670db09669fae892283890a |