Name | activated-notebook-importer JSON |
Version |
1.0.0
JSON |
| download |
home_page | None |
Summary | An Activated AI utility for importing Jupyter notebooks as Python modules |
upload_time | 2024-08-12 01:00:52 |
maintainer | None |
docs_url | None |
author | None |
requires_python | >=3.8 |
license | MIT License Copyright (c) 2024 Activated AI Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
keywords |
activated ai
jupyter
notebook
import
module
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# ActivatedNotebookImporter
ActivatedNotebookImporter is a Python package developed and used internally by Activated AI (https://activated-ai.com) that allows you to import Jupyter notebooks as Python modules. This package is designed to seamlessly integrate Jupyter notebooks into your Python workflows.
## Key Features
- Import Jupyter notebooks as Python modules
- Support for parameter substitution, enabling dynamic parameter setting
- Ability to exclude specific cells from execution using tags
- Automatic parameter detection from the first cell and cells tagged with "parameters"
## Use Case
ActivatedNotebookImporter is particularly useful for workflows where you want to use Jupyter notebooks as reusable modules. Instead of converting your Jupyter notebooks to Python scripts, you can use them directly in your workflows:
1. Set parameters using the `params` argument when importing the notebook
2. Exclude specific cells in the notebook by tagging them with 'import-exclude'
3. Import the notebook as a module
4. Call functions from the imported module with your desired parameters
5. Get the results directly, without intermediate steps
This approach allows for more flexible and maintainable code, keeping your exploratory work and reusable code closely aligned.
## Installation
You can install ActivatedNotebookImporter using pip:
```
pip install activated-notebook-importer
```
## Usage
Here's a basic example of how to use ActivatedNotebookImporter:
```python
from activated_notebook_importer import import_notebook
# Import a notebook with parameter substitution
module = import_notebook('path/to/your/notebook.ipynb',
{'param1': 'value1', 'param2': 'value2'})
# Assuming your notebook defines a 'my_function' function
result = module.my_function()
print(result)
```
In your Jupyter notebook:
```python
# In the first cell or in cells tagged with "parameters"
param1 = 'default1'
param2 = 'default2'
# In a code cell
def my_function(param1=param1, param2=param2):
# Your code here
return some_result
# In another cell, tag this with 'import-exclude' in Jupyter
# This cell won't be executed when the notebook is imported
my_function()
```
Note:
- The first cell of the notebook is assumed to contain parameters, which can be overwritten with the `params` argument when importing.
- You can also tag cells with the "parameters" tag for them to be considered as parameter cells.
## Example: Hyperparameter Search
One potential use case is for hyperparameter search in machine learning models:
```python
from activated_notebook_importer import import_notebook
hyperparameters = [
{'learning_rate': 0.01, 'batch_size': 32},
{'learning_rate': 0.001, 'batch_size': 64},
{'learning_rate': 0.0001, 'batch_size': 128}
]
results = []
for params in hyperparameters:
module = import_notebook('model_training.ipynb', params)
results.append(module.train())
# Process and analyze results
```
## Internal Use at Activated AI
ActivatedNotebookImporter is a tool used in various workflows at Activated AI. We use it to:
- Integrate notebook-based code into larger systems
- Easily reuse and parameterize notebook code
- Maintain consistency between our exploratory notebooks and reusable code
By using this tool, we've improved our ability to leverage work done in Jupyter notebooks in our broader Python ecosystem.
## Contributing
We welcome contributions! Please feel free to submit a Pull Request.
## License
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
## About Activated AI
ActivatedNotebookImporter is developed and maintained by Activated AI. Visit our website at https://activated-ai.com to learn more about our AI research and development.
Raw data
{
"_id": null,
"home_page": null,
"name": "activated-notebook-importer",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": null,
"keywords": "activated ai, jupyter, notebook, import, module",
"author": null,
"author_email": "Activated AI <contact@activated-ai.com>",
"download_url": "https://files.pythonhosted.org/packages/e8/fc/c7d835229299db1e8bc82d3c97e9c649ee42b6223d185a51db344756dbd4/activated_notebook_importer-1.0.0.tar.gz",
"platform": null,
"description": "# ActivatedNotebookImporter\n\nActivatedNotebookImporter is a Python package developed and used internally by Activated AI (https://activated-ai.com) that allows you to import Jupyter notebooks as Python modules. This package is designed to seamlessly integrate Jupyter notebooks into your Python workflows.\n\n## Key Features\n\n- Import Jupyter notebooks as Python modules\n- Support for parameter substitution, enabling dynamic parameter setting\n- Ability to exclude specific cells from execution using tags\n- Automatic parameter detection from the first cell and cells tagged with \"parameters\"\n\n## Use Case\n\nActivatedNotebookImporter is particularly useful for workflows where you want to use Jupyter notebooks as reusable modules. Instead of converting your Jupyter notebooks to Python scripts, you can use them directly in your workflows:\n\n1. Set parameters using the `params` argument when importing the notebook\n2. Exclude specific cells in the notebook by tagging them with 'import-exclude'\n3. Import the notebook as a module\n4. Call functions from the imported module with your desired parameters\n5. Get the results directly, without intermediate steps\n\nThis approach allows for more flexible and maintainable code, keeping your exploratory work and reusable code closely aligned.\n\n## Installation\n\nYou can install ActivatedNotebookImporter using pip:\n\n```\npip install activated-notebook-importer\n```\n\n## Usage\n\nHere's a basic example of how to use ActivatedNotebookImporter:\n\n```python\nfrom activated_notebook_importer import import_notebook\n\n# Import a notebook with parameter substitution\nmodule = import_notebook('path/to/your/notebook.ipynb', \n {'param1': 'value1', 'param2': 'value2'})\n\n# Assuming your notebook defines a 'my_function' function\nresult = module.my_function()\nprint(result)\n```\n\nIn your Jupyter notebook:\n\n```python\n# In the first cell or in cells tagged with \"parameters\"\nparam1 = 'default1'\nparam2 = 'default2'\n\n# In a code cell\ndef my_function(param1=param1, param2=param2):\n # Your code here\n return some_result\n\n# In another cell, tag this with 'import-exclude' in Jupyter\n# This cell won't be executed when the notebook is imported\nmy_function()\n```\n\nNote: \n- The first cell of the notebook is assumed to contain parameters, which can be overwritten with the `params` argument when importing.\n- You can also tag cells with the \"parameters\" tag for them to be considered as parameter cells.\n\n## Example: Hyperparameter Search\n\nOne potential use case is for hyperparameter search in machine learning models:\n\n```python\nfrom activated_notebook_importer import import_notebook\n\nhyperparameters = [\n {'learning_rate': 0.01, 'batch_size': 32},\n {'learning_rate': 0.001, 'batch_size': 64},\n {'learning_rate': 0.0001, 'batch_size': 128}\n]\n\nresults = []\nfor params in hyperparameters:\n module = import_notebook('model_training.ipynb', params)\n results.append(module.train())\n\n# Process and analyze results\n```\n\n## Internal Use at Activated AI\n\nActivatedNotebookImporter is a tool used in various workflows at Activated AI. We use it to:\n- Integrate notebook-based code into larger systems\n- Easily reuse and parameterize notebook code\n- Maintain consistency between our exploratory notebooks and reusable code\n\nBy using this tool, we've improved our ability to leverage work done in Jupyter notebooks in our broader Python ecosystem.\n\n## Contributing\n\nWe welcome contributions! Please feel free to submit a Pull Request.\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n\n## About Activated AI\n\nActivatedNotebookImporter is developed and maintained by Activated AI. Visit our website at https://activated-ai.com to learn more about our AI research and development.\n",
"bugtrack_url": null,
"license": "MIT License Copyright (c) 2024 Activated AI Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.",
"summary": "An Activated AI utility for importing Jupyter notebooks as Python modules",
"version": "1.0.0",
"project_urls": {
"Homepage": "https://activated-ai.com"
},
"split_keywords": [
"activated ai",
" jupyter",
" notebook",
" import",
" module"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "790ac94bcb6750d5e3e59315909aba69e53ec3d55514c4459b3fc651bc1142a0",
"md5": "ce4d29823eabc73eac9b21ed4f8c615b",
"sha256": "7b34c26a23ae2cf26f0d010d0f795ff5e81bf967f18cc48c57cbf98adfcb0ed1"
},
"downloads": -1,
"filename": "activated_notebook_importer-1.0.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "ce4d29823eabc73eac9b21ed4f8c615b",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 6255,
"upload_time": "2024-08-12T01:00:51",
"upload_time_iso_8601": "2024-08-12T01:00:51.081424Z",
"url": "https://files.pythonhosted.org/packages/79/0a/c94bcb6750d5e3e59315909aba69e53ec3d55514c4459b3fc651bc1142a0/activated_notebook_importer-1.0.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "e8fcc7d835229299db1e8bc82d3c97e9c649ee42b6223d185a51db344756dbd4",
"md5": "a97230236ed738234d7707ffe4a0be06",
"sha256": "6e46e306a5ad0ae92b1e1d51ef1c9b15522043f4820d79fdbb99af3f98a8d0ff"
},
"downloads": -1,
"filename": "activated_notebook_importer-1.0.0.tar.gz",
"has_sig": false,
"md5_digest": "a97230236ed738234d7707ffe4a0be06",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 5914,
"upload_time": "2024-08-12T01:00:52",
"upload_time_iso_8601": "2024-08-12T01:00:52.449341Z",
"url": "https://files.pythonhosted.org/packages/e8/fc/c7d835229299db1e8bc82d3c97e9c649ee42b6223d185a51db344756dbd4/activated_notebook_importer-1.0.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-08-12 01:00:52",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "activated-notebook-importer"
}