<a name="readme-top"></a>
[![Contributors][contributors-shield]][contributors-url]<!--[![Forks][forks-shield]][forks-url]-->
[![Stargazers][stars-shield]][stars-url]
[![Issues][issues-shield]][issues-url]<!--[![MIT License][license-shield]][license-url]--><!--[![LinkedIn][linkedin-shield]][linkedin-url]-->
[![PyPi version][pypi-shield]][pypi-url]<!--[![Python 2][python2-shield]][python-url]-->
[![Python 3][python3-shield]][python-url]
<!-- PROJECT LOGO -->
<br />
<div align="center">
<a href="https://github.com/NicolasMICAUX/cachegenius">
<img src="https://raw.githubusercontent.com/NicolasMICAUX/cachegenius/main/images/logo.jpg" alt="Logo" width="160" height="160">
</a>
<h1 align="center">CacheGenius</h3>
<p align="center">
Speed-up your code by automatically identifying functions that should use caching!
<br />
<!--
<a href="https://github.com/NicolasMICAUX/cachegenius"><strong>Explore the docs »</strong></a>
-->
<br />
<br />
<a href="https://github.com/NicolasMICAUX/cachegenius">View Demo</a>
·
<a href="https://github.com/NicolasMICAUX/cachegenius/issues">Report Bug</a>
</div>
<!-- ABOUT THE PROJECT -->
## About The Project
<!-- [Screen Shot][product-screenshot] -->
Have you ever spent hours trying to speed up some code, only to finally realize you're computing the same things 2 or 3 times, which means some caching does the trick ? What a waste of time !
🧞♂️ CacheGenius automatically identifies functions that should use caching in your code, so you can speed-up your code effortlessly!
<!-- GETTING STARTED -->
## Getting Started
Using CacheGenius is very simple.
Install CacheGenius with pip :
```sh
pip install cachegenius
```
To analyse an entire module `mypackage`, with all the functions and methods it contains, add this lines at the begginning of your code:
```python
import mypackage
import cachegenius
cachegenius(mypackage)
```
Now, use your module functions as usual. CacheGenius will automatically analyze all the functions you call, and will tell you if you should use caching or not.
```
>>> cachegenius.report()
Function: mokemodule.mokescript.my_func
Should cache: True
```
## Advanced usage
You can use the different parameters of `cachegenius.report()` to change the temporary files path, and print more infos using `debug`.
Two parameters are available to tune the cost of computing and memory, that are used to decide if caching is worth it or not.
```python
def report(
autocache_path: str = "cachegenius_data/",
debug: bool = True,
cost_per_comput_hr: float = 0.1, # $/hr
cost_per_mem_gb: float = 0.2 # $/gb
)
```
You can clean all temporary files with `cachegenius.empty()`.
<p align="right">(<a href="#readme-top">back to top</a>)</p>
<!-- CONTRIBUTING -->
<!--
## Contributing
_(Section in english)_
### Roadmap/todo
| Task | Importance | Difficulty | Contributor on it | Description |
|:-----|------------|------------|-------------------|:-------------|
| | ./5 | ./5 | NOBODY | _e.g._ : ... |
Non-Code contribution :
| Task | Importance | Difficulty | Contributor on it | Description |
|:-----|------------|------------|-------------------|:-------------|
| | ./5 | ./5 | NOBODY | _e.g._ : ... |
_For every todo, just click on the link to find the discussion where I describe how I would do it._
See the [open issues](https://github.com/NicolasMICAUX/cachegenius/issues) for a full list of proposed features (and known issues).
<p align="right">(<a href="#readme-top">back to top</a>)</p>
-->
### How to contribute
Contributing is an awesome way to learn, inspire, and help others. Any contributions you make are **greatly appreciated**, even if it's just about styling and best practices.
If you have a suggestion that would make this project better, please fork the repo and create a pull request.
Don't forget to give the project a star! Thanks again!
1. Fork the Project
2. Create your Feature Branch (`git checkout -b feature/YourAmazingFeature`)
3. Commit your Changes (`git commit -m 'Add some AmazingFeature'`)
4. Push to the Branch (`git push origin feature/AmazingFeature`)
5. Open a Pull Request
## Authors
This library was created by [Nicolas MICAUX](https://github.com/NicolasMICAUX).
<!-- MARKDOWN LINKS & IMAGES -->
<!-- https://www.markdownguide.org/basic-syntax/#reference-style-links -->
[contributors-shield]: https://img.shields.io/github/contributors/NicolasMICAUX/cachegenius.svg?style=for-the-badge
[contributors-url]: https://github.com/NicolasMICAUX/cachegenius/graphs/contributors
[stars-shield]: https://img.shields.io/github/stars/NicolasMICAUX/cachegenius.svg?style=for-the-badge
[stars-url]: https://github.com/NicolasMICAUX/cachegenius/stargazers
[issues-shield]: https://img.shields.io/github/issues/NicolasMICAUX/cachegenius.svg?style=for-the-badge
[issues-url]: https://github.com/NicolasMICAUX/cachegenius/issues
[pypi-shield]: https://img.shields.io/pypi/v/cachegenius.svg?style=for-the-badge
[pypi-url]: https://pypi.org/project/cachegenius/
[python2-shield]: https://img.shields.io/badge/python-2.7+-blue.svg?style=for-the-badge
[python3-shield]: https://img.shields.io/badge/python-3.5+-blue.svg?style=for-the-badge
[python-url]: https://www.python.org/downloads/
[//]: # ([license-shield]: https://img.shields.io/github/license/NicolasMICAUX/cachegenius.svg?style=for-the-badge)
[//]: # ([license-url]: https://github.com/NicolasMICAUX/cachegenius/blob/master/LICENSE.txt)
[//]: # ([linkedin-shield]: https://img.shields.io/badge/-LinkedIn-black.svg?style=for-the-badge&logo=linkedin&colorB=555)
[//]: # ([linkedin-url]: https://linkedin.com/in/othneildrew)
[product-screenshot]: images/screenshot.png
Raw data
{
"_id": null,
"home_page": "https://github.com/NicolasMICAUX/cachegenius",
"name": "cachegenius",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.5",
"maintainer_email": "",
"keywords": "cache,caching,automatically",
"author": "Nicolas Micaux",
"author_email": "",
"download_url": "https://files.pythonhosted.org/packages/68/df/367cf68cdc0caf1b62515b132d0bf72e45ec11b8baab0a43c1065f740430/cachegenius-0.1.0.tar.gz",
"platform": null,
"description": "<a name=\"readme-top\"></a>\n[![Contributors][contributors-shield]][contributors-url]<!--[![Forks][forks-shield]][forks-url]-->\n[![Stargazers][stars-shield]][stars-url]\n[![Issues][issues-shield]][issues-url]<!--[![MIT License][license-shield]][license-url]--><!--[![LinkedIn][linkedin-shield]][linkedin-url]-->\n[![PyPi version][pypi-shield]][pypi-url]<!--[![Python 2][python2-shield]][python-url]-->\n[![Python 3][python3-shield]][python-url]\n\n\n<!-- PROJECT LOGO -->\n<br />\n<div align=\"center\">\n\n <a href=\"https://github.com/NicolasMICAUX/cachegenius\">\n <img src=\"https://raw.githubusercontent.com/NicolasMICAUX/cachegenius/main/images/logo.jpg\" alt=\"Logo\" width=\"160\" height=\"160\">\n </a>\n\n <h1 align=\"center\">CacheGenius</h3>\n\n <p align=\"center\">\n Speed-up your code by automatically identifying functions that should use caching!\n <br />\n<!--\n <a href=\"https://github.com/NicolasMICAUX/cachegenius\"><strong>Explore the docs \u00bb</strong></a>\n-->\n <br />\n <br />\n <a href=\"https://github.com/NicolasMICAUX/cachegenius\">View Demo</a>\n \u00b7\n <a href=\"https://github.com/NicolasMICAUX/cachegenius/issues\">Report Bug</a>\n</div>\n\n\n<!-- ABOUT THE PROJECT -->\n## About The Project\n\n<!-- [Screen Shot][product-screenshot] -->\nHave you ever spent hours trying to speed up some code, only to finally realize you're computing the same things 2 or 3 times, which means some caching does the trick ? What a waste of time !\n\n\ud83e\uddde\u200d\u2642\ufe0f CacheGenius automatically identifies functions that should use caching in your code, so you can speed-up your code effortlessly!\n\n<!-- GETTING STARTED -->\n## Getting Started\nUsing CacheGenius is very simple.\n\nInstall CacheGenius with pip :\n```sh\npip install cachegenius\n```\n\nTo analyse an entire module `mypackage`, with all the functions and methods it contains, add this lines at the begginning of your code:\n```python\nimport mypackage\nimport cachegenius\n\ncachegenius(mypackage)\n```\n\nNow, use your module functions as usual. CacheGenius will automatically analyze all the functions you call, and will tell you if you should use caching or not.\n```\n>>> cachegenius.report()\nFunction: mokemodule.mokescript.my_func\nShould cache: True\n```\n\n## Advanced usage\nYou can use the different parameters of `cachegenius.report()` to change the temporary files path, and print more infos using `debug`. \nTwo parameters are available to tune the cost of computing and memory, that are used to decide if caching is worth it or not.\n\n```python\ndef report(\n autocache_path: str = \"cachegenius_data/\",\n debug: bool = True,\n cost_per_comput_hr: float = 0.1, # $/hr\n cost_per_mem_gb: float = 0.2 # $/gb\n)\n```\nYou can clean all temporary files with `cachegenius.empty()`.\n\n\n<p align=\"right\">(<a href=\"#readme-top\">back to top</a>)</p>\n\n\n\n<!-- CONTRIBUTING -->\n<!--\n## Contributing\n_(Section in english)_ \n\n### Roadmap/todo\n| Task | Importance | Difficulty | Contributor on it | Description |\n|:-----|------------|------------|-------------------|:-------------|\n| | ./5 | ./5 | NOBODY | _e.g._ : ... |\n\nNon-Code contribution :\n\n| Task | Importance | Difficulty | Contributor on it | Description |\n|:-----|------------|------------|-------------------|:-------------|\n| | ./5 | ./5 | NOBODY | _e.g._ : ... |\n\n\n_For every todo, just click on the link to find the discussion where I describe how I would do it._ \nSee the [open issues](https://github.com/NicolasMICAUX/cachegenius/issues) for a full list of proposed features (and known issues).\n\n<p align=\"right\">(<a href=\"#readme-top\">back to top</a>)</p>\n-->\n\n### How to contribute\nContributing is an awesome way to learn, inspire, and help others. Any contributions you make are **greatly appreciated**, even if it's just about styling and best practices.\n\nIf you have a suggestion that would make this project better, please fork the repo and create a pull request. \nDon't forget to give the project a star! Thanks again!\n\n1. Fork the Project\n2. Create your Feature Branch (`git checkout -b feature/YourAmazingFeature`)\n3. Commit your Changes (`git commit -m 'Add some AmazingFeature'`)\n4. Push to the Branch (`git push origin feature/AmazingFeature`)\n5. Open a Pull Request\n\n\n## Authors\nThis library was created by [Nicolas MICAUX](https://github.com/NicolasMICAUX).\n\n\n<!-- MARKDOWN LINKS & IMAGES -->\n<!-- https://www.markdownguide.org/basic-syntax/#reference-style-links -->\n[contributors-shield]: https://img.shields.io/github/contributors/NicolasMICAUX/cachegenius.svg?style=for-the-badge\n[contributors-url]: https://github.com/NicolasMICAUX/cachegenius/graphs/contributors\n[stars-shield]: https://img.shields.io/github/stars/NicolasMICAUX/cachegenius.svg?style=for-the-badge\n[stars-url]: https://github.com/NicolasMICAUX/cachegenius/stargazers\n[issues-shield]: https://img.shields.io/github/issues/NicolasMICAUX/cachegenius.svg?style=for-the-badge\n[issues-url]: https://github.com/NicolasMICAUX/cachegenius/issues\n[pypi-shield]: https://img.shields.io/pypi/v/cachegenius.svg?style=for-the-badge\n[pypi-url]: https://pypi.org/project/cachegenius/\n[python2-shield]: https://img.shields.io/badge/python-2.7+-blue.svg?style=for-the-badge\n[python3-shield]: https://img.shields.io/badge/python-3.5+-blue.svg?style=for-the-badge\n[python-url]: https://www.python.org/downloads/\n\n[//]: # ([license-shield]: https://img.shields.io/github/license/NicolasMICAUX/cachegenius.svg?style=for-the-badge)\n[//]: # ([license-url]: https://github.com/NicolasMICAUX/cachegenius/blob/master/LICENSE.txt)\n[//]: # ([linkedin-shield]: https://img.shields.io/badge/-LinkedIn-black.svg?style=for-the-badge&logo=linkedin&colorB=555)\n[//]: # ([linkedin-url]: https://linkedin.com/in/othneildrew)\n[product-screenshot]: images/screenshot.png\n\n",
"bugtrack_url": null,
"license": "",
"summary": "Speed-up your code by automatically identifying functions that should use caching in your code!",
"version": "0.1.0",
"project_urls": {
"Homepage": "https://github.com/NicolasMICAUX/cachegenius"
},
"split_keywords": [
"cache",
"caching",
"automatically"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "68df367cf68cdc0caf1b62515b132d0bf72e45ec11b8baab0a43c1065f740430",
"md5": "0a06b9a000f5fda2609e09cf4f653fcf",
"sha256": "77613f0d22f2c70a773984a7c53d8ff3b25f5e4a0577d9fe66ec6ff46aab0ec1"
},
"downloads": -1,
"filename": "cachegenius-0.1.0.tar.gz",
"has_sig": false,
"md5_digest": "0a06b9a000f5fda2609e09cf4f653fcf",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.5",
"size": 6000,
"upload_time": "2023-11-16T23:07:17",
"upload_time_iso_8601": "2023-11-16T23:07:17.466399Z",
"url": "https://files.pythonhosted.org/packages/68/df/367cf68cdc0caf1b62515b132d0bf72e45ec11b8baab0a43c1065f740430/cachegenius-0.1.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-11-16 23:07:17",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "NicolasMICAUX",
"github_project": "cachegenius",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "cachegenius"
}