Thank you for your interest in contributing to Pglet!
git clone https://github.com/pglet/pglet-python
(Invoke-WebRequest -Uri https://raw.githubusercontent.com/pdm-project/pdm/main/install-pdm.py -UseBasicParsing).Content | python -Enable PEP 582:
pdm --pep582
Run refreshenv after installing PDM on Windows or restart terminal.
brew install pdm
Enable PEP 582:
pdm --pep582 >> ~/.zprofile
Restart the terminal session to take effect.
To install all Pglet dependencies and enable the project as editable package run:
pdm install
Run "counter" example:
python3 examples/counter.py
During the first run Pglet Server will be downloaded from GitHub releases to $HOME/.pglet/bin directory and started from there. The version of Pglet Server to download is taken from PGLET_VERSION variable in appveyor.yml in the root of repository.
You should get a new browser window opened with "counter" web app running.
Pytest should be run with pdm run:
pdm run pytest
The project uses Black formatting style. All .py files in a PR must be black-formatted.
IDE-specific Black integration guides:
VS Code includes "isort" by default.
Add the following to user's settings.json :
"[python]": {
"editor.codeActionsOnSave": {
"source.organizeImports": true
}
},
"python.sortImports.args": [
"--trailing-comma",
"--use-parentheses",
"--line-width",
"88",
"--multi-line",
"3",
"--float-to-top"
],All isort command line options can be found here.
pre-commit is a dev dependency of Pglet and is automatically installed by pdm install.
To install the pre-commit hooks run: pre-commit install.
Once installed, everytime you commit, pre-commit will run the configured hooks against changed files.