108 lines
3.1 KiB
Markdown
108 lines
3.1 KiB
Markdown
# Contribution
|
|
|
|
## Requirements
|
|
|
|
- Python 3.11
|
|
- Git CLI installed
|
|
- Python, pip and git are all available as command-line commands (add to the path if needed)
|
|
|
|
Virtual environment will be created in *PyfaEnv* folder. Project will be cloned and run from the *PyfaDEV* folder. Separate virtual environment will be created so required libraries won't clutter the main python installation.
|
|
|
|
> Commands and screens were created on Windows 10. Please, update all the paths according to your OS.
|
|
|
|
## Setting up the project manually
|
|
|
|
Clone the repository
|
|
```
|
|
git clone <repo> PyfaDEV
|
|
```
|
|
|
|
Create the virtual environment
|
|
```
|
|
python -m venv PyfaEnv
|
|
```
|
|
|
|
Activate the virtual environment
|
|
|
|
```
|
|
For cmd.exe: PyfaEnv\scripts\activate.bat
|
|
For bash: source <venv>/Scripts/activate
|
|
```
|
|
> For other OS check [Python documentation](https://docs.python.org/3/library/venv.html)
|
|
|
|
Install requirements for the project from *requirements.txt*
|
|
```
|
|
pip install -r PyfaDEV\requirements.txt
|
|
```
|
|
> For some Linux distributions, you may need to install separate wxPython bindings, such as `python-matplotlib-wx`
|
|
|
|
Check that the libs from *requirements.txt* are installed
|
|
```
|
|
pip list
|
|
```
|
|
|
|
Build translations and database:
|
|
```
|
|
python scripts\compile_lang.py
|
|
python db_update.py
|
|
```
|
|
|
|
Test that the project is starting properly
|
|
```
|
|
python PyfaDEV\pyfa.py
|
|
```
|
|
|
|
|
|
## Setting up the project with PyCharm/IntelliJ
|
|
|
|
Install PyCharm / Other IntelliJ product with Python plugin
|
|
|
|
After launching - select *Check out from Version Control* -> *GIt*
|
|
|
|

|
|
|
|
Login to GitHub, paste the repo URL and select the folder to which to clone the project into, press *Clone*.
|
|
|
|

|
|
|
|
After process is complete, open *File* -> *Settings* -> *Project* -> *Project Interpreter*.
|
|
|
|

|
|
|
|
Press on options and add new virtual environment.
|
|
|
|

|
|
|
|
Open project tree view and double-click on the *requirements.txt*. Press *Install requirements*. Install all requirements.
|
|
|
|

|
|
|
|
Create new *Run Configuration*. Set correct *Script path* and *Python interpreter*.
|
|
|
|

|
|
|
|
Check that the project is starting properly.
|
|
|
|
## Running tests
|
|
|
|
Switch to the proper virtual environment
|
|
```
|
|
For cmd.exe: PyfaEnv\scripts\activate.bat
|
|
For bash: source <venv>/Scripts/activate
|
|
```
|
|
|
|
Install pytest
|
|
```
|
|
pip install pytest
|
|
```
|
|
|
|
Switch to pyfa directory.
|
|
|
|
Run tests (any will do)
|
|
```
|
|
python -m pytest
|
|
py.test
|
|
```
|
|
|
|
More information on tests can be found on appropriate [Wiki page](https://github.com/pyfa-org/Pyfa/wiki/Developers:-Writing-Tests-for-Pyfa).
|