Skip to content

Commit

Permalink
Merge pull request #17 from ALLAN-DIP/misc-improvements-2024-12-05
Browse files Browse the repository at this point in the history
Miscellaneous improvements
  • Loading branch information
aphedges authored Dec 6, 2024
2 parents 5b721c7 + 73e0f70 commit c6a354d
Show file tree
Hide file tree
Showing 9 changed files with 38 additions and 31 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/checks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
runs-on: ubuntu-22.04 # Pinned version of `ubuntu-latest`
name: Run checks
env:
PYTHON_VERSION: 3.11.10
PYTHON_VERSION: 3.11.11
defaults:
run:
shell: bash -leo pipefail {0}
Expand Down
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@
# See upstream repo for more entries

### Project files
*.sif
/data/
/logs/

### Programming language files
## Java files
Expand Down
18 changes: 9 additions & 9 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# pre-commit autoupdate
default_language_version:
# Use latest LTS release
node: 20.18.0
node: 22.11.0
repos:
- repo: meta
hooks:
Expand Down Expand Up @@ -41,7 +41,7 @@ repos:
- id: requirements-txt-fixer
- id: trailing-whitespace
- repo: https://github.com/sirosen/texthooks
rev: 0.6.7
rev: 0.6.8
hooks:
- id: alphabetize-codeowners
- id: fix-ligatures
Expand All @@ -53,11 +53,11 @@ repos:
hooks:
- id: black
- repo: https://github.com/rbubley/mirrors-prettier # Use maintained fork of official mirror
rev: v3.3.3
rev: v3.4.2
hooks:
- id: prettier
- repo: https://github.com/scop/pre-commit-shfmt
rev: v3.9.0-1
rev: v3.10.0-2
hooks:
- id: shfmt
args: [
Expand All @@ -66,12 +66,12 @@ repos:
--case-indent, # Switch cases will be indented.
]
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.6.9
rev: v0.8.2
hooks:
- id: ruff
args: [--exit-non-zero-on-fix]
- repo: https://github.com/igorshubovych/markdownlint-cli
rev: v0.42.0
rev: v0.43.0
hooks:
- id: markdownlint
- repo: https://github.com/adrienverge/yamllint
Expand All @@ -84,7 +84,7 @@ repos:
hooks:
- id: shellcheck
- repo: https://github.com/rhysd/actionlint
rev: v1.7.3
rev: v1.7.4
hooks:
- id: actionlint
- repo: https://github.com/codespell-project/codespell
Expand All @@ -93,9 +93,9 @@ repos:
- id: codespell
additional_dependencies:
# `tomllib` was added to stdlib in Python 3.11
- tomli==2.0.1 ; python_version < "3.11"
- tomli==2.2.1 ; python_version < "3.11"
- repo: https://github.com/lycheeverse/lychee
rev: lychee-v0.16.1
rev: lychee-v0.17.0
hooks:
- id: lychee
# Only run manually because it can have false positives and spurious failures
Expand Down
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ TAG ?= latest
.PHONY: build
build:
docker build \
--platform linux/amd64 \
--target achilles \
--tag ghcr.io/allan-dip/chiron-utils:$(TAG) \
.
14 changes: 12 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,12 @@ ignore = [
# Most code we work with is not cryptographically sensitive,
# so the `random` module is safe to use
"S311", # suspicious-non-cryptographic-random-usage (from flake8-bandit)
# Allow parsing XML from untrusted sources
# The Python documentation (https://docs.python.org/3.13/library/xml.html#xml-vulnerabilities)
# states that the vulnerabilities are denial-of-service attacks, which are not much of a concern
# to us. In addition, the vulnerabilities are in Expat itself, so these vulnerabilities have been
# patched when using recent versions of the library.
"S314", # suspicious-xml-element-tree-usage (from flake8-bandit)
# Ternary expressions are often less readable than `if`-`else` blocks,
# so they should not be required
"SIM108", # if-else-block-instead-of-if-exp (from flake8-simplify)
Expand Down Expand Up @@ -153,13 +159,17 @@ allow-reexport-from-package = true
# - `missing-module-docstring`, `missing-class-docstring`,
# `missing-function-docstring` when using `pydocstyle`
# Disabled `consider-using-f-string` because handled by `pyupgrade`
# Disabled `logging-not-lazy` because handled by `flake8-logging-format`
# Disabled because handled by `flake8-logging-format`:
# - `logging-format-interpolation`
# - `logging-fstring-interpolation`
# - `logging-not-lazy`
# Disabled `broad-exception-caught` because handled by `flake8-blind-except`
disable = """
R,fixme,no-member,unsupported-membership-test,unsubscriptable-object,
unsupported-assignment-operation,not-an-iterable,too-many-lines,wrong-import-order,
missing-module-docstring,missing-class-docstring,missing-function-docstring,
consider-using-f-string,logging-not-lazy,broad-exception-caught
consider-using-f-string,logging-format-interpolation,logging-fstring-interpolation,logging-not-lazy,
broad-exception-caught
"""

[tool.pylint.reports]
Expand Down
18 changes: 9 additions & 9 deletions requirements-lock.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,26 @@ cfgv==3.4.0
charset-normalizer==3.3.2
coloredlogs==15.0.1
daidepp @ git+https://[email protected]/SHADE-AI/daidepp.git@7f6dcca60f2e6dd89c37862663be7b098cc03794
dill==0.3.8
dill==0.3.9
diplomacy @ git+https://[email protected]/ALLAN-DIP/diplomacy.git@f4ec4517dc5ea3c3ed787d3ad483ce01f4f0e0ea
distlib==0.3.8
filelock==3.15.4
distlib==0.3.9
filelock==3.16.1
humanfriendly==10.0
identify==2.6.0
identify==2.6.3
idna==3.7
iniconfig==2.0.0
isort==5.13.2
mccabe==0.7.0
mypy==1.8.0
mypy-extensions==1.0.0
nodeenv==1.9.1
packaging==24.1
packaging==24.2
parsimonious==0.9.0
platformdirs==4.2.2
platformdirs==4.3.6
pluggy==1.5.0
pre_commit==4.0.1
pylint==3.3.1
pytest==8.3.2
pylint==3.3.2
pytest==8.3.4
python-dateutil==2.9.0.post0
pytz==2024.1
PyYAML==6.0.2
Expand All @@ -38,4 +38,4 @@ tqdm==4.66.5
typing_extensions==4.12.2
ujson==5.10.0
urllib3==2.2.2
virtualenv==20.26.3
virtualenv==20.28.0
4 changes: 2 additions & 2 deletions scripts/run_cicero.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ GAME_COMMAND=(
"$@"
)

mkdir -p logs/
mkdir -p data/logs/
NOW=$(date -u +'%Y_%m_%d_%H_%M_%S')
LOG_FILE=logs/$NOW.txt
LOG_FILE=data/logs/$NOW.txt

time docker run \
--rm \
Expand Down
5 changes: 2 additions & 3 deletions src/chiron_utils/scripts/generate_sbatch.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,9 @@ def main() -> None:
now = datetime.datetime.now(datetime.timezone.utc)
game_id = f"{game_id}_{now.strftime('%Y_%m_%d_%H_%M_%S_%f')}"

log_dir = output_dir / "logs"
log_dir.mkdir(parents=True, exist_ok=True)
data_dir = output_dir
data_dir.mkdir(parents=True, exist_ok=True)
log_dir = data_dir / "logs"
log_dir.mkdir(parents=True, exist_ok=True)
run_cmds = []
powers = sorted(POWER_NAMES_DICT.values())
for cuda_num, power in enumerate(powers):
Expand Down
5 changes: 2 additions & 3 deletions src/chiron_utils/scripts/run_games.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,10 +131,9 @@ def main() -> None:
bot_args += " "
if extra_bot_args is not None:
bot_args += f"{extra_bot_args} "
log_dir = output_dir / "logs" / game_id
log_dir.mkdir(parents=True, exist_ok=True)
data_dir = output_dir / "data"
data_dir.mkdir(parents=True, exist_ok=True)
log_dir = data_dir / "logs" / game_id
log_dir.mkdir(parents=True, exist_ok=True)
powers = sorted(POWER_NAMES_DICT.values())
run_cmds = []
for power in powers:
Expand Down

0 comments on commit c6a354d

Please sign in to comment.