f2py-jit


Namef2py-jit JSON
Version 1.1.1 PyPI version JSON
download
home_pageNone
SummaryJust-in-time Fortran extension builder for Python
upload_time2024-12-14 21:54:42
maintainerNone
docs_urlNone
authorNone
requires_python>=3.7
licenseGPLv3
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            f2py-jit
==================

[![pypi](https://img.shields.io/pypi/v/f2py-jit.svg)](https://pypi.python.org/pypi/f2py-jit/)
[![version](https://img.shields.io/pypi/pyversions/f2py-jit.svg)](https://pypi.python.org/pypi/f2py-jit/)
[![license](https://img.shields.io/pypi/l/f2py-jit.svg)](https://en.wikipedia.org/wiki/GNU_General_Public_License)
[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/git/https%3A%2F%2Fframagit.org%2Fcoslo%2Ff2py-jit/HEAD?labpath=docs%2Findex.ipynb)
[![pipeline status](https://framagit.org/coslo/f2py-jit/badges/master/pipeline.svg)](https://framagit.org/coslo/f2py-jit/-/commits/master)
[![coverage report](https://framagit.org/coslo/f2py-jit/badges/master/coverage.svg)](https://framagit.org/coslo/f2py-jit/-/commits/master)

Just-in-time compilation of Fortran code in Python via [f2py](https://numpy.org/doc/stable/f2py/).

Check out the [documentation](https://coslo.frama.io/f2py-jit/) for full details.

Quick start
-----------

Start from a piece of Fortran `code.f90`
```fortran
subroutine hello()
  print*, "Hello world!"
end subroutine
```

Compile the code, import it and execute it
```python
from f2py_jit import jit
f90 = jit('code.f90')
f90.hello()
```

Do the same but from a python string containing the source block
```python
source = """
subroutine hello()
  print*, "Hello world!"
end subroutine
"""
f90 = jit(source)
f90.hello()
```

If the Fortran source contains multiple subroutines calling each other, `f2py` will not perform interprocedural optimizations (at least not by default). `f2py_jit` can inline the source code before compiling it, and you will get a [performace boost](https://coslo.frama.io/f2py-jit/tutorial/#performance) [**This feature is experimental**]
```python
f90 = jit('code.f90', inline=True)
```

Features
--------
- Compilation of Fortran source blocks as Python strings
- Caching of module builds across executions
- Support for Fortran derived types via f90wrap
- Inlining to improve performance (experimental)

Dependencies
------------

- `numpy`
- Fortran compiler (ex. `gfortran`)

The package currently supports Python versions from 3.7 to 3.13. 

Note that Python versions >= 3.12 will use the `meson` backend to build Fortran extensions, which has slower build times than `distutils` (used by default in versions < 3.12).

Installation
------------
From pip
```
pip install f2py-jit
```

To install the package with support for derived types (courtesy of `f90wrap`)
```
pip install f2py-jit[types]
```
Note that this requires Python >= 3.8.

From source
```
git clone https://framagit.org/coslo/f2py-jit.git
cd f2py_jit
pip install .
```

Credits
-------
Part of this code is adapted from `numpy.f2py` module by Pearu Peterson, in accordance with the NumPy license.

Authors
-------
Daniele Coslovich: https://www.units.it/daniele.coslovich/

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "f2py-jit",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": null,
    "keywords": null,
    "author": null,
    "author_email": "Daniele Coslovich <daniele.coslovich@umontpellier.fr>",
    "download_url": "https://files.pythonhosted.org/packages/e0/16/4c7e9f1856583982203d9c56a96f3de862cda6033f084f4c1d9a99a84408/f2py_jit-1.1.1.tar.gz",
    "platform": null,
    "description": "f2py-jit\n==================\n\n[![pypi](https://img.shields.io/pypi/v/f2py-jit.svg)](https://pypi.python.org/pypi/f2py-jit/)\n[![version](https://img.shields.io/pypi/pyversions/f2py-jit.svg)](https://pypi.python.org/pypi/f2py-jit/)\n[![license](https://img.shields.io/pypi/l/f2py-jit.svg)](https://en.wikipedia.org/wiki/GNU_General_Public_License)\n[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/git/https%3A%2F%2Fframagit.org%2Fcoslo%2Ff2py-jit/HEAD?labpath=docs%2Findex.ipynb)\n[![pipeline status](https://framagit.org/coslo/f2py-jit/badges/master/pipeline.svg)](https://framagit.org/coslo/f2py-jit/-/commits/master)\n[![coverage report](https://framagit.org/coslo/f2py-jit/badges/master/coverage.svg)](https://framagit.org/coslo/f2py-jit/-/commits/master)\n\nJust-in-time compilation of Fortran code in Python via [f2py](https://numpy.org/doc/stable/f2py/).\n\nCheck out the [documentation](https://coslo.frama.io/f2py-jit/) for full details.\n\nQuick start\n-----------\n\nStart from a piece of Fortran `code.f90`\n```fortran\nsubroutine hello()\n  print*, \"Hello world!\"\nend subroutine\n```\n\nCompile the code, import it and execute it\n```python\nfrom f2py_jit import jit\nf90 = jit('code.f90')\nf90.hello()\n```\n\nDo the same but from a python string containing the source block\n```python\nsource = \"\"\"\nsubroutine hello()\n  print*, \"Hello world!\"\nend subroutine\n\"\"\"\nf90 = jit(source)\nf90.hello()\n```\n\nIf the Fortran source contains multiple subroutines calling each other, `f2py` will not perform interprocedural optimizations (at least not by default). `f2py_jit` can inline the source code before compiling it, and you will get a [performace boost](https://coslo.frama.io/f2py-jit/tutorial/#performance) [**This feature is experimental**]\n```python\nf90 = jit('code.f90', inline=True)\n```\n\nFeatures\n--------\n- Compilation of Fortran source blocks as Python strings\n- Caching of module builds across executions\n- Support for Fortran derived types via f90wrap\n- Inlining to improve performance (experimental)\n\nDependencies\n------------\n\n- `numpy`\n- Fortran compiler (ex. `gfortran`)\n\nThe package currently supports Python versions from 3.7 to 3.13. \n\nNote that Python versions >= 3.12 will use the `meson` backend to build Fortran extensions, which has slower build times than `distutils` (used by default in versions < 3.12).\n\nInstallation\n------------\nFrom pip\n```\npip install f2py-jit\n```\n\nTo install the package with support for derived types (courtesy of `f90wrap`)\n```\npip install f2py-jit[types]\n```\nNote that this requires Python >= 3.8.\n\nFrom source\n```\ngit clone https://framagit.org/coslo/f2py-jit.git\ncd f2py_jit\npip install .\n```\n\nCredits\n-------\nPart of this code is adapted from `numpy.f2py` module by Pearu Peterson, in accordance with the NumPy license.\n\nAuthors\n-------\nDaniele Coslovich: https://www.units.it/daniele.coslovich/\n",
    "bugtrack_url": null,
    "license": "GPLv3",
    "summary": "Just-in-time Fortran extension builder for Python",
    "version": "1.1.1",
    "project_urls": {
        "documentation": "https://coslo.frama.io/f2py-jit",
        "homepage": "https://framagit.org/coslo/f2py-jit",
        "repository": "https://framagit.org/coslo/f2py-jit"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "902d62ffab53bce78e3a1eeef1c859b297d42ca898960fc33b915203d39acd69",
                "md5": "dc20c2ecb2848e77d0112eddfdad7239",
                "sha256": "1d0c2b47f0cfadd81e8fbee69b9041f6723b07983e4dbd1d40d7e0c619231319"
            },
            "downloads": -1,
            "filename": "f2py_jit-1.1.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "dc20c2ecb2848e77d0112eddfdad7239",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 24919,
            "upload_time": "2024-12-14T21:54:37",
            "upload_time_iso_8601": "2024-12-14T21:54:37.627132Z",
            "url": "https://files.pythonhosted.org/packages/90/2d/62ffab53bce78e3a1eeef1c859b297d42ca898960fc33b915203d39acd69/f2py_jit-1.1.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "e0164c7e9f1856583982203d9c56a96f3de862cda6033f084f4c1d9a99a84408",
                "md5": "97c75512fb848bacfb99f215a0bad8fa",
                "sha256": "3a8ae6cfad3e210728a8911f548f78c47c65c5dbfb9ffe45e705f2296be85867"
            },
            "downloads": -1,
            "filename": "f2py_jit-1.1.1.tar.gz",
            "has_sig": false,
            "md5_digest": "97c75512fb848bacfb99f215a0bad8fa",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 27375,
            "upload_time": "2024-12-14T21:54:42",
            "upload_time_iso_8601": "2024-12-14T21:54:42.082447Z",
            "url": "https://files.pythonhosted.org/packages/e0/16/4c7e9f1856583982203d9c56a96f3de862cda6033f084f4c1d9a99a84408/f2py_jit-1.1.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-12-14 21:54:42",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "f2py-jit"
}
        
Elapsed time: 0.37627s