[FEATURE] Adding Typer to custom package using entry points
See original GitHub issueWuhuu finally started using Typer and very excited about it.
I went ahead and used the most simple example
import typer
def main(name: str):
typer.echo(f"Hello {name}")
if __name__ == "__main__":
typer.run(main)
which works just fine obviously. But I’d like to expose my custom package with CLI using Typer so I made a setup.py with
from setuptools import setup
setup(
name="my_package",
entry_points={
"console_scripts": ["hello = my_package.cli:main"],
},
)
Then I can call the command using hello in a terminal BUT it doesn’t carry over any positional arguments. Maybe you could add some about entry points integration in the docs?
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:9 (2 by maintainers)
Top Results From Across the Web
Entry points specification - Python Packaging User Guide
Entry points are a mechanism for an installed distribution to advertise components it provides to be discovered and used by other code. For...
Read more >Python Entry Points Explained - Amir Rachum's Blog
I'm going to show you how to use entry points as a modular plug-in architecture. This is super useful if you want to...
Read more >Entry Points - webpack
We will show you the ways you can configure the entry property, in addition to ... dependOn : The entry points that the...
Read more >Explain Python entry points? - setuptools - Stack Overflow
Entry points are useful for allowing one package do use plugins that are in another package. For instance, Ian Bicking's Paste project uses ......
Read more >Creating Secondary Entry Points for your Angular Library
Developing an Angular Library is easier than ever nowadays since the release of Angular Library feature (from Angular 7).
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Thanks for the discussion here everyone!
If you have simple scripts and you want to get completion, you can now use Typer CLI to run your Typer scripts without having to install anything.
If you want to create a package, there’s a new guide Building a Package 🎉 .
The entry_point should point so something executing
typer.run. Something like this would do: