# Converting Python code to Fortran code

**URL:** <https://fortran-lang.discourse.group/t/converting-python-code-to-fortran-code/3806>\
**Category:** Help\
**Created:** [June 20, 2022, 8:46am UTC](https://fortran-lang.discourse.group/t/converting-python-code-to-fortran-code/3806 "2022-06-20T08:46:59Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![Beliavsky](https://avatars.discourse-cdn.com/v4/letter/b/ba8739/32.png) [@Beliavsky](https://fortran-lang.discourse.group/u/Beliavsky)\
**Post date:** [June 20, 2022, 11:11am UTC](https://fortran-lang.discourse.group/t/converting-python-code-to-fortran-code/3806/4 "2022-06-20T11:11:43Z")

</div>

My list of Fortran tools has a section on [Translation to Fortran](https://github.com/Beliavsky/Fortran-Tools#translation-to-fortran), where [pyccel](https://github.com/pyccel/pyccel) is mentioned. The Readme says

> **Pyccel** stands for Python extension language using accelerators.
> 
> The aim of **Pyccel** is to provide a simple way to generate automatically, parallel low level code. The main uses would be:
> 
> 1. Convert a _Python_ code (or project) into a Fortran or C code.
> 2. Accelerate _Python_ functions by converting them to _Fortran_ or _C_ functions.
> 
> **Pyccel** can be viewed as:
> 
> - _Python-to-Fortran/C_ converter
> - a compiler for a _Domain Specific Language_ with _Python_ syntax
> 
> Pyccel comes with a selection of **extensions** allowing you to convert calls to some specific python packages to Fortran/C. The following packages will be covered (partially):
> 
> - numpy
> - scipy
> - mpi4py (not available yet)
> - h5py (not available yet)
> 
> Pyccel’s acceleration capabilities lead to much faster code. A small speed comparison of python vs pyccel or other tools can be found in the [performance](https://github.com/pyccel/pyccel/blob/master/performance.md) file.

I wrote about it in a December 2020 thread [Translating Python to Fortran with pyccel](https://fortran-lang.discourse.group/t/translating-python-to-fortran-with-pyccel/503) – it has become more capable since then. Pyccel is an active project with numerous contributors. It would be great if translation to Fortran became a standard way of speeding up Python code, especially scientific code. If many Fortranners tried it and gave feedback to the Pyccel developers, that would benefit both the scientific Python and Fortran communities. They were responsive to a few issues I raised.

---

_[View the full topic](https://fortran-lang.discourse.group/t/converting-python-code-to-fortran-code/3806)._
