Plugin that adds Python cell support to Starboard
MPL 2.0
Plugin that adds Python cells to Starboard
License: Mozilla Public License 2.0
Plugin that adds Python cell support to Starboard
MPL 2.0
One of the really nice things about SymPy in Jupyter is the repr of all SymPy objects can output nice looking math with LaTeX (via MathJax).
Ideally we'd also have some test cases for the filesystem code.
For reference, here is mine
const backingStore = new Map<string, string | null>();
const fs: NotebookFilesystem = {
async get({ path }) {
const file = backingStore.get(path);
if (file === undefined) {
return { ok: false, status: 1, error: new Error("File not found " + path) };
} else {
return { ok: true, data: file };
}
},
async put({ path, value }) {
backingStore.set(path, value);
return { ok: true, data: undefined };
},
async delete({ path }) {
backingStore.delete(path);
return { ok: true, data: undefined };
},
async move({ path, newPath }) {
// TODO: Implement directory moving
const getFileResult = await fs.get({ path });
if (!getFileResult.ok) return getFileResult;
const deleteFileResult = await fs.delete({ path });
if (!deleteFileResult.ok) return deleteFileResult;
const putFileResult = await fs.put({ path: newPath, value: getFileResult.data });
if (!putFileResult.ok) return putFileResult;
return { ok: true, data: undefined };
},
async listDirectory({ path }) {
if (!path.endsWith("/")) path += "/";
const filePaths = [...backingStore.keys()]
.filter((k) => k.startsWith(path) && k !== path)
.map((v) => v.slice(path.length).split("/")[0]);
return { ok: true, data: [...new Set(filePaths)] };
},
};
rt.internal.fs = fs;
(rt.internal.fs as any).backingStore = backingStore;
# %% [python]
import os
print(os.path.dirname(os.path.realpath('__file__')))
f = open("demofile.txt", "a")
f.write("File content ๐!")
f.close()
#open and read the file after the appending:
f = open("demofile.txt", "r")
print(f.read()) # Should print out "File content ๐!"
os.mkdir("cat")
f = open("./cat/demofile2.txt", "a")
f.write("Also a file")
f.close()
f = open("cat/demofile2.txt", "r")
print(f.read()) # Should print out "Also a file"
# %% [python]
f = open("cat/demofile4.txt", "r") # Should cause an error
print(f.read())
# %% [python]
import os
# Should print all files and directories
for currentpath, folders, files in os.walk('/mnt'):
for folder in folders:
print(os.path.join(currentpath, folder))
for file in files:
print(os.path.join(currentpath, file))
# %% [python]
import glob
# Should print all files and directories in /mnt/shared
for filename in glob.iglob('**/**', recursive=True):
print(filename)
# %% [python]
import os
print(os.listdir(path='.')) # Should show ['demofile.txt', 'cat']
os.rename('demofile.txt', 'catapprovedfile.txt')
print(os.listdir(path='.')) # Should show ['cat', 'catapprovedfile.txt']
os.rename('catapprovedfile.txt', './cat/myfile.txt')
print(os.listdir(path='cat')) # Should show ['demofile2.txt', 'myfile.txt']
This is a feature request for the far future: Autocompleting!
It would probably be implemented by taking a Python language server such as
and then somehow connecting it to the editor
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.