autoprint generators correctly

Open
#992 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
35/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Stale
Tech stack
python
Domain
cli

Research direction

Start at the @task(autoprint=True) behavior and follow the fab list_things execution path to see how returned values are printed. Determine how generator results are currently handled; done means a generator task's yielded values are printed individually instead of its generator representation.

Written by the indexing model from the issue text.

Description

if i have a task like this:

@task(autoprint=True)
def list_things(con):
    for thing in range(3):
        yield thing

invoke (well, fabric, in my case, but all the same right?) will do this:

$ fab list_things
<generator object _list_remote_repos at 0x7fee70de2d40>

I don't find that very pretty, and think it would be much more elegant to do:

$ fab list_things
1
2
3

no? :)

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.