Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
411 views
in Technique[技术] by (71.8m points)

python 3.8 - Cant add plugin in poetry

I have initialized poetry in my project. Add some libs and got this pyproject.toml:

[tool.poetry]
name = "dataapi"
version = "0.1.0"
description = "API for service."
authors = ["Claus Stolz"]

[tool.poetry.dependencies]
python = "^3.8"
gino = "^1.0.1"
fastapi = "^0.63.0"
uvicorn = "^0.13.3"
gunicorn = "^20.0.4"
alembic = "^1.5.2"
psycopg2 = "^2.8.6"
gino-starlette = "^0.1.1"

[tool.poetry.dev-dependencies]
pytest = "^6.2.1"
requests = "^2.25.1"

[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"

Now i try to add in pyproject.toml my own plugin to use it like entry points in code:

[tool.poetry.plugins."dataapi.modules"]
users = "dataapi.app.api.v1.endpoints.users"

Then try to use poetry install, but it give me message:

Installing dependencies from lock file

No dependencies to install or update

I try another methods of poetry: update,lock, but nothing happened. I tried to delete the lock file and then run poetry install - but it gave no results either.

I run my service to check and it give me an error:

for ep in entry_points()["dataapi.modules"]:
KeyError: 'dataapi.modules'

Method where i try to got entry points:

import logging
from importlib.metadata import entry_points

logger = logging.getLogger(__name__)

def load_modules(app=None):
    for ep in entry_points()["dataapi.modules"]:
        logger.info("Loading module: %s", ep.name)
        mod = ep.load()
        if app:
            init_app = getattr(mod, "init_app", None)
            if init_app:
                init_app(app)

I really don't understood how add plugin in poetry and need help...

question from:https://stackoverflow.com/questions/65850485/cant-add-plugin-in-poetry

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...