sphinx-doc / sphinx-autobuild

Watch a Sphinx directory and rebuild the documentation when a change is detected. Also includes a hot-reload web server.
MIT License
552 stars 84 forks source link

Allow float values for the `--delay` parameter #141

Closed ShaiAvr closed 7 months ago

ShaiAvr commented 1 year ago

Context

I use sphinx-autobuild in my project, and I noticed the --delay parameter which controls how long to wait before opening a browser is of type int as can be seen from the code in cli.py and in the command line:

Screenshot 2023-11-03 104145

This seems odd to me since time can obviously be a float.

The --delay parameter is directly passed as the parameter open_url_delay to the Server.serve() method of the livereload package as can be seen here. Looking at the documentation of this package, it seems that this parameter doesn't have a problem with float values. Furthermore, looking at the code of Server.serve, this parameter is simply passed to time.sleep which obviously can handle floating values.

Therefore, it is extremely easy to allow support for floating values of the --delay parameter. We just need to change the argument's type to float instead of int and it should work without further changes.

Proposal

Change the type of the --delay argument to float to allow specifying floating time. It should be the only change necessary to support floating values for this parameter. I can write a PR to implement this change if there are no problems with it (Note that it would be the first time I make a PR).

Tasks and updates

No response

welcome[bot] commented 1 year ago

Thanks for opening your first issue here! Engagement like this is essential for open source projects! :hugs:
If you haven't done so already, check out EBP's Code of Conduct. Also, please try to follow the issue template as it helps other community members to contribute more effectively.
If your issue is a feature request, others may react to it, to raise its prominence (see Feature Voting).
Welcome to the EBP community! :tada:

AA-Turner commented 7 months ago

Done in f17b2ab74356e0c6dd5bb0e99079950f7062769c.

A