Skip to content

Add support for running datasette as a module#556

Merged
simonw merged 1 commit intosimonw:masterfrom
abdusco:run_as_module
Jul 11, 2019
Merged

Add support for running datasette as a module#556
simonw merged 1 commit intosimonw:masterfrom
abdusco:run_as_module

Conversation

@abdusco
Copy link
Contributor

@abdusco abdusco commented Jul 9, 2019

This PR allows running datasette using python -m datasette command in addition to just running the executable.

This function is quite useful when debugging a plugin in a project because IDEs like PyCharm can easily start a debug session when datasette is run as a module in contrast to trying to attach a debugger to a running process.

image

@simonw
Copy link
Owner

simonw commented Jul 11, 2019

This is a really neat trick, thanks!

@simonw simonw merged commit 9ca860e into simonw:master Jul 11, 2019
simonw pushed a commit that referenced this pull request Nov 11, 2019
james-s-w-clark added a commit to james-s-w-clark/jenkinsdiagram that referenced this pull request Feb 8, 2023
example __init__.py - https://github.com/simonw/datasette/blob/main/datasette/__init__.py - say what is accessible from each file in the package. For now, be lazy *

wrap the cli with __main__.py - might help run the module directly with python -m - simonw/datasette#556

Try setuptools for setup.py - it's used here, where I'm following the rest of the python->pypi->brew example https://github.com/simonw/datasette/blob/main/setup.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants