<jupyter_start><jupyter_text>You might want to have a cell just for `__future__` imports, but there are no restrictions<jupyter_code>from __future__ import annotations
%nbdev_export
# borrowed from https://realpython.com/python37-new-features/
class Tree:
    def __init__(self, left: Tree, right: Tree) -> None:
        self.left = left
        self.right = right<jupyter_output><empty_output><jupyter_text>These cells just run like normal when testing with `nbdev_test_nbs`<jupyter_code>assert Tree(Tree(None,None),None) is not None<jupyter_output><empty_output><jupyter_text>You can use special comments to export a cell containing `__future__` imports<jupyter_code># export
from __future__ import unicode_literals
from __future__ import generator_stop<jupyter_output><empty_output><jupyter_text>If you see `SyntaxError: from __future__ imports must occur at the beginning of the file`:```python%nbdev_exportfrom __future__ import annotations```you'll need to move the `__future__` import to the top of the cell:```pythonfrom __future__ import annotations%nbdev_export```<jupyter_code>%nbdev_export
%nbdev_add2all annotations
# this is just here to demo nb->lib and lib->nb when using add2all
# uncomment and run this cell after kernel restart to show module works
# from decision_tree.test.from_future import *
# Tree(Tree(None,None),None), annotations
%nbdev_hide
notebook2script()<jupyter_output>Converted 000_target_module.ipynb.
Converted 001_exports_to_target_module.ipynb.
Converted 002_target_module.ipynb.
Converted 00_core.ipynb.
Converted 10_data.ipynb.
Converted 20_models.ipynb.
Converted 30_test_flag.ipynb.
Converted 40_test_export.ipynb.
Converted 50_test_doc.ipynb.
Converted 51_test_show_doc.ipynb.
Converted 60_all_test.ipynb.
Converted 61_test_add2__all__.ipynb.
Converted 70_multi_all_test_flag.ipynb.
Converted 71_tensor_patch.ipynb.
Converted 72_if__name__.ipynb.
Converted 73_in_ipython.ipynb.
Converted 74_from_future_import.ipynb.
Converted 80_test_coverage.ipynb.
Converted index.ipynb.
{'fraction_non_alphanumeric': 0.07589285714285714, 'fraction_numerical': 0.022321428571428572, 'mean_word_length': 7.003968253968254, 'pattern_counts': {'":': 0, '<': 16, '<?xml version=': 0, '>': 19, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '4', 'dir': 'jupyter-structured-clean-dedup', 'id': '587145', 'license': 'Apache-2.0', 'n_tokens_mistral': 733, 'n_tokens_neox': 682, 'n_words': 171, 'path': '74_from_future_import.ipynb', 'repo_name': 'pete88b/decision_tree', 'size': '2016'}