Fython
Documentation
Installation
git clone https://github.com/nicolasessisbreton/fython
cd fython
python3 setup.py install
Dependencies
Platform
Linux
Category: Python / Miscellaneous |
Watchers: 5 |
Star: 38 |
Fork: 1 |
Last update: Feb 5, 2023 |
git clone https://github.com/nicolasessisbreton/fython
cd fython
python3 setup.py install
Linux
Not sure this is working for me. When (load)ing the following program: [Note: github is stripping the indentation in the source below] ` def main: print("Hello world!")
` it generates the following output: compilation_error: compilation error fortran_code_path /home/grassy/fy/src/tst01/tst01/pycache/fycache/gfortran/debug/hello.f90 compilation_error hello.f90:9:1:
call init_frame('home.grassy.fy.src.tst01.tst01.hello:main')
1
Warning: Nonconforming tab character at (1) [-Wtabs]
hello.f90:11:1:
if ( advance_line(2) ) then
1
Warning: Nonconforming tab character at (1) [-Wtabs]
hello.f90:12:1:
call print('Hello world!') ! 2
1
Warning: Nonconforming tab character at (1) [-Wtabs]
hello.f90:14:1:
end if
1
Warning: Nonconforming tab character at (1) [-Wtabs]
hello.f90:11:6:
if ( advance_line(2) ) then
1
Error: IF clause at (1) requires a scalar LOGICAL expression
cmd cd /home/grassy/fy/src/tst01/tst01/pycache/fycache/gfortran/debug gfortran hello.f90 -g -fbacktrace -Wall -fbounds-check -ffpe-trap=zero,overflow -I/home/grassy/fy/fython/fython/traceback/pycache/fycache/gfortran/debug -fpic -c
module home.grassy.fy.src.tst01.tst01.hello
The generated f90 file: ` module home.grassy.fy.src.tst01.tst01.hello use fython.traceback.traceback
implicit none
contains subroutine main() ! 1
call init_frame('home.grassy.fy.src.tst01.tst01.hello:main')
if ( advance_line(2) ) then
call print('Hello world!') ! 2
end if
call del_frame() end subroutine
end module `
suspect paths become screwed:
In [1]: import fython as fy /bin/sh: ifort: command not found
module_not_found Traceback (most recent call last)
/home/grassy/fy/lib/python3.5/site-packages/fython/hello/hello.py in hello() 6 url = 'fython.hello.hello', 7 force = 0, ----> 8 release = 0, 9 ) 10
/home/grassy/fy/lib/python3.5/site-packages/fython/load/load.py in load(url, release, force, verbose, run_main) 18 release = release, 19 force = force, ---> 20 verbose = verbose, 21 ) 22
/home/grassy/fy/lib/python3.5/site-packages/fython/kompile/kompile.py in kompile(url, cwd, release, force, verbose) 11 stack = Stack(release, cwd, force, verbose) 12 ---> 13 stack.load(fytbk.url, cwd) 14 15 stack.load(url, cwd, is_target=1)
/home/grassy/fy/lib/python3.5/site-packages/fython/kompile/stack.py in load(s, url, cwd, fy_parent, is_target) 49 cwd = cwd, 50 ext = exts.importable, ---> 51 release = s.release, 52 ) 53 url.fy_parent = fy_parent
/home/grassy/fy/lib/python3.5/site-packages/fython/config/url.py in init(s, url, cwd, ext, path_only, skip_if_not_found, packagebol, release) 41 s.relative() 42 else: ---> 43 s.fully_qualified() 44 45 def relative(s):
/home/grassy/fy/lib/python3.5/site-packages/fython/config/url.py in fully_qualified(s) 72 return 73 ---> 74 s.throw_module_not_found() 75 76 def set_filename(s, target):
/home/grassy/fy/lib/python3.5/site-packages/fython/config/url.py in throw_module_not_found(s) 199 return 200 else: --> 201 s.throw(err.module_not_found) 202 203 @property
/home/grassy/fy/lib/python3.5/site-packages/fython/config/url.py in throw(s, error) 179 b += 'extensions considered:' 180 b += ', '.join(s.exts) --> 181 raise(error(b)) 182 183 def get_dotted_tree(s):
module_not_found: module not found url fython.traceback.traceback working directory '/home/grassy/fy/lib/python3.5/site-packages/fython/hello' extensions considered: /init.fy, .fy, .f, .fort, .f77, .f90, .f03, .f08, .F, .F77, .F90, .F03, .F08, .FORT, .so, /init.py, .py
Dear Nicolas,
I am not able to understand which Fortran standard(s) Fython supports.
I am developing only in modern idioms (2003 and 2008), so before trying Fyghon I would like to know if Fython support things like abstract type and coarrays.
Thank you very much.
Dear Nicolas,
Great project, my best compliments :clap:
I have already sent a replay on your google clf thread. Here have a question about varisble kind definition:
which are the Fortran kinds that Fython supports?
E.g. if I have a Fortran module defining a math library supporting 32 and 64 bit (like) floats by means of select_real_kind
Fortran built-in, Fython (importing this Fortran module) can handle (distinguish) the two kinds?
Thank you very much for sharing your great work.
My best regards.
Why hybrid language, not Python with type annotations? E.g. like Cython, numba, pythran?
remove parenthesis from print