# Ouro
<p align="center">
<img
width="5%"
src="https://raw.githubusercontent.com/abdelrahman0w/ouro/main/assets/ouro-icon.svg"
/>
</p>
[![python](https://img.shields.io/badge/Python-3776AB?logo=python&logoColor=white)](https://python.org/)
[![ouro](https://img.shields.io/badge/OURO-1e1e1e?logo=data%3Aimage%2Fsvg%2Bxml%3Bbase64%2CPHN2ZyB2ZXJzaW9uPSIxLjIiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgdmlld0JveD0iMCAwIDEzNiAyNzciIHdpZHRoPSIxMzYiIGhlaWdodD0iMjc3Ij48ZGVmcz48bGluZWFyR3JhZGllbnQgaWQ9IlAiIGdyYWRpZW50VW5pdHM9InVzZXJTcGFjZU9uVXNlIi8%2BPGxpbmVhckdyYWRpZW50IGlkPSJnMSIgeDI9IjEiIGhyZWY9IiNQIiBncmFkaWVudFRyYW5zZm9ybT0ibWF0cml4KC05MS41OTgsNDEuNjM1LC02OC43MzEsLTE1MS4yMDksNzEuNzYsMTY3LjcxNikiPjxzdG9wIHN0b3AtY29sb3I9IiNmZmQ0M2IiLz48c3RvcCBvZmZzZXQ9IjEiIHN0b3AtY29sb3I9IiNmZmU4NzMiLz48L2xpbmVhckdyYWRpZW50PjxsaW5lYXJHcmFkaWVudCBpZD0iZzIiIHgyPSIxIiBocmVmPSIjUCIgZ3JhZGllbnRUcmFuc2Zvcm09Im1hdHJpeCgtODYuNDcyLDEyMi4zNDQsLTE1MS41MzYsLTEwNy4xMDUsMjY0LjQzNywxNDYuMzUyKSI%2BPHN0b3Agc3RvcC1jb2xvcj0iIzVhOWZkNCIvPjxzdG9wIG9mZnNldD0iMSIgc3RvcC1jb2xvcj0iIzMwNjk5OCIvPjwvbGluZWFyR3JhZGllbnQ%2BPC9kZWZzPjxzdHlsZT4uYXtmaWxsOnVybCgjZzEpfS5ie2ZpbGw6dXJsKCNnMil9PC9zdHlsZT48cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsYXNzPSJhIiBkPSJtMzMuOCAyNzEuM2MtMjAuMy02LjctMzMuOC0xNC0zMy44LTMzLjN2LTE2Ni42aDI5LjZjMTguMyAwIDMzLjkgMTUuMSAzMy45IDMzLjN2NjYuNmMwIDIyLjIgMTkuMyA0MS42IDQyLjIgNDEuNmgyOS43djI1LjFjMCAxOS4zLTE0LjYgMjguNS0zMy44IDMzLjMtMjYuOCA2LjctNDYuOSA2LjktNjcuOCAwem0xMC43LTE2OWMwLTYuOS01LjctMTIuNS0xMi43LTEyLjUtNy4xIDAtMTIuOCA1LjYtMTIuOCAxMi41IDAgNi45IDUuNyAxMi41IDEyLjggMTIuNSA3IDAgMTIuNy01LjYgMTIuNy0xMi41eiIvPjxwYXRoIGZpbGwtcnVsZT0iZXZlbm9kZCIgY2xhc3M9ImIiIGQ9Im0xMDEuNSA1LjFjMjAuMyA2LjcgMzMuOSAxNCAzMy45IDMzLjN2MTY2LjZoLTI5LjdjLTE4LjIgMC0zMy44LTE1LjEtMzMuOC0zMy4zdi02Ni42YzAtMjIuMi0xOS4zLTQxLjYtNDIuMy00MS42aC0yOS42di0yNS4xYzAtMTkuNCAxNC41LTI4LjUgMzMuOC0zMy4zIDI2LjgtNi43IDQ2LjktNi45IDY3LjcgMHptMTQuOCAxNjljMC02LjktNS43LTEyLjUtMTIuNy0xMi41LTcgMC0xMi43IDUuNi0xMi43IDEyLjUgMCA2LjkgNS43IDEyLjUgMTIuNyAxMi41IDcgMCAxMi43LTUuNiAxMi43LTEyLjV6Ii8%2BPC9zdmc%2B)](https://github.com/abdelrahman0w/ouro)
![license](https://img.shields.io/github/license/abdelrahman0w/ouro)
[![tox](https://github.com/abdelrahman0w/ouro/actions/workflows/tox.yml/badge.svg)](https://github.com/abdelrahman0w/ouro/actions/workflows/tox.yml)
[![pre-commit](https://github.com/abdelrahman0w/ouro/actions/workflows/pre-commit.yml/badge.svg)](https://github.com/abdelrahman0w/ouro/actions/workflows/pre-commit.yml)
![pypi-version](https://img.shields.io/pypi/v/ouro)
![pypi-downloads](https://img.shields.io/pypi/dm/ouro)
- [Ouro](#ouro)
- [Description](#description)
- [Name Origin](#name-origin)
- [Demo](#demo)
- [Installation](#installation)
- [Using PIP](#using-pip)
- [Using Poetry](#using-poetry)
- [From Source](#from-source)
- [Usage](#usage)
- [Using the CLI tool](#using-the-cli-tool)
- [Basic Usage](#basic-usage)
- [Entry Point](#entry-point)
- [Available Options](#available-options)
- [As a pre-commit hook](#as-a-pre-commit-hook)
- [Features](#features)
## Description
OURO ([**OURO**boros](https://en.wikipedia.org/wiki/Ouroboros)) is a [Python](https://www.python.org/) package that checks your code for circular (cyclic) imports.
> Currently, ouro only supports [absolute imports](https://docs.python.org/3/reference/import.html#package-relative-imports)
## Name Origin
The name **"ouro"** is derived from the term [**"ouroboros"**](https://en.wikipedia.org/wiki/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
![OURO](https://raw.githubusercontent.com/abdelrahman0w/ouro/main/assets/ouro-demo.gif)
## Installation
You can install ouro in multiple ways, as follows.
### Using PIP
```shell
pip install ouro
```
### Using Poetry
```shell
poetry add ouro
```
### From Source
1. Clone [this repo](https://github.com/abdelrahman0w/ouro)
```shell
git clone https://github.com/abdelrahman0w/ouro
```
> Or you can download it as a zip file
1. Naviage to the repo directory
```shell
cd ouro
```
1. Once you have a copy of the source, you can install it as follows:
- Using `make`
```shell
make install
```
- Using `pip`
```shell
pip install .
```
- Or directly from the `setup.py` file
```shell
python setup.py install
```
## Usage
### Using the CLI tool
#### Basic Usage
1. Navigage to your project
```shell
cd path/to/your/project
```
1. Run `ouro`
```shell
ouro
```
#### Entry Point
```shell
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](https://github.com/pre-commit/pre-commit) for instructions
- Sample usage in `.pre-commit-config.yaml` file:
Add ouro to repos as follows:
```yaml
- repo: https://github.com/abdelrahman0w/ouro
rev: v0.1.3
hooks:
- id: ouro
```
## Features
> Current features are checked
- [X] CLI tool for checking circular imports in a Python code
- [X] Get the context of the import to ignore imports within a function scope
- [X] Ignore `.git` dir in case of git repo
- [X] Ignore paths and patterns in `.gitignore` file
- [X] Ability to ignore a file name, directory name, or a glob pattern
- [X] Show imports in context with file name and line number
- [X] Support for absolute imports
- [ ] Support for relative imports
# Changelog
## 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](https://docs.python.org/3/reference/import.html#package-relative-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
Raw data
{
"_id": null,
"home_page": "https://github.com/abdelrahman0w/ouro",
"name": "ouro",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": "",
"keywords": "python,ouro,circular,dependency,cycle,cyclic,import,imports",
"author": "Abdelrahman Abdelkhalek",
"author_email": "abdelrahman.abdelkhalek@thndr.app",
"download_url": "https://files.pythonhosted.org/packages/ca/b0/55b1eaef6a13b08c2db2c7571139da188daff6ab20b7444561042952c5d5/ouro-0.1.3.tar.gz",
"platform": null,
"description": "# Ouro\n\n<p align=\"center\">\n <img\n width=\"5%\"\n src=\"https://raw.githubusercontent.com/abdelrahman0w/ouro/main/assets/ouro-icon.svg\"\n />\n</p>\n\n[![python](https://img.shields.io/badge/Python-3776AB?logo=python&logoColor=white)](https://python.org/)\n[![ouro](https://img.shields.io/badge/OURO-1e1e1e?logo=data%3Aimage%2Fsvg%2Bxml%3Bbase64%2CPHN2ZyB2ZXJzaW9uPSIxLjIiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgdmlld0JveD0iMCAwIDEzNiAyNzciIHdpZHRoPSIxMzYiIGhlaWdodD0iMjc3Ij48ZGVmcz48bGluZWFyR3JhZGllbnQgaWQ9IlAiIGdyYWRpZW50VW5pdHM9InVzZXJTcGFjZU9uVXNlIi8%2BPGxpbmVhckdyYWRpZW50IGlkPSJnMSIgeDI9IjEiIGhyZWY9IiNQIiBncmFkaWVudFRyYW5zZm9ybT0ibWF0cml4KC05MS41OTgsNDEuNjM1LC02OC43MzEsLTE1MS4yMDksNzEuNzYsMTY3LjcxNikiPjxzdG9wIHN0b3AtY29sb3I9IiNmZmQ0M2IiLz48c3RvcCBvZmZzZXQ9IjEiIHN0b3AtY29sb3I9IiNmZmU4NzMiLz48L2xpbmVhckdyYWRpZW50PjxsaW5lYXJHcmFkaWVudCBpZD0iZzIiIHgyPSIxIiBocmVmPSIjUCIgZ3JhZGllbnRUcmFuc2Zvcm09Im1hdHJpeCgtODYuNDcyLDEyMi4zNDQsLTE1MS41MzYsLTEwNy4xMDUsMjY0LjQzNywxNDYuMzUyKSI%2BPHN0b3Agc3RvcC1jb2xvcj0iIzVhOWZkNCIvPjxzdG9wIG9mZnNldD0iMSIgc3RvcC1jb2xvcj0iIzMwNjk5OCIvPjwvbGluZWFyR3JhZGllbnQ%2BPC9kZWZzPjxzdHlsZT4uYXtmaWxsOnVybCgjZzEpfS5ie2ZpbGw6dXJsKCNnMil9PC9zdHlsZT48cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsYXNzPSJhIiBkPSJtMzMuOCAyNzEuM2MtMjAuMy02LjctMzMuOC0xNC0zMy44LTMzLjN2LTE2Ni42aDI5LjZjMTguMyAwIDMzLjkgMTUuMSAzMy45IDMzLjN2NjYuNmMwIDIyLjIgMTkuMyA0MS42IDQyLjIgNDEuNmgyOS43djI1LjFjMCAxOS4zLTE0LjYgMjguNS0zMy44IDMzLjMtMjYuOCA2LjctNDYuOSA2LjktNjcuOCAwem0xMC43LTE2OWMwLTYuOS01LjctMTIuNS0xMi43LTEyLjUtNy4xIDAtMTIuOCA1LjYtMTIuOCAxMi41IDAgNi45IDUuNyAxMi41IDEyLjggMTIuNSA3IDAgMTIuNy01LjYgMTIuNy0xMi41eiIvPjxwYXRoIGZpbGwtcnVsZT0iZXZlbm9kZCIgY2xhc3M9ImIiIGQ9Im0xMDEuNSA1LjFjMjAuMyA2LjcgMzMuOSAxNCAzMy45IDMzLjN2MTY2LjZoLTI5LjdjLTE4LjIgMC0zMy44LTE1LjEtMzMuOC0zMy4zdi02Ni42YzAtMjIuMi0xOS4zLTQxLjYtNDIuMy00MS42aC0yOS42di0yNS4xYzAtMTkuNCAxNC41LTI4LjUgMzMuOC0zMy4zIDI2LjgtNi43IDQ2LjktNi45IDY3LjcgMHptMTQuOCAxNjljMC02LjktNS43LTEyLjUtMTIuNy0xMi41LTcgMC0xMi43IDUuNi0xMi43IDEyLjUgMCA2LjkgNS43IDEyLjUgMTIuNyAxMi41IDcgMCAxMi43LTUuNiAxMi43LTEyLjV6Ii8%2BPC9zdmc%2B)](https://github.com/abdelrahman0w/ouro)\n![license](https://img.shields.io/github/license/abdelrahman0w/ouro)\n[![tox](https://github.com/abdelrahman0w/ouro/actions/workflows/tox.yml/badge.svg)](https://github.com/abdelrahman0w/ouro/actions/workflows/tox.yml)\n[![pre-commit](https://github.com/abdelrahman0w/ouro/actions/workflows/pre-commit.yml/badge.svg)](https://github.com/abdelrahman0w/ouro/actions/workflows/pre-commit.yml)\n![pypi-version](https://img.shields.io/pypi/v/ouro)\n![pypi-downloads](https://img.shields.io/pypi/dm/ouro)\n\n- [Ouro](#ouro)\n - [Description](#description)\n - [Name Origin](#name-origin)\n - [Demo](#demo)\n - [Installation](#installation)\n - [Using PIP](#using-pip)\n - [Using Poetry](#using-poetry)\n - [From Source](#from-source)\n - [Usage](#usage)\n - [Using the CLI tool](#using-the-cli-tool)\n - [Basic Usage](#basic-usage)\n - [Entry Point](#entry-point)\n - [Available Options](#available-options)\n - [As a pre-commit hook](#as-a-pre-commit-hook)\n - [Features](#features)\n\n## Description\n\nOURO ([**OURO**boros](https://en.wikipedia.org/wiki/Ouroboros)) is a [Python](https://www.python.org/) package that checks your code for circular (cyclic) imports.\n\n> Currently, ouro only supports [absolute imports](https://docs.python.org/3/reference/import.html#package-relative-imports)\n\n## Name Origin\n\nThe name **\"ouro\"** is derived from the term [**\"ouroboros\"**](https://en.wikipedia.org/wiki/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.\n\n## Demo\n\n![OURO](https://raw.githubusercontent.com/abdelrahman0w/ouro/main/assets/ouro-demo.gif)\n\n## Installation\n\nYou can install ouro in multiple ways, as follows.\n\n### Using PIP\n\n```shell\npip install ouro\n```\n\n### Using Poetry\n\n```shell\npoetry add ouro\n```\n\n### From Source\n\n1. Clone [this repo](https://github.com/abdelrahman0w/ouro)\n\n ```shell\n git clone https://github.com/abdelrahman0w/ouro\n ```\n\n > Or you can download it as a zip file\n1. Naviage to the repo directory\n\n ```shell\n cd ouro\n ```\n\n1. Once you have a copy of the source, you can install it as follows:\n\n - Using `make`\n\n ```shell\n make install\n ```\n - Using `pip`\n\n ```shell\n pip install .\n ```\n - Or directly from the `setup.py` file\n\n ```shell\n python setup.py install\n ```\n\n## Usage\n\n### Using the CLI tool\n\n#### Basic Usage\n\n1. Navigage to your project\n\n ```shell\n cd path/to/your/project\n ```\n1. Run `ouro`\n\n ```shell\n ouro\n ```\n\n#### Entry Point\n\n```shell\nouro [-h] [-v] [--verbose] [--no-categorize] [-e] [-i IGNORE [IGNORE ...]] [path]\n```\n\n#### Available Options\n\n```\n<path> path to the Python project to be checked (default: current working directory)\n\n-h, --help show this help message and exit\n-v, --version show version number and exit\n--verbose increase output verbosity (print report to console)\n--no-categorize don't categorize cycles (mark all cycles as critical)\n-e, --export export the report to a json file\n-i. --ignore list of files, directories, or glob patterns to ignore\n```\n\n### As a pre-commit hook\n\n> Check [pre-commit](https://github.com/pre-commit/pre-commit) for instructions\n\n- Sample usage in `.pre-commit-config.yaml` file:\n\n Add ouro to repos as follows:\n\n ```yaml\n - repo: https://github.com/abdelrahman0w/ouro\n rev: v0.1.3\n hooks:\n - id: ouro\n ```\n\n## Features\n\n> Current features are checked\n\n- [X] CLI tool for checking circular imports in a Python code\n- [X] Get the context of the import to ignore imports within a function scope\n- [X] Ignore `.git` dir in case of git repo\n- [X] Ignore paths and patterns in `.gitignore` file\n- [X] Ability to ignore a file name, directory name, or a glob pattern\n- [X] Show imports in context with file name and line number\n- [X] Support for absolute imports\n- [ ] Support for relative imports\n\n\n# Changelog\n\n## 0.1.3 (2024-01-31)\n\n### Fixed\n\n- add missing instsll requirements\n\n## 0.1.2 (2024-01-31)\n\n### Fixed\n\n- bug fixes\n\n## 0.1.1 (2024-01-29)\n\n### Fixed\n\n- pre-commit hook\n- bug in possible origins func\n\n## 0.1.0 (2024-01-27)\n\n### Features\n\n- CLI tool for checking circular imports in a python package\n > Currently, supports [absolute imports](https://docs.python.org/3/reference/import.html#package-relative-imports) only\n- Gets the context of the import to ignore imports within a function scope\n- Ignores `.git` dir in case of git repo\n- Ignores paths in `.gitignore` file\n- Ability to ignore a file name, directory name, or a glob pattern\n",
"bugtrack_url": null,
"license": "MIT license",
"summary": "ouro is a Python package that checks your code for circular (cyclic) imports.",
"version": "0.1.3",
"project_urls": {
"Homepage": "https://github.com/abdelrahman0w/ouro"
},
"split_keywords": [
"python",
"ouro",
"circular",
"dependency",
"cycle",
"cyclic",
"import",
"imports"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "898ba57aa227418ce960921f76b11627af43c8764e07b2006819358567c4f2e7",
"md5": "c0a9e054f9914fe0e7556e20bdb055ad",
"sha256": "62c42e99ff827e0f4921d415cd076982da6989d90d675e550a16fc08e35bd27d"
},
"downloads": -1,
"filename": "ouro-0.1.3-py2.py3-none-any.whl",
"has_sig": false,
"md5_digest": "c0a9e054f9914fe0e7556e20bdb055ad",
"packagetype": "bdist_wheel",
"python_version": "py2.py3",
"requires_python": ">=3.8",
"size": 11521,
"upload_time": "2024-01-31T15:25:05",
"upload_time_iso_8601": "2024-01-31T15:25:05.648686Z",
"url": "https://files.pythonhosted.org/packages/89/8b/a57aa227418ce960921f76b11627af43c8764e07b2006819358567c4f2e7/ouro-0.1.3-py2.py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "cab055b1eaef6a13b08c2db2c7571139da188daff6ab20b7444561042952c5d5",
"md5": "26966cc501c7feed2a877fc5f913eb28",
"sha256": "273da5714143f41da79d0461844842250fbd0703092d866545ee64aacfbe13e2"
},
"downloads": -1,
"filename": "ouro-0.1.3.tar.gz",
"has_sig": false,
"md5_digest": "26966cc501c7feed2a877fc5f913eb28",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 15044,
"upload_time": "2024-01-31T15:25:08",
"upload_time_iso_8601": "2024-01-31T15:25:08.496444Z",
"url": "https://files.pythonhosted.org/packages/ca/b0/55b1eaef6a13b08c2db2c7571139da188daff6ab20b7444561042952c5d5/ouro-0.1.3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-01-31 15:25:08",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "abdelrahman0w",
"github_project": "ouro",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [],
"tox": true,
"lcname": "ouro"
}