Skip to content

Commit da34401

Browse files
authored
Merge pull request #338 from Kattis/develop
Merge `develop` into `master`
2 parents 449d853 + 1f9fee7 commit da34401

File tree

148 files changed

+4571
-2500
lines changed

Some content is hidden

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

148 files changed

+4571
-2500
lines changed

.github/workflows/pypi.yml

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
name: Publish python distribution to PyPI and TestPyPI
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
pushTestPyPi:
7+
description: 'Push package to TestPyPi'
8+
required: true
9+
type: boolean
10+
pushPyPi:
11+
description: 'Push package to PyPi'
12+
required: true
13+
type: boolean
14+
15+
jobs:
16+
build-pypi:
17+
runs-on: ubuntu-latest
18+
container:
19+
image: quay.io/pypa/manylinux_2_28_x86_64
20+
steps:
21+
- uses: actions/checkout@v4
22+
with:
23+
fetch-depth: 0 # We need full history for setuptools_scm to figure out version
24+
- name: Set safe directory (work around checkout not doing that properly for containers)
25+
run: git config --global --add safe.directory "$GITHUB_WORKSPACE"
26+
- name: Install build dependencies for checktestdata
27+
run: yum -y install boost-devel gmp-devel
28+
- name: Build sdist (and broken wheel)
29+
run: /opt/python/cp311-cp311/bin/python -m build
30+
- name: Repair wheel
31+
run: auditwheel repair dist/problemtools-*.whl
32+
- name: Replace broken wheel with repaired wheel
33+
run: |
34+
rm -f dist/*.whl
35+
cp wheelhouse/*.whl dist
36+
- name: Store the distribution packages
37+
uses: actions/upload-artifact@v4
38+
with:
39+
name: python-package-distributions
40+
path: dist/
41+
42+
publish-to-testpypi:
43+
name: Publish Python distribution to TestPyPI
44+
needs:
45+
- build-pypi
46+
runs-on: ubuntu-latest
47+
if: ${{ inputs.pushTestPyPi }}
48+
49+
environment:
50+
name: testpypi
51+
url: https://test.pypi.org/p/problemtools
52+
53+
permissions:
54+
id-token: write # IMPORTANT: mandatory for trusted publishing
55+
56+
steps:
57+
- name: Download all the dists
58+
uses: actions/download-artifact@v4
59+
with:
60+
name: python-package-distributions
61+
path: dist/
62+
- name: Publish distribution to TestPyPI
63+
uses: pypa/gh-action-pypi-publish@release/v1
64+
with:
65+
repository-url: https://test.pypi.org/legacy/
66+
67+
publish-to-pypi:
68+
name: Publish Python distribution to PyPI
69+
needs:
70+
- build-pypi
71+
runs-on: ubuntu-latest
72+
if: ${{ inputs.pushPyPi }}
73+
74+
environment:
75+
name: pypi
76+
url: https://pypi.org/p/problemtools
77+
78+
permissions:
79+
id-token: write # IMPORTANT: mandatory for trusted publishing
80+
81+
steps:
82+
- name: Download all the dists
83+
uses: actions/download-artifact@v4
84+
with:
85+
name: python-package-distributions
86+
path: dist/
87+
- name: Publish distribution to TestPyPI
88+
uses: pypa/gh-action-pypi-publish@release/v1

.github/workflows/python-app.yml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
# This workflow will install Python dependencies, run tests and lint
2+
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
3+
4+
name: Python tests
5+
6+
on:
7+
push:
8+
branches: [ "master", "develop" ]
9+
pull_request:
10+
branches: [ "master", "develop" ]
11+
12+
permissions:
13+
contents: read
14+
15+
jobs:
16+
pythontests:
17+
runs-on: ubuntu-latest
18+
strategy:
19+
matrix:
20+
python-version: ["3.11", "3.12", "3.13"] # 3.11 is the lowest we support, since we want StrEnum
21+
container:
22+
image: problemtools/githubci:latest
23+
steps:
24+
- uses: actions/checkout@v4
25+
- name: Set up Python ${{ matrix.python-version }}
26+
uses: actions/setup-python@v5
27+
with:
28+
python-version: ${{ matrix.python-version }}
29+
- name: Install dependencies
30+
run: |
31+
python -m venv venv
32+
venv/bin/python --version
33+
venv/bin/pip install mypy ruff pytest
34+
if [ -f requirements.txt ]; then venv/bin/pip install -r requirements.txt; fi
35+
- name: Lint with ruff
36+
run: venv/bin/ruff check --output-format=github
37+
- name: Check ruff formatting
38+
run: venv/bin/ruff format --check --diff
39+
- name: Test with pytest
40+
run: venv/bin/pytest
41+
- name: Run mypy
42+
run: |
43+
venv/bin/mypy --non-interactive --config-file mypy.ini -p problemtools
44+
45+
packages: # Use a separate job to test debian packaging to speed things up (no need to test this for every python version above)
46+
runs-on: ubuntu-latest
47+
container:
48+
image: problemtools/githubci:latest
49+
steps:
50+
- uses: actions/checkout@v4
51+
with:
52+
submodules: true
53+
- name: Build debian packages
54+
run: |
55+
make builddeb
56+
- name: Install debian package
57+
run: dpkg -i ../kattis-problemtools_*.deb
58+
- name: Verify examples
59+
run: |
60+
shopt -s extglob
61+
verifyproblem examples/!(README.md)
62+
shell: bash

.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
*.pyc
22
*~
3+
*.swp
34
/.cache/
45
/problemtools.egg-info/
56
/support/default_validator/default_validator
67
/support/interactive/interactive
8+
build/
9+
/problemtools/_version.py
10+
11+
venv/
12+
.pytest_cache/
13+
.mypy_cache/

.pre-commit-config.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
repos:
2+
- repo: https://github.com/astral-sh/ruff-pre-commit
3+
rev: v0.11.8
4+
hooks:
5+
- id: ruff
6+
- id: ruff-format

.travis.yml

Lines changed: 0 additions & 5 deletions
This file was deleted.

Dockerfile

Lines changed: 0 additions & 29 deletions
This file was deleted.

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
The MIT License (MIT)
22

3-
Copyright (c) 2010-2019 Kattis and all respective contributors
3+
Copyright (c) Kattis and all respective contributors
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

MANIFEST.in

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11
recursive-include problemtools/config *
22
recursive-include problemtools/templates *
33
recursive-include problemtools/tests *
4+
recursive-include examples *
45
recursive-include support *
6+
recursive-include tests *
7+
global-exclude */__pycache__/*
8+
global-exclude *.pyc
9+
recursive-exclude .github *

Makefile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,7 @@ checktestdata: support/checktestdata/bootstrap
88

99
support/checktestdata/bootstrap:
1010
git submodule update --init
11+
12+
clean:
13+
make -C support clean
14+
rm -rf problemtools.egg-info build

0 commit comments

Comments
 (0)