sparckles / Robyn

Robyn is a Super Fast Async Python Web Framework with a Rust runtime.
https://robyn.tech/
BSD 2-Clause "Simplified" License
3.95k stars 203 forks source link

`--create` does not do anything #688

Closed danielhoherd closed 4 months ago

danielhoherd commented 8 months ago

Bug Description

When I run python3 app.py --help I see --create Create a new project template., but when I run python3 app.py --create creation of a new project does not seem to happen, and the app launches like it would without --create.

--docs and --version do not appear to function as expected either, and all just launch the app as if the arg was not given.

Steps to Reproduce

  1. Add the app.py shown in the README.md file
  2. Run python3 app.py --create
  3. Observe that nothing was created

Your operating system

MacOS

Your Python version (python --version)

3.11

Your Robyn version

Other (specify below)

Additional Info

(venv) $ cat app.py
from robyn import Robyn

app = Robyn(__file__)

@app.get("/")
async def h(request):
    return "Hello, world!"

app.start(port=8080)
(venv) $ python3 app.py --help
usage: app.py [-h] [--processes PROCESSES] [--workers WORKERS] [--dev] [--log-level LOG_LEVEL] [--create] [--docs] [--open-browser] [--version]

Robyn, a fast async web framework with a rust runtime.

options:
  -h, --help            show this help message and exit
  --processes PROCESSES
                        Choose the number of processes. [Default: 1]
  --workers WORKERS     Choose the number of workers. [Default: 1]
  --dev                 Development mode. It restarts the server based on file changes.
  --log-level LOG_LEVEL
                        Set the log level name
  --create              Create a new project template.
  --docs                Open the Robyn documentation.
  --open-browser        Open the browser on successful start.
  --version             Show the Robyn version.
(venv) $ python3 app.py --create
INFO:robyn.logger:SERVER IS RUNNING IN VERBOSE/DEBUG MODE. Set --log-level to WARN to run in production mode.
INFO:robyn.logger:Added route HttpMethod.GET /
INFO:robyn.logger:Robyn version: 0.45.0
INFO:robyn.logger:Starting server at 127.0.0.1:8080
INFO:robyn.logger:Press Ctrl + C to stop

INFO:actix_server.builder:starting 1 workers
INFO:actix_server.server:Actix runtime found; starting in Actix runtime
^CINFO:robyn.logger:Terminating server!!
INFO:actix_server.server:SIGINT received; starting forced shutdown
(venv) $ ls -la
total 4
drwxr-xr-x 4 danielh staff 128 2023-11-08T17:39:16 .
drwxr-xr-x 9 danielh staff 288 2023-11-08T17:39:15 ..
-rw-r--r-- 1 danielh staff 133 2023-11-08T17:33:47 app.py
drwxr-xr-x 6 danielh staff 192 2023-11-08T17:39:16 venv
sansyrox commented 8 months ago

Hey @danielhoherd 👋

--create is a flag for when you run robyn as a module, e.g. python3 -m robyn --create

danielhoherd commented 8 months ago

@sansyrox oooh, that makes so much more sense. It would be great though if the help flags didn't show up in places that they do not work, because that's more than unhelpful; it's misguiding.

sansyrox commented 8 months ago

@danielhoherd , I do agree. However, the help message is the default argparse help message. I am not sure on how can we change it. 😅