Artificial Intelligence Practicals for Jupyter Notebooks & Python — 11 Core AI Algorithms with Interactive Visualizations
ARP (Artificial Intelligence Practicals) is a modern, modular, educational Python library designed for computer science students, educators, and AI practitioners. It packages canonical Artificial Intelligence algorithms into clean, reusable Python functions with interactive Jupyter Notebook displays, automated execution engines, and a unified command-line interface.
pip install arp-ai With Optional Dependencies To enable optional NLP (nltk) and Jupyter Notebook dependencies:
# For Natural Language Processing enhancements pip install "arp-ai[nlp]" # For Jupyter Notebook environment pip install "arp-ai[jupyter]" # Install all optional extras pip install "arp-ai[all]" From Local Source (Editable Mode) git clone https://github.com/arp-ai/arp.git cd ARP pip install -e . 3. Quick Start Inside a Python shell or Jupyter Notebook:
import arp # 1. Browse all available AI practicals arp.list() # 2. Search for algorithms arp.search("search") # 3. View algorithm specifications and complexity arp.info("AS") # 4. Run an algorithm demo result = arp.run("AS") # 5. Access the user guide arp.help() 4. Complete Practical Inventory All 11 original practical programs are indexed in the central registry:
Displays a formatted catalog of all 11 practical programs with IDs, categories, and complexities.
arp.list() arp.search(query: str) Searches programs by ID, title, problem category, or keywords.
arp.search("search") arp.search("minimax") arp.info(identifier: str) Returns a ProgramMetadata object containing detailed specifications, complexity characteristics, inputs, and outputs.
arp.info("AS") arp.get(identifier: str, source: bool = True, original: bool = True, refactored: bool = False, insert: Optional[bool] = None) Retrieves the complete, unaltered Python source code of the practical program and automatically inserts it into a new Jupyter Notebook cell immediately below the current cell (matching the proven MLP.get("DT-A") user experience):
import arp # Automatically inserts original A* Search code into the next cell below ready to edit and execute arp.get("AS") Exact Original Source by Default: Returns the exact curriculum student practical source code by default (original=True), preserving 100% of the original variables, data structures, comments, print statements, and execution flow. Interactive Cell Insertion: In Jupyter Notebook, JupyterLab, and VS Code, arp.get() calls set_next_input(replace=False) to insert the code into a new cell directly beneath the active cell. Safe & Non-Destructive: The inserted code is never executed automatically. Students can inspect, modify variables, and run it independently. Formatting Preserved: Python indentation, docstrings, comments, and structure are 100% preserved. Refactored Modular Implementation: To view or insert the refactored modular implementation instead of the original script, pass refactored=True: arp.get("AS", refactored=True) All 11 Practicals Supported: Works with any registered ID (AB, AOS, AS, BFS, CA, CH, HC, MIMA, NL, NQ, WJ) or filename (AS.py). Sensible Non-Jupyter Fallback: When called outside Jupyter (in scripts or standard terminals), it prints an informative notice and returns the source code string (SourceCode). Inspect Without Inserting: If you want to retrieve the source code object inside Jupyter without inserting a new cell, pass insert=False: code = arp.get("AS", insert=False) Graceful Error Handling: Invalid program IDs print a friendly error message listing all valid practical IDs and return None without crashing. arp.insert(identifier: str, raise_error: bool = False, original: bool = True, refactored: bool = False) Convenience wrapper for cell insertion:
arp.insert("AS") arp.run(identifier: str, *args, **kwargs) Executes the specified algorithm. Accepts custom inputs and returns structured result objects.
# Default educational demo res_as = arp.run("AS") # Custom inputs res_nq = arp.run("NQ", n=6) res_wj = arp.run("WJ", jug1=5, jug2=3, target=4) arp.help() Displays the interactive package usage guide.
arp.help() 7. Jupyter Notebook Integration The package is optimized for interactive learning in Jupyter.
jupyter notebook examples/ARP_Demo.ipynb The notebook demonstrates:
The package provides an arp terminal command:
# List all practicals arp list # Search for practicals arp search "heuristic" # Show program information arp show AS # View Python source code arp get AS # Display code or guidance for cell insertion arp insert AS # Run program demonstration arp run WJ # Run N-Queens with 4 queens arp run NQ # Show usage help arp help 9. Dependencies Core Requirements: Python 3.9+ (Zero required third-party dependencies; uses the Python standard library exclusively). Optional Dependencies: nltk: Advanced lemmatization and corpus support (pure-Python fallback included). jupyter, ipython, nbformat: Interactive notebook execution and rich displays. pytest, pytest-cov, nbclient: Development, coverage, and testing tools. 10. Troubleshooting Issue: "ModuleNotFoundError: No module named 'nltk'" Solution: The NLP module includes a built-in pure-Python fallback that operates without NLTK. If you wish to use NLTK, install it via:
pip install "arp-ai[nlp]" Issue: "NLTK data download error or offline environment" Solution: arp never forces automatic network downloads on import. If NLTK corpora are missing, it seamlessly uses the pure-Python tokenizer, stopword dictionary, and stemmer.
Solution: When run outside Jupyter (e.g., standard Python shell or terminal), arp automatically falls back to clean Unicode/ASCII table formatting.
Contributions and algorithm extensions are welcome!
This project is licensed under the MIT License — see the LICENSE file for details.
artificial-intelligence ai algorithms jupyter notebook search heuristic a-star alpha-beta minimax n-queens nlp education
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
None of the files in this release were uploaded with provenance metadata.
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.




