{ "cells": [ { "cell_type": "markdown", "id": "cc15d231", "metadata": {}, "source": [ "\n", "# Fastai Debuggable\n", "\n", "<!-- WARNING: THIS FILE WAS AUTOGENERATED! DO NOT EDIT! -->\n", "\n", "I would love to learn fastai by experimenting its sources and if\n", "possible contribute to them. In this page I would like to present useful\n", "tools I built and tinkerings (including contributions) I made during\n", "exploration.\n", "\n", "You can quickly on each page:\n", "\n", "- search `how-` to find what I learnt along the way,\n", "- search `tinker-` to see how I tinker the sources,\n", "- search `contribute-` to see what contribution I made." ] }, { "cell_type": "code", "execution_count": null, "id": "eb69043f", "metadata": {}, "outputs": [], "source": [ "from fastcore.meta import *\n", "from nbdev.showdoc import *\n", "from fastcore.test import *\n", "from pprint import pprint\n", "from debuggable.utils import *\n", "import inspect" ] }, { "cell_type": "markdown", "id": "c1b38ac3", "metadata": {}, "source": [ "## Useful tools I built\n", "\n", "### debuggable.utils.whatinside" ] }, { "cell_type": "code", "execution_count": null, "id": "a4b52d0b", "metadata": {}, "outputs": [], "source": [ "import fastcore.meta as fm\n", "whatinside(fm, dun=True)" ] }, { "cell_type": "markdown", "id": "3abfd5e5", "metadata": {}, "source": [ " fastcore.meta has: \n", " 13 items in its __all__, and \n", " 43 user defined functions, \n", " 19 classes or class objects, \n", " 2 builtin funcs and methods, and\n", " 74 callables.\n", "\n", " ['test_sig',\n", " 'FixSigMeta',\n", " 'PrePostInitMeta',\n", " 'AutoInit',\n", " 'NewChkMeta',\n", " 'BypassNewMeta',\n", " 'empty2none',\n", " 'anno_dict',\n", " 'use_kwargs_dict',\n", " 'use_kwargs',\n", " 'delegates',\n", " 'method',\n", " 'funcs_kwargs']\n" ] }, { "cell_type": "code", "execution_count": null, "id": "c5fd288f", "metadata": {}, "outputs": [], "source": [ "whatinside(fm, func=True)" ] }, { "cell_type": "markdown", "id": "4b734224", "metadata": {}, "source": [ " fastcore.meta has: \n", " 13 items in its __all__, and \n", " 43 user defined functions, \n", " 19 classes or class objects, \n", " 2 builtin funcs and methods, and\n", " 74 callables.\n", "\n", " The user defined functions are:\n", " ['_funcs_kwargs',\n", " '_mk_param',\n", " '_rm_self',\n", " 'all_equal',\n", " 'anno_dict',\n", " 'any_is_instance',\n", " 'array_equal',\n", " 'contextmanager',\n", " 'copy',\n", " 'delegates',\n", " 'df_equal',\n", " 'empty2none',\n", " 'equals',\n", " 'funcs_kwargs',\n", " 'in_colab',\n", " 'in_ipython',\n", " 'in_jupyter',\n", " 'in_notebook',\n", " 'ipython_shell',\n", " 'is_close',\n", " 'is_coll',\n", " 'is_iter',\n", " 'isinstance_str',\n", " 'method',\n", " 'nequals',\n", " 'noop',\n", " 'noops',\n", " 'remove_prefix',\n", " 'remove_suffix',\n", " 'test',\n", " 'test_close',\n", " 'test_eq',\n", " 'test_eq_type',\n", " 'test_fail',\n", " 'test_fig_exists',\n", " 'test_is',\n", " 'test_ne',\n", " 'test_shuffled',\n", " 'test_sig',\n", " 'test_stdout',\n", " 'test_warns',\n", " 'use_kwargs',\n", " 'use_kwargs_dict']\n" ] }, { "cell_type": "code", "execution_count": null, "id": "10ad86d3", "metadata": {}, "outputs": [], "source": [ "whatinside(fm, clas=True)" ] }, { "cell_type": "markdown", "id": "6e682b03", "metadata": {}, "source": [ " fastcore.meta has: \n", " 13 items in its __all__, and \n", " 43 user defined functions, \n", " 19 classes or class objects, \n", " 2 builtin funcs and methods, and\n", " 74 callables.\n", "\n", " The class objects are:\n", " ['AutoInit',\n", " 'BuiltinFunctionType',\n", " 'BuiltinMethodType',\n", " 'BypassNewMeta',\n", " 'ExceptionExpected',\n", " 'FixSigMeta',\n", " 'FunctionType',\n", " 'MethodDescriptorType',\n", " 'MethodType',\n", " 'MethodWrapperType',\n", " 'NewChkMeta',\n", " 'NoneType',\n", " 'Path',\n", " 'PrePostInitMeta',\n", " 'SimpleNamespace',\n", " 'WrapperDescriptorType',\n", " 'attrgetter',\n", " 'itemgetter',\n", " 'partial']\n" ] }, { "cell_type": "code", "execution_count": null, "id": "4a41dbbf", "metadata": {}, "outputs": [], "source": [ "whatinside(fm, lib=True)" ] }, { "cell_type": "markdown", "id": "91b2f85e", "metadata": {}, "source": [ " fastcore.meta has: \n", " 13 items in its __all__, and \n", " 43 user defined functions, \n", " 19 classes or class objects, \n", " 2 builtin funcs and methods, and\n", " 74 callables.\n", "\n", " The library has 21 modules\n", " ['_modidx',\n", " '_nbdev',\n", " 'all',\n", " 'basics',\n", " 'dispatch',\n", " 'docments',\n", " 'docscrape',\n", " 'foundation',\n", " 'imports',\n", " 'meta',\n", " 'nb_imports',\n", " 'net',\n", " 'parallel',\n", " 'script',\n", " 'shutil',\n", " 'style',\n", " 'test',\n", " 'transform',\n", " 'utils',\n", " 'xdg',\n", " 'xtras']\n" ] }, { "cell_type": "code", "execution_count": null, "id": "9af312f6", "metadata": {}, "outputs": [], "source": [ "import fastcore.imports as fi\n", "whatinside(fi, dun=True)" ] }, { "cell_type": "markdown", "id": "e028b6a2", "metadata": {}, "source": [ " fastcore.imports has: \n", " 0 items in its __all__, and \n", " 17 user defined functions, \n", " 13 classes or class objects, \n", " 2 builtin funcs and methods, and\n", " 42 callables." ] }, { "cell_type": "code", "execution_count": null, "id": "4e6fe8c4", "metadata": {}, "outputs": [], "source": [ "whatinside(fi, func=True)" ] }, { "cell_type": "markdown", "id": "094c8e28", "metadata": {}, "source": [ " fastcore.imports has: \n", " 0 items in its __all__, and \n", " 17 user defined functions, \n", " 13 classes or class objects, \n", " 2 builtin funcs and methods, and\n", " 42 callables.\n", "\n", " The user defined functions are:\n", " ['all_equal',\n", " 'any_is_instance',\n", " 'array_equal',\n", " 'df_equal',\n", " 'equals',\n", " 'in_colab',\n", " 'in_ipython',\n", " 'in_jupyter',\n", " 'in_notebook',\n", " 'ipython_shell',\n", " 'is_coll',\n", " 'is_iter',\n", " 'isinstance_str',\n", " 'noop',\n", " 'noops',\n", " 'remove_prefix',\n", " 'remove_suffix']\n" ] }, { "cell_type": "code", "execution_count": null, "id": "850133c8", "metadata": {}, "outputs": [], "source": [ "whatinside(fi, clas=True)" ] }, { "cell_type": "markdown", "id": "0126337d", "metadata": {}, "source": [ " fastcore.imports has: \n", " 0 items in its __all__, and \n", " 17 user defined functions, \n", " 13 classes or class objects, \n", " 2 builtin funcs and methods, and\n", " 42 callables.\n", "\n", " The class objects are:\n", " ['BuiltinFunctionType',\n", " 'BuiltinMethodType',\n", " 'FunctionType',\n", " 'MethodDescriptorType',\n", " 'MethodType',\n", " 'MethodWrapperType',\n", " 'NoneType',\n", " 'Path',\n", " 'SimpleNamespace',\n", " 'WrapperDescriptorType',\n", " 'attrgetter',\n", " 'itemgetter',\n", " 'partial']\n", "\n", "### debuggable.utils.whichversion" ] }, { "cell_type": "code", "execution_count": null, "id": "f5c11795", "metadata": {}, "outputs": [], "source": [ "whichversion('nbdev')" ] }, { "cell_type": "markdown", "id": "49a3bb42", "metadata": {}, "source": [ " nbdev: 2.1.7 \n", " Create delightful software with Jupyter Notebooks \n", " Jeremy Howard and Hamel Husain \n", " https://github.com/fastai/nbdev \n", " python_version: >=3.7 \n", " /Users/Natsume/mambaforge/lib/python3.9/site-packages/nbdev" ] }, { "cell_type": "code", "execution_count": null, "id": "da1eece5", "metadata": {}, "outputs": [], "source": [ "whichversion('fastcore')" ] }, { "cell_type": "markdown", "id": "89cb0987", "metadata": {}, "source": [ " fastcore: 1.5.18 \n", " Python supercharged for fastai development \n", " Jeremy Howard and Sylvain Gugger \n", " https://github.com/fastai/fastcore/ \n", " python_version: >=3.7 \n", " /Users/Natsume/Documents/fastcore/fastcore" ] }, { "cell_type": "code", "execution_count": null, "id": "1e92a5c2", "metadata": {}, "outputs": [], "source": [ "whichversion('debuggable', req=True)" ] }, { "cell_type": "markdown", "id": "0e533e1b", "metadata": {}, "source": [ " debuggable: 0.0.12 \n", " make fastai library debuggable on every major line \n", " EmbraceLife \n", " https://github.com/EmbraceLife/debuggable/ \n", " python_version: >=3.7 \n", " /Users/Natsume/Documents/debuggable/debuggable\n", "\n", " debuggable requires: \n", " ['fastcore', 'fastai', 'numpy']\n", "\n", "### debuggable.utils.dbprint\n", "\n", "please go to my\n", "[docs](https://embracelife.github.io/debuggable/fastcore/meta/00_delegates.html)\n", "for fastcore.meta.delegates for demos of this function.\n", "\n", "## My contributions to fastcore\n", "\n", "### My first [contrib to fastcore](https://github.com/fastai/fastcore/commit/0a94e22a0d6c02b51240ed6d8f1d7c94e6ae9b40) is based on the solution above with Jeremy’s modification\n", "\n", "## Interesting findings of fastcore" ] } ], "metadata": { "jupytext": { "cell_metadata_filter": "-all", "main_language": "python", "notebook_metadata_filter": "-all" }, "kernelspec": { "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" } }, "nbformat": 4, "nbformat_minor": 5 }