Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Is it possible to modify how run() is typed so the result isn't potentially None?

Open
#1,027 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
30/100
Issue type
Refactor
Clarity
Needs clarification
Activity status
Stale
Tech stack
python
Domain
cli

Research direction

Start by tracing the Runner.run API and the disown option described in the issue, then inspect how its return annotation is used by callers. Determine whether the typing can distinguish disowned and owned execution without breaking the existing API, and add coverage showing the annotation and behavior for both cases.

Written by the indexing model from the issue text.

Description

This is a semi ignore question, but I want to know if this is possible and if I could open a PR to fix.

This is kind of an annoy behavior:
def run(self, command: str, **kwargs: Any) -> Optional["Result"]:

It means I always have to check if its not None, but from what I understand the only case where it will return None is if disown is set to True right?

Is there a way to refactor so the response is always expected to return unless disown is set to true?

Maybe just a super simple class hierarchy where the base Runner class has everything but there are two children:
DisownedRunner and OwnedRunner?

And then DisownedRunner runner is the only one that is potentially None?

Thanks! I'm asking more what it would take to fix so I can open a PR more than just asking for this to be fixed, I'd like to contribute!

Dominant language
Python
Stars
4.8k
Forks
412
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from pyinvoke/invoke

All issues in pyinvoke/invoke

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.