Skip to content

Commit

Permalink
Merge branch 'randovania:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
Nystrata authored Dec 9, 2024
2 parents 9c0a79a + 3ec8801 commit d8040c8
Show file tree
Hide file tree
Showing 54 changed files with 1,640 additions and 1,416 deletions.
7 changes: 7 additions & 0 deletions .github/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
changelog:
exclude:
labels:
- ignore-for-release
authors:
- pre-commit-ci
- dependabot
20 changes: 20 additions & 0 deletions .github/workflows/dependency.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Dependency auto-merge
on: pull_request_target

permissions:
contents: write
pull-requests: write

jobs:
dependency:
runs-on: ubuntu-latest
if: ${{ github.actor == 'dependabot[bot]' || github.actor == 'pre-commit-ci[bot]' }}
steps:
- name: Enable auto-merge for Dependency PRs
run: gh pr merge --auto --merge "$PR_URL"
env:
PR_URL: ${{github.event.pull_request.html_url}}
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}

- name: Automatically approve the PR
uses: hmarr/auto-approve-action@v4
9 changes: 6 additions & 3 deletions .github/workflows/python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ name: Python Package

on:
pull_request:
merge_group:
push:
branches:
- '*'
- main
tags:
- '*'

Expand Down Expand Up @@ -49,6 +50,8 @@ jobs:
python:
- {version: '3.10', wheel: 'cp310-cp310'}
- {version: '3.11', wheel: 'cp311-cp311'}
- {version: '3.12', wheel: 'cp312-cp312'}
- {version: '3.13', wheel: 'cp313-cp313'}

steps:
- name: Checkout
Expand Down Expand Up @@ -102,10 +105,10 @@ jobs:

- name: Run Tests
run:
venv/bin/python -m pytest --cov src --cov-report=xml --durations=100
venv/bin/python -m pytest --cov src --cov-report=xml --durations=100 -n 4

- name: codecov
uses: codecov/codecov-action@v4
uses: codecov/codecov-action@v5
with:
fail_ci_if_error: false
files: ./coverage.xml
Expand Down
5 changes: 3 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.5.5
rev: v0.8.0
hooks:
- id: ruff
args: [ --fix, --exit-non-zero-on-fix ]
args: [ --fix, --exit-non-zero-on-fix ]
- id: ruff-format
30 changes: 26 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,14 @@ classifiers = [
"Intended Audience :: Developers",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
]
requires-python = ">=3.10"
dynamic = ["version"]

dependencies = [
"retro-data-structures>=0.23.0",
"retro-data-structures>=0.28.0",
"jsonschema>=4.0.0",
"ppc-asm",
"py_randomprime", # for Prime 1 symbols
Expand All @@ -35,6 +37,7 @@ test = [
"pytest",
"pytest-cov",
"pytest-mock",
"pytest-xdist",
"pre-commit",
]

Expand Down Expand Up @@ -65,8 +68,27 @@ filterwarnings = [

[tool.ruff]
line-length = 120
select = ["E", "F", "W", "C90", "I", "UP"]
target-version = "py310"
src = ["src"]

# Version to target for generated code.
target-version = "py310"
[tool.ruff.lint]
select = [
"E", "F", "W", "C90", "I", "UP", "C4",
"RSE",
"TCH",
"PTH",
"COM818", "COM819",
"ISC",
"PIE",
"PT",

"PLC",

"PLE",
"PLR0402", "PLR1701", "PLR1711", "PLR1722", "PLR0206",
"PLR0133", "PLR0124",
"PLW",
]
extend-ignore = [
"ISC001", # may cause conflicts with formatter
]
6 changes: 4 additions & 2 deletions src/open_prime_rando/__pyinstaller/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import os
from pathlib import Path

# Functions
# =========
Expand All @@ -13,5 +14,6 @@
# This function returns a list containing only the path to this
# directory, which is the location of these hooks.

def get_hook_dirs():
return [os.path.dirname(__file__)]

def get_hook_dirs() -> list[str]:
return [os.fspath(Path(__file__).parent)]
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

# https://pyinstaller.readthedocs.io/en/stable/hooks.html#provide-hooks-with-package

datas = collect_data_files('open_prime_rando', excludes=['__pyinstaller'])
datas = collect_data_files("open_prime_rando", excludes=["__pyinstaller"])
hiddenimports = [
f"open_prime_rando.echoes.asset_ids{module_name}"
for module_name in open_prime_rando.echoes.asset_ids.world._DEDICATED_FILES.values()
Expand Down
62 changes: 31 additions & 31 deletions src/open_prime_rando/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,45 +17,45 @@ def create_parser():
parser = argparse.ArgumentParser()
parser.add_argument("--game", required=True, choices=sorted(_game_to_patcher.keys()))
input_group = parser.add_mutually_exclusive_group(required=True)
input_group.add_argument("--input-paks", type=Path,
help="Path to where the paks to randomize")
input_group.add_argument("--input-iso", type=Path,
help="Path to a ISO to randomize")
parser.add_argument("--output-paks", required=True, type=Path,
help="Path to where the modified paks will be written to.")
parser.add_argument("--input-json", type=Path, required=True,
help="Path to the configuration json.")
input_group.add_argument("--input-paks", type=Path, help="Path to where the paks to randomize")
input_group.add_argument("--input-iso", type=Path, help="Path to a ISO to randomize")
parser.add_argument(
"--output-paks", required=True, type=Path, help="Path to where the modified paks will be written to."
)
parser.add_argument("--input-json", type=Path, required=True, help="Path to the configuration json.")
return parser


def setup_logging():
handlers = {
'default': {
'level': 'DEBUG',
'formatter': 'default',
'class': 'logging.StreamHandler',
'stream': 'ext://sys.stdout', # Default is stderr
"default": {
"level": "DEBUG",
"formatter": "default",
"class": "logging.StreamHandler",
"stream": "ext://sys.stdout", # Default is stderr
},
}
logging.config.dictConfig({
'version': 1,
'formatters': {
'default': {
'format': '[%(asctime)s] [%(levelname)s] [%(name)s] %(funcName)s: %(message)s',
}
},
'handlers': handlers,
'disable_existing_loggers': False,
'loggers': {
'default': {
'level': 'DEBUG',
logging.config.dictConfig(
{
"version": 1,
"formatters": {
"default": {
"format": "[%(asctime)s] [%(levelname)s] [%(name)s] %(funcName)s: %(message)s",
}
},
},
'root': {
'level': 'DEBUG',
'handlers': list(handlers.keys()),
},
})
"handlers": handlers,
"disable_existing_loggers": False,
"loggers": {
"default": {
"level": "DEBUG",
},
},
"root": {
"level": "DEBUG",
"handlers": list(handlers.keys()),
},
}
)
logging.info("Hello world.")


Expand Down
Loading

0 comments on commit d8040c8

Please sign in to comment.