Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Entry point documentation #299

Open
1 task done
robcresswell opened this issue Nov 10, 2023 · 0 comments
Open
1 task done

Entry point documentation #299

robcresswell opened this issue Nov 10, 2023 · 0 comments

Comments

@robcresswell
Copy link

robcresswell commented Nov 10, 2023

Things to check first

  • I have searched the existing issues and didn't find my feature already requested there

Feature description

Would it be possible to elaborate on, or provide an example of entry point usage with an external package? I've been quite keen to extend sqlacodegen but cannot get a working setup with the entry points; any generator I write simply doesn't show up in the list of valid generators when I try to use it with --generator.

I've currently got sqlcodegen working well in one project and generating as I'd expect. In a neighbouring directory I've got

./gen
├── README.md
├── poetry.lock
├── pyproject.toml
└── src
    └── gen
        ├── __init__.py
        └── generator.py

where the contents of the pyproject.toml are

[project]
name = "gen"

[project.entry-points."sqlacodegen.generators"]
api = "gen.generator:Generator"

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

[tool.poetry]
name = "gen"
version = "0.1.0"
description = ""
authors = ["Rob Cresswell <[email protected]>"]
readme = "README.md"

[tool.poetry.dependencies]
python = "^3.11"
sqlacodegen = "^3.0.0rc3"

and the contents of generator.py are

from sqlacodegen.generators import CodeGenerator


class Generator(CodeGenerator):
    def generate(self) -> str:
        print(">>> Generating! <<<")

        return ""

I'm aware this is entirely my fault, but I've really no idea how I could make this more simple, and my Google-fu is failing to give me any simple way to debug this part of the Python toolchain

Use case

Same as above

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant