# Feature or enhancement

### Proposal:

Currently task groups support the `TaskGroup.create_task` function with the same interface as `asyncio.create_task`, it would be very useful to add a `TaskGroup.ensure_future` similar to `asyncio.ensure_future`. This would allow code that uses low level interfaces that return a future to use the new TaskGroup code, it would also enable code that returns an asyncio compatible Future-like object to be used with task groups.

The alternative is to create a coroutine that awaits the future and then use create_task with it, but that is a bit annoying and I believe there should be a builtin way to do this.

```python
...
def custom_future_function():
   return CustomCompatibleFuture()
...
async with asyncio.TaskGroup() as tg:
    tg.ensure_future(loop.run_in_executor(...))
    tg.ensure_future(custom_future_function())
...
```


### Has this already been discussed elsewhere?

No response given

### Links to previous discussion of this feature:

_No response_
Add asyncio.TaskGroup.ensure_future analogous to asyncio.ensure_future
This is a GitHub Issue
repo:cpython
owner:python
Title : Add asyncio.TaskGroup.ensure_future analogous to asyncio.ensure_future
Issue date:

--- start body ---
# Feature or enhancement

### Proposal:

Currently task groups support the `TaskGroup.create_task` function with the same interface as `asyncio.create_task`, it would be very useful to add a `TaskGroup.ensure_future` similar to `asyncio.ensure_future`. This would allow code that uses low level interfaces that return a future to use the new TaskGroup code, it would also enable code that returns an asyncio compatible Future-like object to be used with task groups.

The alternative is to create a coroutine that awaits the future and then use create_task with it, but that is a bit annoying and I believe there should be a builtin way to do this.

```python
...
def custom_future_function():
   return CustomCompatibleFuture()
...
async with asyncio.TaskGroup() as tg:
    tg.ensure_future(loop.run_in_executor(...))
    tg.ensure_future(custom_future_function())
...
```


### Has this already been discussed elsewhere?

No response given

### Links to previous discussion of this feature:

_No response_
--- end body ---
