Accessing the `installSignalHandlers` parameter of the `reactor.run()` method
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 838
- Forks
- 123
- Avg merge
- 7h 58m
- Merged PRs (30d)
- 12
Description
I don't know if it is done on purpose or not, but as it is we cannot access the installSignalHandlers parameter of the reactor.run() method (_app.py, line 681).
An additional parameter implemented in Klein.run() in the same manner as displayTracebacks would be a good addition.
Here is a raw Klein.run() method redefinition from _app.py to explain my point :
def run(
self,
host: Optional[str] = None,
port: Optional[int] = None,
logFile: Optional[IO] = None,
endpoint_description: Optional[str] = None,
displayTracebacks: bool = True,
installSignalHandlers: bool = True,
) -> None:
if logFile is None:
logFile = sys.stdout
log.startLogging(logFile)
if not endpoint_description:
endpoint_description = f"tcp:port={port}:interface={host}"
endpoint = serverFromString(reactor, endpoint_description)
site = Site(self.resource())
site.displayTracebacks = displayTracebacks
endpoint.listen(site)
# Passing installSignalHandlers on the method call
reactor.run(installSignalHandlers=installSignalHandlers) # type: ignore[attr-defined]
This is a really small modification, i may provide a proper PR if accepted.
Here is the affiliated Twister documentation page : https://docs.twistedmatrix.com/en/stable/api/twisted.internet.base.ReactorBase.html#run
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in src/klein/_app.py around line 681 and inspect Klein.run(), especially how displayTracebacks is exposed before reactor.run() is called. Done means Klein.run() accepts an installSignalHandlers parameter and forwards it to reactor.run(); check the linked Twisted ReactorBase documentation for the parameter behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- backend
- Issue type
- Feature
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 48/100