bananaml / banana-cli Goto Github PK
View Code? Open in Web Editor NEWLicense: Apache License 2.0
License: Apache License 2.0
The python path doesn't include the current directory when running 'banana dev', so you can't import packages or modules from the current folder.
To reproduce:
mkdir banana-import-bug-test
cd banana-import-bug-test
banana init
testmod.py
print("hello world")
app.py
[...]
import testmod
import sys
print(sys.path)
[...]
Works:
$ python app.py
['[...]/banana-import-bug-test', [...]]
Hello world
------
Starting Potassium Server ๐
Running init()
[...]
Serving at http://0.0.0.0:8000
------
Errors:
$ banana dev
------
Starting server ๐
['[...]/banana-import-bug-test/venv/bin', [...]]
Traceback (most recent call last):
[...]
ModuleNotFoundError: No module named 'testmod'
I'm getting the following error when I try to do banana init hello-world
git.exc.GitCommandError: Cmd('git') failed due to: exit code(128)
cmdline: git clone -v -- https://github.com/bananaml/banana-cli.git hello-world/tmp
stderr: 'Cloning into 'hello-world/tmp'...
[email protected]: Permission denied (publickey).
fatal: Could not read from remote repository.
If user runs
banana init
without any project name/dir we could either throw error or prompt the user to provide one. Prevents from adding the files in whatever dir the user happens to be in.
Currently need to look at pip freeze to identify the current running version. Would be great if all commands indicated current version.
Other alternative is to have banana version or banana -v.
If the development port is in use, it would be good to catch that gracefully and fail.
banana init
in a clean folder first yields an install error
...
Collecting zipp>=0.5
Using cached zipp-3.15.0-py3-none-any.whl (6.8 kB)
Building wheels for collected packages: lit
Building wheel for lit (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: /home/ubuntu/whisper-wordtimestamps/banana/venv/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-i761ji9r/lit/setup.py'"'"'; __file__='"'"'/tmp/pip-install-i761ji9r/lit/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-_gue7qv_
cwd: /tmp/pip-install-i761ji9r/lit/
Complete output (6 lines):
usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
or: setup.py --help [cmd1 cmd2 ...]
or: setup.py --help-commands
or: setup.py cmd --help
error: invalid command 'bdist_wheel'
----------------------------------------
ERROR: Failed building wheel for lit
...
and then
...
๐ Project ready to go (hurrah!)
๐ฅ To run a dev server with hot-reload, run:
banana dev
(venv) ubuntu@165-1-79-47:~/whisper-wordtimestamps/banana$ banana dev
------
Starting server ๐
Traceback (most recent call last):
File "/home/ubuntu/.local/bin/banana", line 8, in <module>
sys.exit(cli())
File "/usr/lib/python3/dist-packages/click/core.py", line 764, in __call__
return self.main(*args, **kwargs)
File "/usr/lib/python3/dist-packages/click/core.py", line 717, in main
rv = self.invoke(ctx)
File "/usr/lib/python3/dist-packages/click/core.py", line 1137, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/usr/lib/python3/dist-packages/click/core.py", line 956, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/usr/lib/python3/dist-packages/click/core.py", line 555, in invoke
return callback(*args, **kwargs)
File "/home/ubuntu/.local/lib/python3.8/site-packages/banana_cli/cli.py", line 62, in dev
run_dev_server(app_path, site_packages, auto_compat)
File "/home/ubuntu/.local/lib/python3.8/site-packages/banana_cli/cmd_dev.py", line 164, in run_dev_server
start_all(b1, b2, first_run)
File "/home/ubuntu/.local/lib/python3.8/site-packages/banana_cli/cmd_dev.py", line 94, in start_all
run_cell(b1)
File "/home/ubuntu/.local/lib/python3.8/site-packages/banana_cli/process/run.py", line 3, in run_cell
exec(input_file, globals())
File "<string>", line 1, in <module>
File "/home/ubuntu/whisper-wordtimestamps/banana/venv/lib/python3.8/site-packages/potassium/__init__.py", line 1, in <module>
from .potassium import *
File "/home/ubuntu/whisper-wordtimestamps/banana/venv/lib/python3.8/site-packages/potassium/potassium.py", line 2, in <module>
from flask import Flask
File "/home/ubuntu/whisper-wordtimestamps/banana/venv/lib/python3.8/site-packages/flask/__init__.py", line 1, in <module>
from . import json as json
File "/home/ubuntu/whisper-wordtimestamps/banana/venv/lib/python3.8/site-packages/flask/json/__init__.py", line 6, in <module>
from ..globals import current_app
File "/home/ubuntu/whisper-wordtimestamps/banana/venv/lib/python3.8/site-packages/flask/globals.py", line 45, in <module>
app_ctx: AppContext = LocalProxy( # type: ignore[assignment]
TypeError: __init__() got an unexpected keyword argument 'unbound_message'
If I add "flask==2.1.3" as recommended on SO, another error appears at run time because "get_json" is not defined on the flask request obejct (they didn't have that api yet i guess).
Just leaving this here for a discussion point. The return response below seems like extra boilerplate.
return Response(status, json)
My perfect solution would be to:
Normal success response
return {'key': 'value'}
Verbose success response
return {'key': 'value'}, 200
Custom status response
return {'error': 'Not Found'}, 404
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.