diff --git a/admin/.gitignore b/admin/.gitignore new file mode 100644 index 00000000..a4d089c1 --- /dev/null +++ b/admin/.gitignore @@ -0,0 +1 @@ +pypi_dist/ diff --git a/admin/build_pypi_packages.sh b/admin/build_pypi_packages.sh new file mode 100755 index 00000000..d29e0407 --- /dev/null +++ b/admin/build_pypi_packages.sh @@ -0,0 +1,58 @@ +#!/bin/bash +set -e + +TAG=develop +if [ "$1" != "" ]; then + TAG=$1 +fi + +cd $(dirname $(readlink -f $0)) + +if ! ../venv/bin/twine -h > /dev/null 2> /dev/null; then + echo "Did not find twine. Please run ../venv/bin/pip install twine" + exit 1 +fi + +if [[ -n $(git status -s) ]]; then + echo "Repository is dirty." + git status -s + exit 1 +fi + +if [[ $(git rev-parse --abbrev-ref HEAD) != ${TAG} && $(git describe --exact-match --tags 2>/dev/null) != ${TAG} ]]; then + echo "Repository is currently not on branch/tag ${TAG}." + exit 1 +fi + +echo "Building sdist and manylinux wheel" +sudo rm -rf ./pypi_dist +docker run --rm -v $(pwd)/..:/problemtools -v $(pwd)/pypi_dist:/dist quay.io/pypa/manylinux_2_28_x86_64 /bin/bash -c " + yum -y install boost-devel gmp-devel ; + mkdir /build ; + cd /build ; + git config --global --add safe.directory /problemtools/.git ; + git clone /problemtools ; + cd problemtools ; + git checkout ${TAG} ; + /opt/python/cp311-cp311/bin/python -m build ; + auditwheel repair dist/problemtools-*.whl ; + cp dist/*.tar.gz /dist ; + cp wheelhouse/*.whl /dist" +sudo chown -R $USER:$USER pypi_dist + +../venv/bin/twine check pypi_dist/* + +echo "Running verifyproblem from wheel on all examples" +TEMPDIR=$(mktemp -d) +python3 -m venv "${TEMPDIR}" +"${TEMPDIR}/bin/pip" install pypi_dist/problemtools*manylinux*whl +shopt -s extglob +if ! "${TEMPDIR}/bin/verifyproblem" ../examples/!(README.md); then + echo "Running verifyproblem on all examples failed. Please review output above to debug." + rm -rf "${TEMPDIR}" + exit 1 +fi +rm -rf "${TEMPDIR}" + +echo "Sucessfully built packages. If you're happy with them, upload:" +echo " ../venv/bin/twine upload --verbose pypi_dist/*" diff --git a/problemtools/py.typed b/problemtools/py.typed new file mode 100644 index 00000000..e69de29b diff --git a/pyproject.toml b/pyproject.toml index 7afdbff5..3a99cedc 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -5,16 +5,13 @@ build-backend = "setuptools.build_meta" [project] name = "problemtools" authors = [ - {name = "Fredrik Niemela", email = "niemela@kattis.com"}, - {name = "Gunnar Kreitz", email = "gkreitz@kattis.com"}, - {name = "Mikael Goldman", email = "migo@kattis.com"}, - {name = "Pehr Söderman", email = "pehrs@kattis.com"}, - {name = "Per Austrin", email = "austrin@kattis.com"}, + {name = "Kattis AB", email = "contact@kattis.com"}, ] description = "Kattis Problem Tools" readme = "README.md" license = "MIT" keywords = ["kattis", "problemtools", "icpc", "clics"] +requires-python = ">= 3.11" dependencies = [ "colorlog", @@ -44,6 +41,7 @@ include = ["problemtools", "problemtools.*"] [tool.setuptools_scm] version_file = "problemtools/_version.py" +local_scheme = "no-local-version" [tool.ruff] line-length = 130