Skip to content

Commit

Permalink
prep for v0.3.1 and for submitting to PyPI
Browse files Browse the repository at this point in the history
  • Loading branch information
pseewald committed Jan 2, 2017
1 parent 814a3ac commit 028c621
Show file tree
Hide file tree
Showing 2 changed files with 114 additions and 3 deletions.
87 changes: 87 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
fprettify
=========

|License: GPL v3|

fprettify is an auto-formatter for modern Fortran code that imposes
strict whitespace formatting.

Features
--------

- Auto-indentation.
- Line continuations are aligned with the previous opening delimiter
``(``, ``[`` or ``(/`` or with an assignment operator ``=`` or
``=>``. If none of the above is present, a default hanging indent is
applied.
- Consistent amount of whitespace around operators and delimiters.
- Removal of extraneous whitespace and consecutive blank lines.
- Works only for modern Fortran (Fortran 90 upwards).
- Tested for editor integration.
- By default, fprettify causes changes in the amount of whitespace only
and thus preserves revision history.

Example
--------

.. code:: fortran
program demo
integer :: endif,if,else
endif=3; if=2
if(endif==2)then
endif=5
else=if+4*(endif+&
2**10)
else if(endif==3)then
print*,endif
endif
end program
⇩⇩⇩⇩⇩⇩⇩⇩⇩⇩ ``fprettify`` ⇩⇩⇩⇩⇩⇩⇩⇩⇩⇩

.. code:: fortran
program demo
integer :: endif, if, else
endif = 3; if = 2
if (endif == 2) then
endif = 5
else = if + 4*(endif + &
2**10)
else if (endif == 3) then
print *, endif
endif
end program
Usage
-----

Autoformat file1, file2, ... inplace by

::

fprettify file1, file2, ...

The default indent is 3. If you prefer something else, use
``--indent n`` argument. For more options, read

::

fprettify -h

For editor integration, use

::

fprettify --silent

For instance, with Vim, use fprettify with ``gq`` by putting the
following commands in your ``.vimrc``:

.. code:: vim
autocmd Filetype fortran setlocal formatprg=fprettify\ --silent
.. |License: GPL v3| image:: https://img.shields.io/badge/License-GPL%20v3-blue.svg
:target: http://www.gnu.org/licenses/gpl-3.0
30 changes: 27 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,37 @@
#!/usr/bin/env python

from setuptools import setup
from codecs import open
from os import path

here = path.abspath(path.dirname(__file__))
with open(path.join(here, 'README.rst'), encoding='utf-8') as f:
long_description = f.read()

setup(name='fprettify',
version='0.3',
version='0.3.1',
description='auto-formatter for modern fortran source code',
author='Patrick Seewald, Ole Schuett, Tiziano Mueller, Mohamed Fawzi',
long_description=long_description,
author='Patrick Seewald',
author_email='[email protected]',
license='GPLv3',
entry_points={'console_scripts': ['fprettify = fprettify:run']},
packages=['fprettify'],
test_suite='fprettify.tests',
install_requires=['future'],
keywords='fortran format formatting auto-formatter indent',
url='https://github.com/pseewald/fprettify',
download_url= 'https://github.com/pseewald/fprettify/archive/v0.3.1.tar.gz',
classifiers=[
'Development Status :: 5 - Production/Stable',
'Intended Audience :: Developers',
'Topic :: Software Development :: Quality Assurance',
'License :: OSI Approved :: GNU General Public License v3 (GPLv3)',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Environment :: Console',
'Operating System :: OS Independent',
]
)

0 comments on commit 028c621

Please sign in to comment.