Skip to content

Commit 8a51292

Browse files
Merge branch 'main' into python-version
2 parents 7b3fb07 + 6eb8c78 commit 8a51292

127 files changed

Lines changed: 3318 additions & 1108 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/python-package.yml

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
33

44
name: Python Package
5+
permissions:
6+
contents: read
57

68
on:
79
push:
@@ -18,23 +20,24 @@ jobs:
1820
python-version: [3.9, "3.10", 3.11, 3.12, 3.13]
1921

2022
steps:
21-
- uses: actions/checkout@v5
23+
- name: Checkout
24+
uses: actions/checkout@v6
25+
2226
- name: Set up Python ${{ matrix.python-version }}
2327
uses: actions/setup-python@v6
2428
with:
2529
python-version: ${{ matrix.python-version }}
30+
2631
- name: Install dependencies
2732
run: |
28-
python -m pip install --upgrade pip
29-
python -m pip install flake8 pytest
30-
python -m pip install .
33+
pip install --upgrade pip
34+
pip install .
35+
pip install -r tests/requirements.txt
3136
if [ -f requirements.txt ]; then pip install --no-cache-dir -r requirements.txt; fi
32-
- name: Lint with flake8
37+
38+
- name: Lint with ruff
3339
run: |
34-
# stop the build if there are Python syntax errors or undefined names
35-
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
36-
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
37-
flake8 opengsq --count --exit-zero --max-complexity=10 --max-line-length=221 --statistics --exclude tests
40+
ruff check
3841
# - name: Test with pytest
3942
# run: |
4043
# pytest

.github/workflows/python-publish.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
url: https://pypi.org/p/opengsq
2020

2121
steps:
22-
- uses: actions/checkout@v5
22+
- uses: actions/checkout@v6
2323

2424
- name: Set up Python
2525
uses: actions/setup-python@v6

.github/workflows/sphinx-gh-pages.yml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ jobs:
3535
runs-on: ubuntu-latest
3636
steps:
3737
- name: Checkout
38-
uses: actions/checkout@v5
38+
uses: actions/checkout@v6
3939

4040
- name: Setup Pages
4141
uses: actions/configure-pages@v5
@@ -47,10 +47,9 @@ jobs:
4747

4848
- name: Install sphinx and dependencies
4949
run: |
50-
python -m pip install --upgrade pip
51-
python -m pip install .
52-
python -m pip install -U sphinx
53-
python -m pip install -r docs/requirements.txt
50+
pip install --upgrade pip
51+
pip install .
52+
pip install -r docs/requirements.txt
5453
5554
- name: Sphinx API Documentation Generation
5655
run: sphinx-apidoc -o docs/api opengsq

.vscode/extensions.json

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@
22
"recommendations": [
33
"ms-python.autopep8",
44
"ms-python.vscode-pylance",
5-
"ms-python.python",
6-
"donjayamanne.python-environment-manager",
7-
"njpwerner.autodocstring",
8-
"ms-python.black-formatter"
5+
"ms-python.python"
96
]
107
}

