Skip to content

gal16v8d/pvz-svc

Repository files navigation

pvz-svc

FastApi logo

FastApi + Mongo REST API wiki about Plants Vs Zombies videogame

🚀 Getting Started

1. Prerequisites

Ensure you have the modern Poetry package manager installed globally on your machine:

curl -sSL [https://install.python-poetry.org](https://install.python-poetry.org) | python3 -

2. Useful commands

Init repo:

poetry new pvz-svc

Create the virtual env folder:

mkdir .venv

Install all the dependencies in the project (clean-state):

poetry install

Install any dependency you need:

poetry add lib_here

Remove a dependency you don't need:

poetry remove lib_here

Update all (updatable) libs

poetry update

Audit/Scan for vulnerabilities

Install audit plugin (if required)

poetry self add poetry-audit-plugin

Vulnerability check

poetry audit

Typosquatting, lock file integrity check

poetry check

3. Set up

Activate using the command:

source .venv/bin/activate

or poetry 2.0 or above syntax

eval $(poetry env activate)

Exit virtual env:

exit

or

deactivate

4. Advanced use cases

If multiple python versions are found in the operative system, then

  • use pyenv to handle the versions
  • if needed set the local python for this project, like
pyenv local 3.14.3
  • you can confirm all good by checking
pyenv which python
  • set the specific python version like
poetry env use $USER_HOME/.pyenv/versions/3.14.3/bin/python
  • then install using commands like the ones in the previous section

5. Formatter

Using black as code formatter Can be used this way:

poetry run black .

6. Type checking

Using mypy for type checking Can be used this way:

poetry run mypy app tests

7. API docs

  • http://{host}:{port}/docs (swagger)
  • http://{host}:{port}/redoc (redoc)

8. Launch

You might need to create a DB in Atlas Mongo, then please reference .env.sample, to create your own .env file with the relevant database info. Once ready you can do the following to launch:

uvicorn app:app --reload

9. Test

pytest

or with coverage

pytest --cov

10. Automation Tests

Run the server using the command on launch section Then open another console, activate the env and go to automation folder Once there run the tests using:

behave

You can see the console output with several features, scenarios and steps and its status as passed, failed or skipped.

11. Web deployment

This app can be hosted in Railway, folder that helps with it is .ci folder.

List of cool technologies in use here

License

MIT licensed.

Stay in touch

About

Wiki Rest API for Plants Vs Zombies videogame

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors