Coder Social home page Coder Social logo

banana-cli's People

Contributors

erik-dunteman avatar erikkaum avatar kylejmorris avatar nik-418 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

banana-cli's Issues

Git Permission denied when try to init project

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.

Python path doesn't include current directory when running 'banana dev'

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'

Return response seems a bit verbose

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

Capture port in use exception

If the development port is in use, it would be good to catch that gracefully and fail.

  • Provide a --port flag to banana dev to override the default port
  • Iterate up through ports until you find an open one

Show version in output

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.

vanilla setup yields TypeError; doesn't start at all

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).

Handle no path/dir provided

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.