Package: ipython-args
Python Argument Parser for Notebooks and ScriptsIntroductionThis Python module provides a versatile argument parsing solution that works seamlessly both in Jupyter notebooks (or similar environments) and standard Python scripts. It allows the same code to accept arguments in two different contexts, making it easier to write code that is flexible and easy to test.The document is helped by ChatGPT 4.0FeaturesDual Compatibility: Works with Jupyter notebooks and standard Python scripts.Easy Integration: Simple to integrate into existing Python projects.Dynamic Argument Parsing: Automatically switches betweeneasydictandargparsedepending on the execution environment.RequirementseasydictargparseInstallationEnsure that you haveeasydictinstalled. You can install it using pip:pip install easydictUsageDefining ArgumentsFirst, define your arguments in a dictionary format. For example:args_dict = {
    "arg1": value1,
    "arg2": value2,
    // Add more arguments as needed
}Parsing ArgumentsThen, simply call theipython_argsfunction with your arguments dictionary:args = ipython_args(args_dict)In a Jupyter notebook environment,argswill be anEasyDictobject, allowing you to access arguments using dot notation (args.arg1). In a standard script,argswill be the usualargparse.Namespaceobject.Checking EnvironmentTheis_notebookfunction can be used independently to check if the code is running in a Jupyter notebook environment.ExampleHere's a simple example demonstrating how to use this module:from ipython_args import ipython_args

# Define your arguments here
args_dict = {
    "epoch": 10,
    "learning_rate": 0.001
}

# Parse arguments
args = ipython_args(args_dict)

# Accessing arguments
print(args.epoch)
print(args.learning_rate)You can use is_notebook function to check the environment is notebook or notfrom ipython_args import is_notebook

# Check whether the current environment is notebook shell or not
current_env_notebook = is_notebook())Contributing & AcknowledgementsThanks for professor Dr. Lee, Soo-Hong who encourage me to upload the project.This projects are side-project of the National Research Foundation of Korea, ‘Development of a 2-axis ankle exoskeleton robot to identify intentions using deep learning-based EMG images’ (No.2021R1I1A205215811)LicenseThis project is open-source and available under theMIT License.Copyright (c) 2018 The Python Packaging AuthorityPermission 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.