Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
## Description

## Checklist before merging

* [ ] applied `ready-to-merge` label
* [ ] updated documentation ([README.md](../README.md))
* [ ] updated version number ([pyproject.toml](../pyproject.toml))
4 changes: 2 additions & 2 deletions .github/workflows/define-pylint.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Define Pylint
name: Define pylint

on:
workflow_call:
Expand Down Expand Up @@ -29,7 +29,7 @@ jobs:
run: |
python -m pip install --upgrade pip
pip install pylint
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
if [ -f requirements.txt ]; then pip install --upgrade -r requirements.txt; fi
- name: Analysing the code with pylint
run: |
pylint $(git ls-files '*.py')
14 changes: 9 additions & 5 deletions .github/workflows/define-pytest.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
name: Define Pytest
name: Define pytest

on:
workflow_call:
inputs:
python-version:
required: true
type: string
pytest-args:
required: false
type: string
default: ""

defaults:
run:
Expand All @@ -29,11 +33,11 @@ jobs:
run: |
python -m pip install --upgrade pip
pip install pytest
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
if [ -f requirements.txt ]; then pip install --upgrade -r requirements.txt; fi
- name: Install node
uses: actions/setup-node@v4
with:
node-version: 20
node-version: 22
- name: Install mineflayer
run: |
npm install mineflayer
Expand All @@ -49,6 +53,6 @@ jobs:
touch password.txt
echo $USERNAME >> password.txt
echo $PASSWORD >> password.txt
- name: Run all tests with pytest
- name: Run tests with pytest
run: |
pytest -rs
pytest src -rs --skip-linting ${{ inputs.pytest-args }}
16 changes: 8 additions & 8 deletions .github/workflows/release_package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
pylint:
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13", "3.14"]
uses: ./.github/workflows/define-pylint.yml
with:
python-version: ${{ matrix.python-version }}
Expand All @@ -19,7 +19,7 @@ jobs:
pytest:
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13", "3.14"]
uses: ./.github/workflows/define-pytest.yml
with:
python-version: ${{ matrix.python-version }}
Expand All @@ -29,7 +29,7 @@ jobs:
runs-on: self-hosted
strategy:
matrix:
python-version: ["3.13"]
python-version: ["3.14"]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
Expand All @@ -56,10 +56,10 @@ jobs:
release-tag: ${{ steps.read-tag.outputs.release-tag }}
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.13
- name: Set up Python 3.14
uses: actions/setup-python@v5
with:
python-version: "3.13"
python-version: "3.14"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
Expand All @@ -73,17 +73,17 @@ jobs:
echo "release-tag=$(echo $TAG)" >> $GITHUB_OUTPUT
- uses: mukunku/tag-exists-action@v1.6.0
id: check-tag
with:
with:
tag: ${{ steps.read-tag.outputs.release-tag }}
- name: Fail if tag exists
run: |
echo "Tag ${{ steps.read-tag.outputs.release-tag }} exists!"
exit 1
if: steps.check-tag.outputs.exists == 'true'
if: steps.check-tag.outputs.exists == 'true'
- name: Print tag if it doesn't exist
run: |
echo "Tag ${{ steps.read-tag.outputs.release-tag }} doesn't yet exist and can be created"
if: steps.check-tag.outputs.exists == 'false'
if: steps.check-tag.outputs.exists == 'false'

release:
needs: [pylint, pytest, build, tag]
Expand Down
21 changes: 21 additions & 0 deletions .github/workflows/remove-merge-label.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Remove 'ready to merge' label

on:
pull_request:
types: [closed, synchronize]

permissions:
contents: read
id-token: write
pull-requests: write

jobs:
remove_label:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions-ecosystem/action-remove-labels@v1
if: (github.event.action == 'synchronize') || (github.event.pull_request.merged == true)
with:
labels: 'ready to merge'
fail_on_error: false
26 changes: 26 additions & 0 deletions .github/workflows/run-tests-on-labeled.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Run all tests on label apply

on:
pull_request:
types: [labeled]

jobs:
pylint:
if: github.event.label.name == 'ready to merge'
strategy:
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13", "3.14"]
uses: ./.github/workflows/define-pylint.yml
with:
python-version: ${{ matrix.python-version }}
secrets: inherit

