Giter Site home page Giter Site logo

Comments (3)

rszamszur avatar rszamszur commented on June 15, 2024 1

CLI fastapi-mvc run command implementation was completely reworked. Now it just wraps:
poetry run uvicorn --reload test_app.app.asgi:application
while doing some checks (if it's a fastapi-mvc project, and if it's installed) and allowing for minimal parametrization for host and port. The initial implementation was wrong in assumptions and it could not work properly.

I did some manual tests, and it seems to be resolved. However, I just did a few combinations and on one OS only, so in case this problem still occurs, feel free to reopen the issue. Fix will be released with version 0.9.0.

Example:

(.venv) $ fastapi-mvc new /tmp/test-app
[2022-02-14 22:00:39 +0100] [2240142] [INFO] Creating a new fastapi-mvc project: /tmp/test-app
[2022-02-14 22:00:39 +0100] [2240142] [INFO] Installing project
[2022-02-14 22:00:39 +0100] [2240142] [WARNING] Activated virtual env detected.
[install] Begin installing project.
Creating virtualenv test-app in /tmp/test-app/.venv
Updating dependencies
Resolving dependencies... (10.3s)

Writing lock file

Package operations: 57 installs, 0 updates, 0 removals

  • Installing frozenlist (1.3.0)
  • Installing idna (2.10)
  • Installing multidict (6.0.2)
  • Installing pyparsing (3.0.7)
  • Installing sniffio (1.2.0)
  • Installing aiosignal (1.2.0): Installing...
  • Installing aiosignal (1.2.0)
  • Installing anyio (3.5.0)
  • Installing async-timeout (4.0.2)
  • Installing attrs (21.4.0)
  • Installing charset-normalizer (2.0.12)
  • Installing iniconfig (1.1.1)
  • Installing mccabe (0.6.1)
  • Installing packaging (21.3)
  • Installing pluggy (1.0.0)
  • Installing py (1.11.0)
  • Installing pycodestyle (2.7.0)
  • Installing pyflakes (2.3.1)
  • Installing snowballstemmer (2.2.0)
  • Installing toml (0.10.2)
  • Installing typing-extensions (4.1.1)
  • Installing yarl (1.7.2)
  • Installing aiohttp (3.8.1): Installing...
  • Installing asgiref (3.5.0): Installing...
  • Installing asgiref (3.5.0)
  • Installing certifi (2021.10.8)
  • Installing chardet (4.0.0): Installing...
  • Installing click (7.1.2): Installing...
  • Installing coverage (6.3.1)
  • Installing coverage (6.3.1)
  • Installing click (7.1.2)
  • Installing coverage (6.3.1)
  • Installing flake8 (3.9.2)
  • Installing click (7.1.2)
  • Installing coverage (6.3.1)
  • Installing flake8 (3.9.2)
  • Installing chardet (4.0.0)
  • Installing click (7.1.2)
  • Installing coverage (6.3.1)
  • Installing flake8 (3.9.2)
  • Installing h11 (0.13.0)
  • Installing asgiref (3.5.0)
  • Installing certifi (2021.10.8)
  • Installing chardet (4.0.0)
  • Installing click (7.1.2)
  • Installing coverage (6.3.1)
  • Installing flake8 (3.9.2)
  • Installing h11 (0.13.0)
  • Installing aiohttp (3.8.1)
  • Installing asgiref (3.5.0)
  • Installing certifi (2021.10.8)
  • Installing chardet (4.0.0)
  • Installing click (7.1.2)
  • Installing coverage (6.3.1)
  • Installing flake8 (3.9.2)
  • Installing h11 (0.13.0)
  • Installing httptools (0.2.0)
  • Installing mypy-extensions (0.4.3)
  • Installing pathspec (0.9.0)
  • Installing platformdirs (2.5.0)
  • Installing pydantic (1.9.0)
  • Installing pydocstyle (6.1.1)
  • Installing pytest (6.2.5)
  • Installing python-dotenv (0.19.2)
  • Installing pyyaml (6.0)
  • Installing starlette (0.16.0)
  • Installing tomli (1.2.3)
  • Installing urllib3 (1.26.8)
  • Installing uvloop (0.16.0)
  • Installing watchgod (0.7)
  • Installing websockets (10.1)
  • Installing aioredis (2.0.1)
  • Installing aioresponses (0.7.3)
  • Installing black (21.12b0)
  • Installing fastapi (0.70.1)
  • Installing flake8-docstrings (1.6.0)
  • Installing flake8-import-order (0.18.1)
  • Installing flake8-todo (0.7)
  • Installing gunicorn (20.1.0)
  • Installing mock (4.0.3)
  • Installing pytest-asyncio (0.15.1)
  • Installing pytest-cov (2.12.1)
  • Installing requests (2.25.1)
  • Installing uvicorn (0.15.0)

Installing the current project: test-app (0.1.0)
Project successfully installed.
To activate virtualenv run: $ poetry shell
Now you should access CLI script: $ test-app --help
Alternatively you can access CLI script via poetry run: $ poetry run test-app --help
To deactivate virtualenv simply type: $ deactivate
To activate shell completion:
 - for bash: $ echo 'eval "$(_TEST_APP_COMPLETE=source_bash test-app)' >> ~/.bashrc
 - for zsh: $ echo 'eval "$(_TEST_APP_COMPLETE=source_zsh test-app)' >> ~/.zshrc
 - for fish: $ echo 'eval "$(_TEST_APP_COMPLETE=source_fish test-app)' >> ~/.config/fish/completions/test-app.fish
(.venv) $ cd /tmp/test-app/
(.venv) $ fastapi-mvc run
[2022-02-14 22:01:50 +0100] [2242322] [WARNING] Activated virtual env detected.
[2022-02-14 22:01:50 +0100] [2242322] [INFO] Starting uvicorn development server.
[2022-02-14 22:01:50 +0100] [2242322] [WARNING] Activated virtual env detected.
INFO:     Will watch for changes in these directories: ['/tmp/test-app']
INFO:     Uvicorn running on http://127.0.0.1:8000 (Press CTRL+C to quit)
INFO:     Started reloader process [2242340] using watchgod
INFO:     Started server process [2242354]
INFO:     Waiting for application startup.
INFO:     Application startup complete.

from fastapi-mvc.

rszamszur avatar rszamszur commented on June 15, 2024

@faierbol Thanks for taking the time to submit the issue!

I guess I've rushed a bit with this feature implementation. I thought I can do this the easy way, but I totally forgot I need project dependencies as well :). How silly of me. I'll prepare a fix within a few days.

In the meantime, you can still run generated project production (WSGI + ASGI) server via its CLI:

cd /test-app
poetry run test-app serve
# or if PATH is set or virtualenv activated
test-app serve

and in order to run the development server (ASGI) with reloading changes (which is basically what fastapi-mvc run was supposed to do):

poetry run uvicorn --reload test_app.app.asgi:application

Have a good one!

from fastapi-mvc.

faierbol avatar faierbol commented on June 15, 2024

Hi @rszamszur thank you for your answer, I’ll try what you suggested and let you know.

from fastapi-mvc.

Related Issues (20)

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.