• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

AI/H01-Aug-2021-22,11517,218

auth/H01-Aug-2021-8569

chat/H01-Aug-2021-4329

common/H01-Aug-2021-1,048808

handlers/H01-Aug-2021-165132

stub_generator/H01-Aug-2021-764577

tests/H01-Aug-2021-840607

turn_events/H01-Aug-2021-7249

universe_generation/H01-Aug-2021-3,2572,218

README.mdH A D01-Aug-20212.2 KiB6348

freeorion.pyiH A D01-Aug-202163.1 KiB2,8982,014

tox.iniH A D01-Aug-2021681 2622

README.md

1# python directory
2
3Python scripts, while modifiable, may require specific functions which return
4an appropriate response to FreeOrion.
5For example, turn_events/turn_events.py is a required file and should define
6an execute_turn_events() function returning a boolean (successful completion).
7
8## Contents
9
10* AI/  -  Python code which controls the computer players.  This is a
11sub-module of the resource directory and can be changed with the --ai-path flag.
12* auth/  -  Python code which manages auth information stored either in a file
13or in a database.
14* chat/  -  Python code which manages chat history stored either in a file or in
15a database.
16* common/  -  Common files for code utilized by both the AI and the server.
17* handlers/  -  see handlers/README.md
18* turn_events/  -  Python scripts that run at the beginning of every turn, and
19can trigger events that would be impossible to do purely in FOCS.
20* universe_generation/  -  Python scripts that get run at the beginning of the
21game and create the galaxy. You can customise the galaxy generation by
22editing options.py and universe_tables.py, both of which have more information
23in comments over there. The latter, specifically, controls which star types,
24planet types, planet sizes, and also other content get placed.
25
26# Code style check
27
28Each PR will be checked automatically, but you still can run checks manually.
29Fixing all issues are mandatory before merging PR.
30
31We use [flake8-putty](https://pypi.python.org/pypi/flake8-putty)
32which include [flake8](https://pypi.python.org/pypi/flake8)
33which include [pycodestyle](https://pypi.python.org/pypi/pycodestyle) and other tools.
34
35`flake8-putty` is `flake8` plugin that allows one to disable one or more rules for a certain file,
36see `putty-ignore` section in `tox.ini`. This allows ignoring certain
37warnings only for specified files, like bare excepts, that are hard to fix,
38or special files with tables.
39
40## TODO section
41
42See TODO section in tox.ini
43
44## Install dependencies
45
46```sh
47pip install flake8-putty
48```
49
50## Run checks
51This script should be run from directory where `tox.ini` located
52
53```sh
54cd default/python
55flake8
56```
57
58This script should be run from directory where `mypi.ini` located
59```sh
60cd default/python
61mypy --config-file mypy.ini
62```
63