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

Make shut as a module #13

Closed
Mulugruntz opened this issue Jun 4, 2021 · 4 comments
Closed

Make shut as a module #13

Mulugruntz opened this issue Jun 4, 2021 · 4 comments
Assignees
Labels
enhancement New feature or request

Comments

@Mulugruntz
Copy link

Shut cannot be run as python -m shut or coverage run -m shut pkg test

When doing so:

$> python -m shut
/...bin/python: No module named shut.__main__; 'shut' is a package and cannot be directly executed
$> coverage run -m shut pkg test --no-capture
No module named shut.__main__; 'shut' is a package and cannot be directly executed

This is an example of a __main__.py file (from pytest)

https://github.com/pytest-dev/pytest/blob/main/src/pytest/__main__.py

"""The pytest entry point."""
import pytest

if __name__ == "__main__":    
    raise SystemExit(pytest.console_main())
@NiklasRosenstein
Copy link
Owner

Hey @Mulugruntz , should be easy to do. I might get to it later today, or you can also propose a PR if you like!

@NiklasRosenstein NiklasRosenstein added the enhancement New feature or request label Jun 4, 2021
@Mulugruntz
Copy link
Author

Hi @NiklasRosenstein

It "seems" not too complicated except... that Click does not seem to be able to be called as a package? 🤔

One way to go around it would be to use Typer instead / conjointly?
https://typer.tiangolo.com/tutorial/package/

Internally, it uses Click and can also be used with Click.

What's your opinion?

@NiklasRosenstein
Copy link
Owner

https://github.com/NiklasRosenstein/shut/blob/a7976abf2d9efeff5c7a9b3a3e47c4002163ed43/src/shut/__main__.py#L1-L6

Is all that's needed :)

In v0.12.0

@NiklasRosenstein NiklasRosenstein self-assigned this Jun 8, 2021
@Mulugruntz
Copy link
Author

Nice! I went down the rabbit hole for hours and didn't test just calling shut() 😅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants