# python: Add task for running modules \(\#26462\) · gitcafe/zed

[View on GitCafe](https://git.cafe/gitcafe/zed/commit/1574a3a2fdc6bfbb4493dc3a1ee1da9dbed807ab)

Repository: [gitcafe/zed](https://git.cafe/gitcafe/zed)

Visibility: public

Requested revision: 1574a3a2fdc6bfbb4493dc3a1ee1da9dbed807ab

Requested commit: 1574a3a2fdc6bfbb4493dc3a1ee1da9dbed807ab

Commit: 1574a3a2fdc6bfbb4493dc3a1ee1da9dbed807ab

Tree: 6a941997b544c691b8644411d56f2743b19948e8

Author: Alex van de Griendt

Committer: GitHub

## Message

````
python: Add task for running modules (#26462)

Closes #26460

I am new to contributing to Zed (and pretty new to Rust in general). I'm
not too familiar with code style, guidelines etc. so please feel free to
suggest changes/improvements.

This PR adds a run icon to Python files that have a "main" function:
```python
if __name__ == "__main__":
    ...
```

In addition to the gutter icon, there is now also an extra task in the
command palette "run module".

Release Notes:

- Added detection for runnable Python modules
- Added Python-specific task to run a Python file as a module from
inside the project's scope

---------

Co-authored-by: Piotr Osiewicz <24362066+osiewicz@users.noreply.github.com>
````

## Parents

- [152432f1d9f5da44e1c96abd45f6c0f3d2b6051b](https://git.cafe/gitcafe/zed/commit/152432f1d9f5da44e1c96abd45f6c0f3d2b6051b?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zed/tree/1574a3a2fdc6bfbb4493dc3a1ee1da9dbed807ab?format=markdown)
