Comments (16)
I don't have any experience in type annotation, but I'm thinking that the Jupyter projects will need to exchange type definition, right? Like nbclient will probably need a definition of a KernelManager and a KernelClient I guess.
Doesn't need a type stub -- you can just import the class and use it in the annotation inline. The inline annotations actually read better for expectations.
For example:
from jupyter_client.managerabc import KernelManagerABC
from nbformat import NotebookNode
...
def __init__(self, nb: NotebookNode, km: KernelManagerABC=None, **kw):
...
works just fine
from nbclient.
Yes but traitlets validate type at runtime, it's not static type analysis.
from nbclient.
Should we use stubs files or add type annotations in the source code?
Should we use python>=3.6 type annotation syntax?
from nbclient.
Should we use stubs files or add type annotations in the source code?
I haven't used stubs much, just type annotations. I'm not sure how much benefit we'd get for using stubs? If you have more experience on that would love an opinion.
Should we use python>=3.6 type annotation syntax?
Yep
from nbclient.
Wait you mean we shouldn't interweave traitlets everywhere?
from nbclient.
(that is a joke, I think it's a good idea)
from nbclient.
I haven't used stubs much, just type annotations. I'm not sure how much benefit we'd get for using stubs? If you have more experience on that would love an opinion.
I don't have any experience in type annotation, but I'm thinking that the Jupyter projects will need to exchange type definition, right? Like nbclient will probably need a definition of a KernelManager
and a KernelClient
I guess.
from nbclient.
Wait you mean we shouldn't interweave traitlets everywhere?
I actually don't know how traitlets play with type annotations... that would be something to figure out I guess (joke aside)
from nbclient.
my (poor) understanding of traitlets is that one of the reasons it was developed was to allow you to type inputs, so I think (?) to some degree they replicate functionality
from nbclient.
They also provide a config interface for assignment from file / cml args.
from nbclient.
ok ok I apologize for throwing shade at traitlets :-)
from nbclient.
lol, I don't particularly like the traitlet model either as it uses less than ideal software practices to achieve (high complexity in tracing, 10+ class inheritance chains, makes init operations more complex, very obscure error message patterns when it fails, unexpected config inheritance patterns, etc) -- which I've been vocal about. I'd prefer removing traitlets from nbclient if we could.
I've left them when porting over because the file based config is used very very heavily in nbconvert and the users who use it like it a lot. So removing it from nbclient would require mapping that in nbconvert in the preprocessor layer... might be worth discussing doing before 1.0 of nbclient and 6.0 of nbconvert fully ship? Would be tough to choose.
from nbclient.
I guess if we just wanted the CLI part of traitlets, we could use click. But there's also the reactive part in traitlets (observing changes).
from nbclient.
(I'm a big fan of click)
from nbclient.
I have started to work on it in #83.
from nbclient.
Fixed in #83
from nbclient.
Related Issues (20)
- Using nbclient to talk to jupyter lab running remotely HOT 10
- Renamed default branch to main
- 0.6.1: sphinx faiils because missing file HOT 2
- Background Python process after running tests
- How to reuse exsisting kernel? HOT 4
- Test failure in ipywidgets 8 HOT 2
- nbclient 0.6.6 doesn't report cell magic error properly
- Cell caching HOT 6
- just_run does not close event loop it creates HOT 2
- Project dependencies may have API risk issues HOT 2
- 0.7.1: pytest is failing because missing ` jupyter_core.utils.ensure_async` HOT 11
- jupyter_core version constraint is invalid HOT 3
- nbclient >= 0.7.1 raises ImportError when trying to open a notebook HOT 1
- AttributeError: 'KernelManager' object has no attribute 'cleanup' HOT 5
- `NotebookClient.wait_for_reply` hangs with jupyter_client 8 or later HOT 4
- Is it possible to programmatically inspect variables of a NotebookNode? HOT 5
- output of type `stream` is split over multiple cells HOT 10
- execute_cell running error HOT 4
- ipykernel.comm.Comm is deprecated HOT 3
- Calling `jupyter-execute` runs the notebook but doesn't save it HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nbclient.