How to include iPython notebook - ipython

I would like to import functions from one iPython's notebook into another iPython's notebook. Is it possible? If so how to achieve it?

Try this: import iPython functions.
Helped me as well.

Related

How to resolve Pylance "import could not be resolved" in VSCode Jupyter Notebook?

I am trying to import function query_creative inside of file query_creative.py into the notebook Notebook.ipynb. The file hierarchy is like this:
├───playground
│ Notebook.ipynb
├───src
├───queries
query_creative.py
The code I use in my notebook goes like this:
import sys
sys.path.append('..')
from src.query.query_creative import query_creative
and the thing works. However, the line with the function import is underlined by Pylance with the message: "Import could not be resolved" and when I use this function later on, it works but Pylance underlines it again. I've tried modifying the setting.json, but nothing seems to work. I thank in advance for any help!
I managed to solve it eventually by downgrading Jupyter extension to VS Code to v2022.4.1001071005. Thanks everyone for help!
Which version of vs code you have? I faced with same issue after updating to 1.70.
UPD.
Downgrading to 1.69.2 fixed that issue. However, I have another laptop with 1.70 with exact same notebook there is no such issue, so if you want to stick around 1.70 it is worth to try to completely remove vscode and install it again.
UPD2.
After a while my downgrade didn't help on another machine, so I compared Pylance output difference between them and find out, that "working" instance used legacy jupyter notebook support, while "buggy" with "LSP". After disabling option Pylance Lsp Notebooks Enabled everything worked as usual and fixed that problem
It seems that pylance is unable to determine that the code is importable. Instead of modifying your path at the beginning of the script, you could create a Python package with your code, then do:
cd your-project
pip install -e .
You can see a guide to create packages here.
With these settings, pylance and any other editor/IDE will be able to identify your project correctly.
Beware that in VSCode, you can switch the interpreter, so ensure you select one where your code is installed:
https://blog.csdn.net/qq_41019681/article/details/111193080
"python.analysis.extraPaths": [
"D:\\ProgramFiles\\Anaconda3-2021.05\\lib\\site-packages"
]
add "python.analysis.extraPaths" by
import package_name as pkg
print(pkg.__file__)

Jupyter Notebook in VS Code : inline input()?

I'm a student using VS Code to work on Jupyter Notebooks. I'm looking for a way to get the dialog pop up of an input("...") to appear inline instead (under the cell with all my prints, like it's done when using jupyter notebook in a browser).
Thanks,
Julien
Found my answer here : Show question/input in vscode jupyter notebook output
Spoiler : not possible, in VS Code you cannot show inputs under a cell of a jupyter notebook as it for output only.

How can I run Jupyter Notebooks in VS Code with Julia as Interpreter? Within Added Variable Explorer/ Inspector?

I want to know how I could run Jupyter Notebook in VS Code with Julia as Interpreter?
I wanted to use a variable inspector/ explorer from this package but I cant get it to work.
Is there an even simple way to implement them? Like with Python?
In Short like here?
https://code.visualstudio.com/docs/python/jupyter-support
As of November 11th, 2020, the Jupyter Notebook extension in VSCode now supports Julia out of the box. Find out more here.

How can I use scala with jupyter notebook?

I want to use scala with jupyter notebook, the same way we use IJulia.
One solution that I found was by cloning https://github.com/alexarchambault/jupyter-scala
Is there any other way out ?
The Jupyter documentation links to IPython kernels for other languages
It appears to be a comprehensive list.

convert ipython notebook to python without ipython

Is there an easy way to convert an ipython notebook to plain python without using ipython itself (i.e. not using ipython nbconvert --to=python ...)?
Background: I want to test if there is a syntax error in various ipython notebooks using travis-ci. However, installing ipython from source takes too long and the ubuntu packages are outdated.
I wrote a simple script that does the conversion. It's probably not fool-proof but works for me. I'd still be happy to hear about a better solution.
Link to script: https://gist.github.com/hannorein/8423ad75547f37bba228