Add support for running datasette as a module#556
Merged
simonw merged 1 commit intosimonw:masterfrom Jul 11, 2019
abdusco:run_as_module
Merged
Add support for running datasette as a module#556simonw merged 1 commit intosimonw:masterfrom abdusco:run_as_module
simonw merged 1 commit intosimonw:masterfrom
abdusco:run_as_module
Conversation
Owner
|
This is a really neat trick, thanks! |
simonw
pushed a commit
that referenced
this pull request
Nov 11, 2019
python -m datasette Thanks, @abdusco
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR allows running datasette using
python -m datasettecommand 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.