Before doing any operation, you need to have these requirements installed:
- python 3.9
- pipenv installed in the python above
To manage the dependencies, we use the tool Pipenv. It also creates a virtual environment called venv.
A list of scripts have been created to help developers develop, but you can execute your own
commands from the virtual environment using pipenv run <command>
.
With that done, you can install the dependencies with the following command:
pipenv install --dev
To launch the script, you can use the following command:
pipenv run start
As said previously, it's possible to run the script using python simply with
pipenv run python lawg.py
or creating a python run configuration with PyCharm. In the case you're using the run configuration of PyCharm, you have to checkEmulate terminal in output console
underExecution
settings.
LAWG performs pushes which requires to authenticate to Github or another one. To do this, you have 2 options:
- Generate a Personal Access Token (PAT) on Github and enter it in the configuration file, prefixed with your Github username, separated by ":"
- In this case, LAWG will modify the remote
origin
to add the authentication tuple
Example:
pat: "johndoe:ghp_glfjbdxedgUGKgU4MkjWedCUgb2hwe"
- In this case, LAWG will modify the remote
- Generate an SSH key, add it to Github and enter the path to the key in the configuration file
Example:
ssh_path: /Users/johndoe/.ssh/id_rsa
To check the code, we have chosen prospector which packages a bunch of code quality tools and linters.
To run it, you can use the following command:
pipenv run lint
Prospector reads the file .prospector.yml to configure the checks.
There is also the possibility to run bandit to check security issues:
pipenv run lint-security
To run the tests, you can use the following command:
pipenv run tests
If you want to run tests besides this command, with an IDE like PyCharm, you have to make sure the working directory is the root of the project. On PyCharm, you will be able to set the working directory in the run configuration.
To generate a single file executable, you can use the following command:
pipenv run package
To generate the executable, pyinstaller uses the operating system it's running on. This means that you can only generate a Windows executable file from Windows, etc.
During the generation of the executable, options can be set, as boolean constants in the utils/constant.py file. The different options currently available are the following:
NO_WATCHER
: No changes are automatically committed if set toTrue
NO_SESSION_CLOSURE
: The working directory is not closed if set toTrue
NO_FIX_LIMITATION
: Unlisted questions can be used with the commandFix
if set toTrue
All options are disabled (set to
False
) for the generation of executables available in the releases.