pytest:
if: github.event.label.name == 'ready to merge'
strategy:
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13", "3.14"]
uses: ./.github/workflows/define-pytest.yml
with:
python-version: ${{ matrix.python-version }}
secrets: inherit
7 changes: 4 additions & 3 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: Run Tests

on:
on:
push:
branches: [main]
pull_request:
Expand All @@ -10,7 +10,7 @@ jobs:
pylint:
strategy:
matrix:
python-version: ["3.8", "3.13"]
python-version: ["3.14"]
uses: ./.github/workflows/define-pylint.yml
with:
python-version: ${{ matrix.python-version }}
Expand All @@ -19,7 +19,7 @@ jobs:
pytest:
strategy:
matrix:
python-version: ["3.8", "3.13"]
python-version: ["3.9", "3.14"]
needs: pylint
if: |
(github.event_name == 'push' && github.ref_name == 'main') ||
Expand All @@ -28,4 +28,5 @@ jobs:
uses: ./.github/workflows/define-pytest.yml
with:
python-version: ${{ matrix.python-version }}
pytest-args: "--skip-test-all"
secrets: inherit
19 changes: 9 additions & 10 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
.vscode/
venv*/
testdir/
testdir_persistent/
__pycache__/
mcserverwrapper/test/temp/
*.egg-info/
.pytest_cache/
examples/temp/
dist/
*\__pycache__
*\.pytest_cache
*\.mypy_cache
*\.ruff_cache
*\.vscode
*\venv*
*\dist
*\temp
*.pyc
*.egg-info
password.txt
39 changes: 39 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v6.0.0
hooks:
- id: check-yaml
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/codespell-project/codespell
rev: v2.4.1
hooks:
- id: codespell
files: ^.*\.(py|md|yml)$
exclude: >
(?x)^(
src/test/fuzzy_test.py|
src/test/alg_test.py
)$
additional_dependencies:
- tomli
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.12.10
hooks:
- id: ruff-check
args:
- --fix
- --unsafe-fixes
- repo: https://github.com/pycqa/isort
rev: 6.0.1
hooks:
- id: isort
name: isort (python)
- repo: https://github.com/pycqa/pylint
rev: v3.3.8
hooks:
- id: pylint
args:
- -d import-error
- -sn
21 changes: 16 additions & 5 deletions .pylintrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
[MAIN]
max-line-length=150
[MASTER]

init-hook="from pylint.config import find_default_config_files; import os, sys; sys.path.append(f'{os.path.dirname(next(find_default_config_files()))}/src')"

# ignore=test

[MESSAGES CONTROL]

Expand All @@ -17,11 +20,19 @@ confidence=
# no Warning level messages displayed, use "--disable=all --enable=classes
# --disable=W".
disable=too-many-arguments,
invalid-name,
fixme,
bare-except,
duplicate-code,
too-few-public-methods,
global-statement,
too-many-instance-attributes,
too-many-positional-arguments,
logging-fstring-interpolation,
too-many-branches,
too-many-locals,
broad-exception-raised,
relative-beyond-top-level
global-statement,
wrong-import-order

[FORMAT]

max-line-length=120
28 changes: 28 additions & 0 deletions CODE_STYLE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# CODE STYLE

To allow for a consistent code style within this repository, some rules are enforced.

This file documents these rules.

Note that these are not unchangeable, if given a good reason.

## imports

All imports have to be absolute. This is also enforced in the pre-commit hooks.

## sections order in code files

The order in which imports, constants, ... are defined in python source code files needs to be unified.

The different sections have to follow this order:
* module-level docstring (what does this module do / contain)
* standard library imports (e.g. `import os`)
* third-party imports (e.g. `import numpy as np`)
* local imports (e.g. `from abllib import get_logger`)
* optional modules (e.g. `try_import_module("pykakasi")`)
* pylint comments (which checks to ignore in this file)
* module-level logger
* module-level constants
* everything else

Note that not all sections need to be present.
2 changes: 0 additions & 2 deletions MANIFEST.in

This file was deleted.

Loading