This is an old revision of the document!


Python Filetype (Enhanced)

Geany supports Python by default. However, replacing the existing ~/.config/geany/filedefs/filetypes.python with the below code will provide additional “Build” tools and highlighting.

filetypes.python
# For complete documentation of this file, please see Geany's main documentation
[styling]
default=default
commentline=comment_line
number=number_1
string=string_1
character=character
word=keyword_1
triple=string_2
tripledouble=string_2
classname=type
defname=function
operator=operator
identifier=identifier_1
commentblock=comment
stringeol=string_eol
word2=keyword_2
decorator=decorator
 
[keywords]
# all items must be in one line
primary=and as assert break class continue def del elif else except exec finally for from global if import in is lambda not or pass print raise return try while with yield False None True
identifiers=ArithmeticError AssertionError AttributeError BaseException BufferError BytesWarning DeprecationWarning EOFError Ellipsis EnvironmentError Exception FileNotFoundError FloatingPointError FutureWarning GeneratorExit IOError ImportError ImportWarning IndentationError IndexError KeyError KeyboardInterrupt LookupError MemoryError NameError NotImplemented NotImplementedError OSError OverflowError PendingDeprecationWarning ReferenceError RuntimeError RuntimeWarning StandardError StopIteration SyntaxError SyntaxWarning SystemError SystemExit TabError TypeError UnboundLocalError UnicodeDecodeError UnicodeEncodeError UnicodeError UnicodeTranslateError UnicodeWarning UserWarning ValueError Warning ZeroDivisionError __debug__ __doc__ __import__ __name__ __package__ abs all any apply basestring bin bool buffer bytearray bytes callable chr classmethod cmp coerce compile complex copyright credits delattr dict dir divmod enumerate eval execfile exit file filter float format frozenset getattr globals hasattr hash help hex id input int intern isinstance issubclass iter len license list locals long map max memoryview min next object oct open ord pow print property quit range raw_input reduce reload repr reversed round set setattr slice sorted staticmethod str sum super tuple type unichr unicode vars xrange zip
 
[lexer_properties]
fold.comment.python=1
fold.quotes.python=1
 
[settings]
# default extension used when saving files
extension=py
 
# MIME type
mime_type=text/x-python
comment_single=#
comment_open="""
comment_close="""
comment_use_indent=true
 
# context action command (please see Geany's main documentation for details)
context_action_cmd=
 
[indentation]
width=4
# 0 is spaces, 1 is tabs, 2 is tab & spaces
type=0
 
[build_settings]
# %f will be replaced by the complete filename
# %e will be replaced by the filename without extension
# (use only one of it at one time)
compiler=python -m py_compile "%f"
run_cmd=python "%f"
 
[build-menu]
FT_00_LB=_Flake8
FT_00_CM=flake8 --jobs=1 --ignore=E501 -v --max-complexity 10  --exclude=.svn,CVS,.bzr,.hg,.git,__pycache__,__init__.py,__init__ --show-pep8 --show-source "%d/%f"
FT_00_WD=
FT_01_LB=
FT_01_CM=
FT_01_WD=
FT_02_LB=Build PyOpt
FT_02_CM=python3 -Sq -OO -m py_compile "%d/%f"
FT_02_WD=
EX_00_LB=Terminal Exec
EX_00_CM=gnome-terminal -t "Python Test" -e "bash -c \\"python3 -Sq %f; echo''; echo ''; echo 'Hit ENTER when done'; read\\""
EX_00_WD=
error_regex=([^:]+):([0-9]+):([0-9:]+)? .*
EX_01_LB=PyExecute
EX_01_CM=python3 -Sq "%d/%f"
EX_01_WD=
Print/export