In Progress

Fortran source code beautifier in Python

I need a Fortran source code beautifier developed in Python.


- case: options

= everything uppercase

= only keywords uppecase

= everything lowercase

= same, but preserve variables that are already mixed case

but: leave comments and strings intact

- indentation: size of indent is a parameter

= if- statement, do- loops, select case- statements

= continued long subroutine calls and long variable declaration list: after continuation lines should be indented as +n wrt starting line,

n=5 (parameter)

- variable declarations: rewrite variable declarations to Fortran 90 style:

integer n, m(10,20)


integer :: n, m(10,20)

same for all other types (real, complex)

option to convert back and forth between

complex*16 complex(8)

real*8 real(8)

integer*8 integer(8)

character*10 str


character(len=10) :: str

Feature to reformat back and forth between F77 fixed format and F90 free source format

(in F77 line continuation character must be '&')

- spacing:

= option of space/no space after ',' in variable declarations, subroutine parameters, etc

= if (stmt1 .and. stmt2) then ...

= spacing arithmetic expressions is same as in all well-established languages (a + b*c), a = 3

= option (default=no spaces) in array dimensions: a(1,2)

= no space in subrotine calls around '(', ')':

call foo(1, b, c(2,3))

= option: space/no space in 'end do enddo', 'end if endif'

In case of doubt follow common sense, refer to Google C++ or Python style guide or ask me.

UPDATE: Additional features
- in case of IMPLICIT REAL*8 (A-H,O-Z) replace by IMPLICIT NONE and construct corresponding explicit variable declarations: all variables used in given subroutine should be grouped by type and explicitly declared

- remove unused variables

NOTE: as example of beautiful Fortran code refer to By the way, as part of CP2K there is Python normalizer which performs good Fortran beautification and can be used as a baseline.

Skills: Fortran, Python

See more: fortran code beautifier, code beautifier fortran, source code indent fortran, fortran source beautifier, Indentation, source format, real expressions, free len, c source code, call source, python end, fortran 90, wrt, str, python strings, len, fortran, convert source code, convert fortran code, code fortran, free source code, python option, source code convert source code, python code convert, need source code

About the Employer:
( 6 reviews ) Moscow, Russian Federation

Project ID: #4498820

Awarded to:


With 3+ years Python and a bit Fortran experience. I can do it.

$231 USD in 5 days
(17 Reviews)

3 freelancers are bidding on average $244 for this job


Sounds like a great project. I would love to get involved with it.

$257 USD in 9 days
(0 Reviews)

Cross platforms code rewrite engineering is among my passionate IT subjects. Based on this clear check-list requirements, I can deliver for you a high quality code as I am teaching it to my students.

$244 USD in 7 days
(0 Reviews)