Closed SahiniDev closed 1 year ago
Hi, and thanks for raising this issue.
Could you please provide more context on this? What options did you choose?
Hey, thank you for the fast response!
I always create a project with Rest and nothing else (except Logoru) selected. I got 2 running Systems and I wrote the issue after I couldn't get it working on one of my systems, after your question I decided I wanted to try out a few things before going at it again and it turns out it just works without problems on my other PC.
So I tried running it again on the system where it doesn't work starting from a completely clean clone state:
on FastAPI-template
python -m venv venv
enter venv
python -m pip install poetry
no issues here except a warning that I'm using an older pip version (21.2.3 instead of 22.22.2)
python -m pip install .
python -m fastapi_template
chose Rest and everything else is none
except Logoru.
Now I change folder into the generated project:
python -m venv venv
enter venv
poetry install
Installing dependencies from lock file
Package operations: 88 installs, 0 updates, 1 removal
• Removing setuptools (65.3.0)
• Installing smmap (5.0.0)
• Installing gitdb (4.0.9)
• Installing mccabe (0.6.1)
• Installing pbr (5.10.0)
• Installing pycodestyle (2.8.0)
• Installing pyflakes (2.4.0)
• Installing colorama (0.4.5)
• Installing docutils (0.19)
• Installing idna (3.4)
• Installing flake8 (4.0.1)
• Installing gitpython (3.1.27)
• Installing pyparsing (3.0.9)
• Installing pyyaml (6.0)
• Installing sniffio (1.3.0)
• Installing snowballstemmer (2.2.0)
• Installing stevedore (4.0.0)
• Installing anyio (3.6.1)
• Installing attrs (22.1.0)
• Installing certifi (2022.9.14)
• Installing filelock (3.8.0)
• Installing bandit (1.7.4)
• Installing flake8-polyfill (1.0.2)
• Installing distlib (0.3.6)
• Installing eradicate (2.1.0)
• Installing h11 (0.12.0)
• Installing iniconfig (1.1.1)
• Installing isort (5.10.1)
• Installing packaging (21.3)
• Installing platformdirs (2.5.2)
• Installing pluggy (1.0.0)
• Installing py (1.11.0)
• Installing pydocstyle (6.1.1)
• Installing pygments (2.13.0)
• Installing restructuredtext-lint (1.4.0)
• Installing tomli (2.0.1)
• Installing typing-extensions (4.3.0)
EnvCommandError
Command "C:\Users\(MyUser)\Projekt\Neuer Ordner\FastAPI-template\logilogi\venv\Scripts\pip.exe" install --no-deps file:///C:/Users/(MyUser)/AppData/Local/pypoetry/Cache/artifacts/81/bc/84/e389fe50ba4ac624a1658aed8cdcceb18a58f785c459c2c067edeb7af5/restructuredtext_lint-1.4.0.tar.gz errored with the following return code 1, and output:
Processing c:\users\(MyUser)\appdata\local\pypoetry\cache\artifacts\81\bc\84\e389fe50ba4ac624a1658aed8cdcceb18a58f785c459c2c067edeb7af5\restructuredtext_lint-1.4.0.tar.gz
ERROR: Command errored out with exit status 1:
command: 'C:\Users\(MyUser)\Projekt\Neuer Ordner\FastAPI-template\logilogi\venv\Scripts\python.exe' -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\(MyUser)\\AppData\\Local\\Temp\\pip-req-build-u4iz4cei\\setup.py'"'"'; __file__='"'"'C:\\Users\\(MyUser)\\AppData\\Local\\Temp\\pip-req-build-u4iz4cei\\setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base 'C:\Users\(MyUser)\AppData\Local\Temp\pip-pip-egg-info-sqqdwrdq'
cwd: C:\Users\(MyUser)\AppData\Local\Temp\pip-req-build-u4iz4cei\
Complete output (3 lines):
Traceback (most recent call last):
File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'setuptools'
----------------------------------------
WARNING: Discarding file:///C:/Users/(MyUser)/AppData/Local/pypoetry/Cache/artifacts/81/bc/84/e389fe50ba4ac624a1658aed8cdcceb18a58f785c459c2c067edeb7af5/restructuredtext_lint-1.4.0.tar.gz. Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
WARNING: You are using pip version 21.2.3; however, version 22.2.2 is available.
You should consider upgrading via the 'C:\Users\(MyUser)\Projekt\Neuer Ordner\FastAPI-template\logilogi\venv\Scripts\python.exe -m pip install --upgrade pip' command.
at ~\.local\pipx\venvs\poetry\lib\site-packages\poetry\utils\env.py:1195 in _run
1191│ output = subprocess.check_output(
1192│ cmd, stderr=subprocess.STDOUT, **kwargs
1193│ )
1194│ except CalledProcessError as e:
→ 1195│ raise EnvCommandError(e, input=input_)
1196│
1197│ return decode(output)
1198│
1199│ def execute(self, bin, *args, **kwargs):
(venv)
(MyUser)@ThinkPad MINGW64 ~/Projekt/Neuer Ordner/FastAPI-template/logilogi (master)
This time a different error appeared (couldn't replicate the attribute error :/) Think pip might've been the reason that this error occured?
I've tried to generate a project with loguru, but I cannot reproduce this issue. If anyoe would ever came up with the same issue, I will reopen it.
But my point is that this issue isn't really related to the template itself. It's more likely to be a problem of your python configuration or with loguru.
Closing for now.
Yes you're correct after more playing around I managed to fix the issue too! Sorry for the inconvencience!
@s3rius
I encountered a similar error just now, specifically related to the (most likely due to a circular import)
part.
If a project uses the generated {project-name}
directory as the PWD, the file logging.py
at the root of the project causes a conflict with the built-in logging
module.
@fmigneault, can you provide me with options, you've chosen?
I generated project using this command.
fastapi_template --name logtest --api-type rest --db none --ci none --loguru --quite
After the project is generated I successfully started it using these commands:
poetry install
poetry run python -m logtest
Everything seems to be working as intended.
INFO: Will watch for changes in these directories: ['/home/s3rius/logtest/logtest']
INFO: Uvicorn running on http://127.0.0.1:8000 (Press CTRL+C to quit)
INFO: Started reloader process [2405709] using WatchFiles
2023-03-27 23:00:17.316 | INFO | uvicorn.server:serve:75 - Started server process [2405711]
2023-03-27 23:00:17.316 | INFO | uvicorn.lifespan.on:startup:47 - Waiting for application startup.
2023-03-27 23:00:17.317 | INFO | uvicorn.lifespan.on:startup:61 - Application startup complete.
@s3rius I followed the dynamic menu with following selections / enabled components:
So I generated the project with set of features that you've sent me.
fastapi_template --name logtest --api-type rest --db postgresql --ci none --orm tortoise --rabbit --taskiq --dummy --routers --swagger --sentry --quite
And everything is generated as it should be. Please regenerate project once again.
Resolved in #154.
I've been trying to set up the project with Logoru enabled and if I try to run it I get the error
I'm a little bit at a loss condering this was just when starting the project right after generating it.
It works without a problem when I exclude Logoru.