CONTRIBUTING.md

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
# Contributing to `opengsq-python`
2+
3+
Thank you for your interest in contributing to OpenGSQ Python. This guide will help you get started with the contribution process.
4+
5+
## Code of Conduct
6+
7+
This project and everyone participating in it is governed by our [Code of Conduct](/CODE_OF_CONDUCT.md) By participating, you are expected to uphold this code.
8+
9+
## Project Structure
10+
11+
The `opengsq-python` is organized as follows:
12+
13+
- `/docs` - Documentation
14+
- `/opengsq` - Core opengsq library
15+
- `/tests` - Tests
16+
17+
## Development Guidelines
18+
19+
When contributing to `opengsq-python`:
20+
21+
- Keep changes focused. Large PRs are harder to review and unlikely to be accepted. We recommend opening an issue and discussing it with us first.
22+
- Write clear, self-explanatory code. Use comments only when truly necessary.
23+
- Follow the existing code style and conventions.
24+
25+
## Getting Started
26+
27+
1. Fork the repository to your GitHub account
28+
2. Clone your fork locally:
29+
```bash
30+
git clone https://github.com/your-username/opengsq-python.git
31+
cd opengsq-python
32+
```
33+
3. Create a Virtual Python Environment
34+
```bash
35+
python -m venv venv
36+
```
37+
4. Activate the Environment
38+
#### Windows
39+
```bash
40+
venv\Scripts\activate.bat
41+
```
42+
#### Linux, Mac
43+
```bash
44+
source venv/bin/activate
45+
```
46+
6. Install Python dependencies
47+
```bash
48+
pip install -r requirements.txt
49+
```
50+
7. Install Python dependencies (tests)
51+
```bash
52+
pip install -r tests/requirements.txt
53+
```
54+
8. Install Python dependencies (docs)
55+
```bash
56+
pip install -r docs/requirements.txt
57+
```
58+
59+
## Code Formatting with Ruff
60+
61+
We use [Ruff](https://github.com/astral-sh/ruff) for code formatting and linting. Before committing, please ensure your code is properly formatted:
62+
63+
```bash
64+
# Format all code
65+
ruff format
66+
67+
# Check for linting issues
68+
ruff check
69+
```
70+
71+
## Documentation (`/docs`)
72+
73+
1. Sphinx API Documentation Generation
74+
```bash
75+
sphinx-apidoc -o docs/api opengsq
76+
```
77+
78+
2. Sphinx HTML Documentation Build
79+
```bash
80+
sphinx-build -b html docs docs/_build
81+
```
82+
83+
- Keep documentation up-to-date with code changes
84+
- Use clear, concise language
85+
- Include code examples for common use cases
86+
- Document any breaking changes in the migration guide
87+
- Follow the existing documentation style and structure

docs/requirements.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
sphinx==8.2.3
12
sphinx-rtd-theme==3.0.2
23
sphinxcontrib-googleanalytics==0.5
3-
sphinx-docsearch==0.1.0
4+
sphinx-docsearch==0.2.0

docs/tests/protocols/index.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ Protocols Tests
2020
test_gamespy3/index
2121
test_gamespy4/index
2222
test_halo1/index
23+
test_jediknight/index
2324
test_kaillera/index
2425
test_killingfloor/index
2526
test_minecraft/index
@@ -37,6 +38,7 @@ Protocols Tests
3738
test_ssc/index
3839
test_stronghold_ce/index
3940
test_stronghold_crusader/index
41+
test_supcom/index
4042
test_teamspeak3/index
4143
test_toxikk/index
4244
test_trackmania_nations/index
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
.. _test_jediknight:
2+
3+
test_jediknight
4+
===============
5+
6+
.. toctree::
7+
test_get_status
8+
test_get_info
9+
test_protocol_properties
10+
test_get_full_status
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
test_get_full_status
2+
====================
3+
4+
Here are the results for the test method.
5+
6+
.. code-block:: json
7+
8+
{
9+
"info": {
10+
"fdisable": "0",
11+
"wdisable": "0",
12+
"truejedi": "0",
13+
"needpass": "0",
14+
"gametype": "0",
15+
"sv_maxclients": "8",
16+
"clients": "1",
17+
"mapname": "mp/ffa1",
18+
"hostname": "*Jedi*",
19+
"protocol": "26",
20+
"challenge": "xxx",
21+
"gametype_translated": "Free For All"
22+
},
23+
"status": {
24+
"g_siegeTeam2": "none",
25+
"g_siegeTeam1": "none",
26+
"g_siegeRespawn": "20",
27+
"g_weaponDisable": "0",
28+
"g_forcePowerDisable": "0",
29+
"g_forceRegenTime": "200",
30+
"g_jediVmerc": "0",
31+
"g_maxGameClients": "0",
32+
"sv_maxclients": "8",
33+
"g_duelWeaponDisable": "524279",
34+
"g_forceBasedTeams": "0",
35+
"duel_fraglimit": "10",
36+
"g_maxForceRank": "6",
37+
"g_saberLocking": "1",
38+
"g_privateDuel": "1",
39+
"timelimit": "0",
40+
"fraglimit": "1",
41+
"dmflags": "0",
42+
"g_siegeTeamSwitch": "1",
43+
"sv_floodProtect": "1",
44+
"sv_maxPing": "0",
45+
"sv_minPing": "0",
46+
"sv_maxRate": "0",
47+
"sv_hostname": "*Jedi*",
48+
"capturelimit": "0",
49+
"version": "JAmp: v1.0.1.0 win-x86 Oct 24 2003",
50+
"g_maxHolocronCarry": "3",
51+
"g_gametype": "0",
52+
"g_needpass": "0",
53+
"protocol": "26",
54+
"mapname": "mp/ffa1",
55+
"sv_privateClients": "0",
56+
"sv_allowDownload": "0",
57+
"bot_minplayers": "0",
58+
"g_debugMelee": "0",
59+
"g_stepSlideFix": "1",
60+
"g_noSpecMove": "0",
61+
"gamename": "basejka",
62+
"g_allowNPC": "1",
63+
"g_saberWallDamageScale": "0.4",
64+
"bg_fighterAltControl": "0",
65+
"g_showDuelHealths": "0",
66+
"players": [
67+
{
68+
"score": 0,
69+
"ping": 0,
70+
"name": "Padawan"
71+
}
72+
],
73+
"g_gametype_translated": "Free For All"
74+
}
75+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
test_get_info
2+
=============
3+
4+
Here are the results for the test method.
5+
6+
.. code-block:: json
7+
8+
{
9+
"fdisable": "0",
10+
"wdisable": "0",
11+
"truejedi": "0",
12+
"needpass": "0",
13+
"gametype": "0",
14+
"sv_maxclients": "8",
15+
"clients": "1",
16+
"mapname": "mp/ffa1",
17+
"hostname": "*Jedi*",
18+
"protocol": "26",
19+
"challenge": "xxx",
20+
"gametype_translated": "Free For All"
21+
}

0 commit comments

Comments
 (0)