Skip to content

Commit

Permalink
Merge pull request ModOrganizer2#113 from ModOrganizer2/python311
Browse files Browse the repository at this point in the history
Updates for Python 3.11 compatibility
  • Loading branch information
Holt59 committed Sep 24, 2023
2 parents 5fe30fe + 5c84ee6 commit adcd06d
Show file tree
Hide file tree
Showing 63 changed files with 1,223 additions and 731 deletions.
38 changes: 20 additions & 18 deletions .github/workflows/linters.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,24 @@ on: [push, pull_request]
jobs:
checks:
runs-on: ubuntu-latest
strategy:
max-parallel: 4
matrix:
python-version: [3.8]

steps:
- uses: actions/checkout@v1
with:
path: basic_games
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install tox
- name: Test with tox
run: tox -e py38-lint
- uses: actions/checkout@v4
with:
path: "basic_games"
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.11
- uses: abatilo/actions-poetry@v2
- name: Install
run: |
cd basic_games
poetry install
- name: Lint
run: |
cd basic_games
poetry run black . --check --diff
poetry run isort -c .
poetry run mypy .
poetry run ruff .
poetry run pyright .
22 changes: 21 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Download the archive for your MO2 version and extract it directly into your MO2
**Important:** Extract the *folder* in your `plugins` folder, not the individual files. Your
`plugins` folder should look like this:

```
```text
dlls/
plugins/
data/
Expand Down Expand Up @@ -195,3 +195,23 @@ Game IDs can be found here:
- For Legendary (alt. Epic launcher) via command `legendary list-games`
or from: `%USERPROFILE%\.config\legendary\installed.json`
- For EA Desktop from `<EA Games install location>\<game title>\__Installer\installerdata.xml`

## Contribute

We recommend using a dedicated Python environment to write a new basic game plugins.

1. Install the required version of Python --- Currently Python 3.11 (MO2 2.5).
2. Remove the repository at `${MO2_INSTALL}/plugins/basic_games`.
3. Clone this repository at the location of the old plugin (
`${MO2_INSTALL}/plugins/basic_games`).
4. Place yourself inside the cloned folder and:

```bash
# create a virtual environment (recommended)
py -3.11 -m venv .\venv
.\venv\scripts\Activate.ps1

# "install" poetry and the development package
pip install poetry
poetry install
```
3 changes: 1 addition & 2 deletions __init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# -*- encoding: utf-8 -*-
# pyright: reportUnboundVariable=false

import glob
import importlib
Expand All @@ -17,7 +17,6 @@


def createPlugins():

# List of game class from python:
game_plugins: typing.List[BasicGame] = []

Expand Down
6 changes: 3 additions & 3 deletions basic_features/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# -*- encoding: utf-8 -*-
from .basic_mod_data_checker import BasicModDataChecker
from .basic_save_game_info import BasicGameSaveGameInfo

from .basic_mod_data_checker import BasicModDataChecker # noqa
from .basic_save_game_info import BasicGameSaveGameInfo # noqa
__all__ = ["BasicModDataChecker", "BasicGameSaveGameInfo"]
Loading

0 comments on commit adcd06d

Please sign in to comment.