Granian depends on the watchfiles Python package for the --reload (reload on file changes) feature. This feature is helpful for local development, but is not needed on production (at least that I know of!).
The watchfiles package brings in the following extra packages to the granian dependency closure:
watchfiles
anyio
idna
sniffio
To reduce the dependencies in production, I propose making watchfiles optional:
Move the watchfiles import to be done lazily in _serve_with_reloader.
Remove the watchfiles from the default dependencies and move it to a granian[watch] extra instead.
Update the docs to mention that the [watch] extra is needed for --reload to work.
Sounds reasonable to me, I'll be happy to accept a PR for this.
The only thing I would change in your plan is to name the extra reload instead of watch just to be more consistent.
Granian depends on the watchfiles Python package for the
--reload
(reload on file changes) feature. This feature is helpful for local development, but is not needed on production (at least that I know of!).The watchfiles package brings in the following extra packages to the granian dependency closure:
To reduce the dependencies in production, I propose making watchfiles optional:
_serve_with_reloader
.watchfiles
from the defaultdependencies
and move it to agranian[watch]
extra instead.[watch]
extra is needed for--reload
to work.I can implement this if it sounds good.