From 72f7697de67eb4a290558ed809b387c195135919 Mon Sep 17 00:00:00 2001 From: Gunnar Kreitz Date: Tue, 22 Apr 2025 10:22:32 +0200 Subject: [PATCH 01/11] Add make clean to clean up support and the mess left by setuptools --- Makefile | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Makefile b/Makefile index 296634e5..bd3337bf 100644 --- a/Makefile +++ b/Makefile @@ -8,3 +8,7 @@ checktestdata: support/checktestdata/bootstrap support/checktestdata/bootstrap: git submodule update --init + +clean: + make -C support clean + rm -rf problemtools.egg-info build From 277e05b3645661509de256edd47891f37f0ffc24 Mon Sep 17 00:00:00 2001 From: Gunnar Kreitz Date: Tue, 22 Apr 2025 10:33:34 +0200 Subject: [PATCH 02/11] Change debian packaging to dh_virtualenv We now package our debian package in a virtualenv, together with our dependencies, to allow us to just use normal pip dependencies instead of waiting for Ubuntu/Debian to package python dependencies for us. This means we now also list our requirements in requirements.txt. This change also bumped debian compat level to the most recent stable version, getting rid of deprecation warnings. --- debian/compat | 1 - debian/control | 4 ++-- debian/kattis-problemtools.links | 3 +++ debian/rules | 16 +++++++++------- requirements.txt | 3 ++- 5 files changed, 16 insertions(+), 11 deletions(-) delete mode 100644 debian/compat create mode 100644 debian/kattis-problemtools.links diff --git a/debian/compat b/debian/compat deleted file mode 100644 index ec635144..00000000 --- a/debian/compat +++ /dev/null @@ -1 +0,0 @@ -9 diff --git a/debian/control b/debian/control index 42797c8b..4ba8bd76 100644 --- a/debian/control +++ b/debian/control @@ -2,13 +2,13 @@ Source: kattis-problemtools Section: devel Priority: optional Maintainer: Per Austrin -Build-Depends: debhelper (>= 8.0.0), g++ (>= 4.8), dh-python, python3, python3-setuptools, python3-pytest, python3-yaml, python3-setuptools, python3-pytest, libboost-regex-dev, libgmp-dev, automake, autoconf +Build-Depends: debhelper-compat (= 13), g++ (>= 4.8), dh-virtualenv, python3, libboost-regex-dev, libgmp-dev, automake, autoconf, git Standards-Version: 3.9.4 Homepage: https://github.com/Kattis/problemtools Package: kattis-problemtools Architecture: any -Depends: ${shlibs:Depends}, ${python3:Depends}, ${misc:Depends}, python3-plastex, python3-pkg-resources, texlive-plain-generic, texlive-fonts-recommended, texlive-latex-extra, texlive-lang-cyrillic, tidy, ghostscript, dvisvgm +Depends: ${shlibs:Depends}, ${misc:Depends}, python3, texlive-plain-generic, texlive-fonts-recommended, texlive-latex-extra, texlive-lang-cyrillic, tidy, ghostscript, dvisvgm Recommends: gcc, g++ Description: Kattis Problem Tools These are tools to manage and verify problem packages in the diff --git a/debian/kattis-problemtools.links b/debian/kattis-problemtools.links new file mode 100644 index 00000000..39354ac1 --- /dev/null +++ b/debian/kattis-problemtools.links @@ -0,0 +1,3 @@ +opt/venvs/kattis-problemtools/bin/verifyproblem usr/bin/verifyproblem +opt/venvs/kattis-problemtools/bin/problem2pdf usr/bin/problem2pdf +opt/venvs/kattis-problemtools/bin/problem2html usr/bin/problem2html diff --git a/debian/rules b/debian/rules index 76a72e36..dd6a9c48 100755 --- a/debian/rules +++ b/debian/rules @@ -4,12 +4,14 @@ # Uncomment this to turn on verbose mode. #export DH_VERBOSE=1 -# Uncomment this to turn off cleanup. -export PYBUILD_DISABLE=clean +%: + dh $@ --with python-virtualenv -export PYBUILD_AFTER_CLEAN=make -C support distclean -export PYBUILD_TEST_PYTEST=1 -export no_proxy=github.com +override_dh_strip: + dh_strip --exclude=/PIL/ --exclude=/pillow.libs/ -%: - dh $@ --with python3 --buildsystem=pybuild +override_dh_shlibdeps: + dh_shlibdeps -X/x86/ -X/PIL/.libs/ -X/pillow.libs/ + +override_dh_dwz: + dh_dwz --exclude=/PIL/ --exclude=/pillow.libs/ diff --git a/requirements.txt b/requirements.txt index ecf975e2..c7dfe198 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1 +1,2 @@ --e . \ No newline at end of file +PyYAML +plasTeX>=3.0 From 07081b77300b1d49a4562b61464d2df2ab93f999 Mon Sep 17 00:00:00 2001 From: Gunnar Kreitz Date: Tue, 22 Apr 2025 10:36:45 +0200 Subject: [PATCH 03/11] Update readme, adjusting installation instructions so we can use pip dependencies --- README.md | 45 ++++++++++++++++++++++++--------------------- 1 file changed, 24 insertions(+), 21 deletions(-) diff --git a/README.md b/README.md index 601de517..6970b3b3 100644 --- a/README.md +++ b/README.md @@ -31,20 +31,15 @@ A few examples of problem packages can be found in [examples](examples). There are four supported ways of installing and running problemtools. (For non-Linux users, "Method 2" below, to use Docker, is probably the least painful.) -### Method 1: Install the Python package +### Method 1: Install the Python package using pipx Run ``` -sudo pip3 install git+https://github.com/kattis/problemtools +pipx install git+https://github.com/kattis/problemtools ``` -Or if you don't want a system-wide installation, -``` -pip3 install --user git+https://github.com/kattis/problemtools -``` -With this second option, in order to get the command line scripts, you need -to make sure that the local user bin path used (e.g., on Linux, -`$HOME/.local/bin`) is in your `$PATH`. +In order to get the command line scripts, you need to make sure that the local +user bin path used (e.g., on Linux, `$HOME/.local/bin`) is in your `$PATH`. In order for problemtools to build and run properly, you also need to have LaTeX and various LaTeX packages installed. See [Requirements and @@ -95,22 +90,30 @@ Hub, these are only updated sporadically for testing purposes and not kept up to date). -### Method 3: Run directly from the repository. +### Method 3: Install into a venv using pip -If you intend to help develop problemtools, or if you just want a -bare-bones way of running them, this is your option. +If you intend to help develop problemtools, if you intend to use problemtools +as a python library, or if you just want a bare-bones way of running them, this +is your option. For this method, you need to clone the repository (just downloading a zip archive of it does not work because the project has submodules that are not included in that zip archive). -In order for the tools to work, you first have to compile the various -support programs, which can be done by running `make` in the root -directory of problemtools. +Start by setting up and activating your venv, e.g., + + python3 -m venv venv + source venv/bin/activate + +For development use, then run: + + pip install -e . + +The commands are now available as -When this is done, you can run the three programs -`bin/verifyproblem.sh`, `bin/problem2pdf.sh`, and -`bin/problem2html.sh` directly from the repository. + venv/bin/verifyproblem + venv/bin/problem2pdf + venv/bin/problem2html See [Requirements and compatibility](#requirements-and-compatibility) below for what other software needs to be installed on your machine in @@ -134,7 +137,7 @@ root of the repository). Apart from the build dependencies listed [below](#ubuntu), building the Debian package requires that the following tools are installed: - debhelper dh-python dpkg-dev + debhelper dh-virtualenv dpkg-dev The package can then be installed using (replace `` as appropriate): @@ -203,11 +206,11 @@ and a LaTeX installation. The dependencies needed to *build/install* problemtools can be installed with: - sudo apt install automake g++ make libboost-regex-dev libgmp-dev libgmp10 libgmpxx4ldbl python3 python3-pytest python3-setuptools python3-yaml python3-plastex + sudo apt install automake g++ make libboost-regex-dev libgmp-dev python3 git And the dependencies needed to *run* problemtools can be installed with: - sudo apt install ghostscript libgmpxx4ldbl python3-minimal python-pkg-resources python3-plastex python3-yaml texlive-fonts-recommended texlive-lang-cyrillic texlive-latex-extra texlive-plain-generic tidy + sudo apt install ghostscript python3 texlive-fonts-recommended texlive-lang-cyrillic texlive-latex-extra texlive-plain-generic tidy dvisvgm ### Fedora From ba36802575a5d73a480bd3299fdb20c39a58e44d Mon Sep 17 00:00:00 2001 From: Gunnar Kreitz Date: Thu, 24 Apr 2025 13:36:20 +0200 Subject: [PATCH 04/11] Convert from setup.py to pyproject.toml (and use setuptools-scm for versioning) --- .gitignore | 1 + problemtools/_version.py | 2 - pyproject.toml | 34 +++++++++++++++ setup.cfg | 5 --- setup.py | 92 +++++++++------------------------------- 5 files changed, 56 insertions(+), 78 deletions(-) delete mode 100644 problemtools/_version.py create mode 100644 pyproject.toml delete mode 100644 setup.cfg diff --git a/.gitignore b/.gitignore index 0a24bfa5..18a3eccb 100644 --- a/.gitignore +++ b/.gitignore @@ -6,6 +6,7 @@ /support/default_validator/default_validator /support/interactive/interactive build/ +/problemtools/_version.py venv/ .pytest_cache/ diff --git a/problemtools/_version.py b/problemtools/_version.py deleted file mode 100644 index 98cf094a..00000000 --- a/problemtools/_version.py +++ /dev/null @@ -1,2 +0,0 @@ -# Auto-generated from git changelog, do not edit! -__version__ = '1.20231016' diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 00000000..1152c3d6 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,34 @@ +[build-system] +requires = ["setuptools >= 77.0.0", "setuptools-scm"] +build-backend = "setuptools.build_meta" + +[project] +name = "problemtools" +authors = [ + {name = "Per Austrin", email = "austrin@kattis.com"}, +] +description = "Kattis Problem Tools" +readme = "README.md" +license = "MIT" +dependencies = [ + "PyYAML", + "plasTeX>=3.0", +] +dynamic = [ "version" ] + +[project.scripts] +verifyproblem = "problemtools.verifyproblem:main" +problem2html = "problemtools.problem2html:main" +problem2pdf = "problemtools.problem2pdf:main" + +[project.urls] +Repository = "https://github.com/Kattis/problemtools" + +[tool.setuptools] +include-package-data = true + +[tool.setuptools.packages.find] +include = ["problemtools", "problemtools.*"] + +[tool.setuptools_scm] +version_file = "problemtools/_version.py" diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index 68d7b004..00000000 --- a/setup.cfg +++ /dev/null @@ -1,5 +0,0 @@ -[aliases] -# Temporarily disabled until we can make it play well with debhelper -# pybuild (issue is that pytest-runner is not available in -# deb-packaged form from standard repos) -#test=pytest diff --git a/setup.py b/setup.py index a10457e0..a68e00ac 100755 --- a/setup.py +++ b/setup.py @@ -1,96 +1,46 @@ #!/usr/bin/env python3 -from setuptools import setup, find_packages -from setuptools.command.bdist_egg import bdist_egg as _bdist_egg -import distutils.cmd -from distutils.command.build import build as _build import os import subprocess +import setuptools +import setuptools.command.build -class BuildSupport(distutils.cmd.Command): + +class BuildSupport(setuptools.Command): """A custom command to build the support programs.""" description = 'build the problemtools support programs' - def initialize_options(self): - pass + build_lib: str | None + + def initialize_options(self) -> None: + self.build_lib = None - def finalize_options(self): - pass + def finalize_options(self) -> None: + self.set_undefined_options('build_py', ('build_lib', 'build_lib')) def run(self): """Run command.""" - # FIXME this seems very fragile... - dest = os.path.join(os.path.realpath(self.distribution.command_obj['build'].build_lib), - 'problemtools', 'support') + dest = os.path.join(os.path.realpath(self.build_lib), 'problemtools', 'support') command = ['make', '-C', 'support', 'install', 'DESTDIR=%s' % dest] - self.announce('Running command: %s' % ' '.join(command), level=distutils.log.INFO) subprocess.check_call(command) - -class bdist_egg(_bdist_egg): - """Updated bdist_egg command that also builds support.""" - - def run(self): - self.run_command('build_support') - _bdist_egg.run(self) - - -class build(_build): +# It's *very* unclear from setuptools' documentation what the best way to do this is. +# +# I think that the ideal way would be to insert BuildSupport as a SubCommand +# (https://setuptools.pypa.io/en/latest/userguide/extension.html), but I cannot find +# any documented way to inject a new subcommand (aside from overwriting one of +# the existing `build_*`, but those are only run conditionally). +class build(setuptools.command.build.build): """Updated build command that also builds support.""" def run(self): self.run_command('build_support') - _build.run(self) + super().run() - -def get_version(): - base_dir = os.path.dirname(__file__) - - __version__ = None - try: - update_script = os.path.join(base_dir, 'admin', 'update_version.py.sh') - __version__ = subprocess.check_output([update_script]).decode('utf-8').strip() - except: - pass - - if __version__ is None: - version_file = os.path.join(base_dir, 'problemtools', '_version.py') - with open(version_file, 'r') as version_in: - exec(version_in.read()) - - return __version__ - - -setup(name='problemtools', - version=get_version(), - description='Kattis Problem Tools', - maintainer='Per Austrin', - maintainer_email='austrin@kattis.com', - url='https://github.com/Kattis/problemtools', - license='MIT', - packages=find_packages(), - entry_points = { - 'console_scripts': [ - 'verifyproblem=problemtools.verifyproblem:main', - 'problem2html=problemtools.problem2html:main', - 'problem2pdf=problemtools.problem2pdf:main', - 'generatedata=problemtools.generatedata:main', - ] - }, - include_package_data=True, - install_requires=[ - 'PyYAML', - 'plasTeX>=3.0;python_version>="3"' - ], -# Temporarily disabled, see setup.cfg -# For now tests can be run manually with pytest -# setup_requires=['pytest-runner'], -# tests_require=['pytest'], - cmdclass={ +setuptools.setup(cmdclass={ 'build_support': BuildSupport, - 'bdist_egg': bdist_egg, - 'build': build + 'build': build, }, ) From 6d14502ecff421106a114557253a83054f199d3c Mon Sep 17 00:00:00 2001 From: Gunnar Kreitz Date: Thu, 24 Apr 2025 14:02:59 +0200 Subject: [PATCH 05/11] Hook sdist to make python -m build work on a clean checkout --- setup.py | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/setup.py b/setup.py index a68e00ac..410e76b6 100755 --- a/setup.py +++ b/setup.py @@ -5,6 +5,7 @@ import setuptools import setuptools.command.build +import setuptools.command.sdist class BuildSupport(setuptools.Command): @@ -21,11 +22,25 @@ def finalize_options(self) -> None: self.set_undefined_options('build_py', ('build_lib', 'build_lib')) def run(self): - """Run command.""" dest = os.path.join(os.path.realpath(self.build_lib), 'problemtools', 'support') command = ['make', '-C', 'support', 'install', 'DESTDIR=%s' % dest] subprocess.check_call(command) +class CheckoutChecktestdata(setuptools.Command): + """A custom command to build the support programs.""" + + description = 'checkout the git submodule for checktestdata (via make)' + + def initialize_options(self) -> None: + pass + + def finalize_options(self) -> None: + pass + + def run(self): + command = ['make', 'checktestdata'] + subprocess.check_call(command) + # It's *very* unclear from setuptools' documentation what the best way to do this is. # # I think that the ideal way would be to insert BuildSupport as a SubCommand @@ -33,14 +48,22 @@ def run(self): # any documented way to inject a new subcommand (aside from overwriting one of # the existing `build_*`, but those are only run conditionally). class build(setuptools.command.build.build): - """Updated build command that also builds support.""" - def run(self): self.run_command('build_support') super().run() +# To make python -m build work from a fresh checkout, we also need to hook sdist to +# do a git submodule checkout so that the source code for checktestdata is included +# in the sdist (an alternative approach would be to include .git in the sdist (eww). +class sdist(setuptools.command.sdist.sdist): + def run(self): + self.run_command('checkout_checktestdata') + super().run() + setuptools.setup(cmdclass={ 'build_support': BuildSupport, 'build': build, + 'checkout_checktestdata': CheckoutChecktestdata, + 'sdist': sdist, }, ) From 530f6d7ff9f64610438049099e90017185d9763b Mon Sep 17 00:00:00 2001 From: Gunnar Kreitz Date: Thu, 24 Apr 2025 14:41:51 +0200 Subject: [PATCH 06/11] Update wrapper scripts and README I could not come up with a good way to reliably make an editable install to work in setuptools in a way that kept our support tooling available. This reverts my earlier change of the README where I intended us to move to using an editable install for development work, and instead just updates our wrapper scripts to make use of a venv to pull in the correct dependencies. --- README.md | 31 +++++++++++++++---------------- bin/.run_in_venv.sh | 19 +++++++++++++++++++ bin/problem2html.sh | 4 +--- bin/problem2pdf.sh | 4 +--- bin/verifyproblem.sh | 4 +--- 5 files changed, 37 insertions(+), 25 deletions(-) create mode 100755 bin/.run_in_venv.sh diff --git a/README.md b/README.md index 6970b3b3..e9cef313 100644 --- a/README.md +++ b/README.md @@ -39,7 +39,9 @@ pipx install git+https://github.com/kattis/problemtools ``` In order to get the command line scripts, you need to make sure that the local -user bin path used (e.g., on Linux, `$HOME/.local/bin`) is in your `$PATH`. +user bin path used (e.g., on Linux, `$HOME/.local/bin`) is in your `$PATH`. See +[pipx' installation instructions](https://pipx.pypa.io/stable/installation/) +for information on how to install `pipx` and set up your `$PATH`. In order for problemtools to build and run properly, you also need to have LaTeX and various LaTeX packages installed. See [Requirements and @@ -90,30 +92,27 @@ Hub, these are only updated sporadically for testing purposes and not kept up to date). -### Method 3: Install into a venv using pip +### Method 3: Run directly from the repository -If you intend to help develop problemtools, if you intend to use problemtools -as a python library, or if you just want a bare-bones way of running them, this -is your option. +If you intend to help develop problemtools, or if you just want a bare-bones +way of running them, this is your option. For this method, you need to clone the repository (just downloading a zip archive of it does not work because the project has submodules that are not included in that zip archive). -Start by setting up and activating your venv, e.g., +Start by setting up your venv, e.g., python3 -m venv venv - source venv/bin/activate + venv/bin/pip install -r requirements.txt -For development use, then run: +In order for the tools to work, you first have to compile the various +support programs, which can be done by running `make` in the root +directory of problemtools. - pip install -e . - -The commands are now available as - - venv/bin/verifyproblem - venv/bin/problem2pdf - venv/bin/problem2html +When this is done, you can run the three programs +`bin/verifyproblem.sh`, `bin/problem2pdf.sh`, and +`bin/problem2html.sh` directly from the repository. See [Requirements and compatibility](#requirements-and-compatibility) below for what other software needs to be installed on your machine in @@ -206,7 +205,7 @@ and a LaTeX installation. The dependencies needed to *build/install* problemtools can be installed with: - sudo apt install automake g++ make libboost-regex-dev libgmp-dev python3 git + sudo apt install python3-venv automake g++ make libboost-regex-dev libgmp-dev python3 git And the dependencies needed to *run* problemtools can be installed with: diff --git a/bin/.run_in_venv.sh b/bin/.run_in_venv.sh new file mode 100755 index 00000000..dce93afb --- /dev/null +++ b/bin/.run_in_venv.sh @@ -0,0 +1,19 @@ +#!/usr/bin/env bash +# +# Helper script for the other wrapper scripts to check that a venv exists, or +# give a helpful message if it doesn't. + +VENVPATH="$(dirname "$(dirname "$(readlink -f "$0")")")/venv" + +if [ ! -x "$VENVPATH/bin/python" ]; then + echo "I could not find a python venv at $VENVPATH." + echo "To use these wrapper scripts, please set up a venv by:" + echo " cd $(dirname "$VENVPATH")" + echo " python3 -m venv venv" + echo " venv/bin/pip install -r requirements.txt" + exit 1 +fi + +export PYTHONPATH +PYTHONPATH="$(dirname "$(dirname "$(readlink -f "$0")")")${PYTHONPATH:+:}$PYTHONPATH" +exec "$VENVPATH/bin/python" -m "$@" diff --git a/bin/problem2html.sh b/bin/problem2html.sh index eaa9d2d9..4068fbb3 100755 --- a/bin/problem2html.sh +++ b/bin/problem2html.sh @@ -5,6 +5,4 @@ # installing problemtools on the system properly, this script should # not be used. -export PYTHONPATH -PYTHONPATH="$(dirname "$(dirname "$(readlink -f "$0")")")${PYTHONPATH:+:}$PYTHONPATH" -exec python3 -m problemtools.problem2html "$@" +exec "$(dirname "$(readlink -f "$0")")/.run_in_venv.sh" problemtools.problem2html "$@" diff --git a/bin/problem2pdf.sh b/bin/problem2pdf.sh index 949c11e8..8995152d 100755 --- a/bin/problem2pdf.sh +++ b/bin/problem2pdf.sh @@ -5,6 +5,4 @@ # installing problemtools on the system properly, this script should # not be used. -export PYTHONPATH -PYTHONPATH="$(dirname "$(dirname "$(readlink -f "$0")")")${PYTHONPATH:+:}$PYTHONPATH" -exec python3 -m problemtools.problem2pdf "$@" +exec "$(dirname "$(readlink -f "$0")")/.run_in_venv.sh" problemtools.problem2pdf "$@" diff --git a/bin/verifyproblem.sh b/bin/verifyproblem.sh index 364d70c8..48ce5407 100755 --- a/bin/verifyproblem.sh +++ b/bin/verifyproblem.sh @@ -5,6 +5,4 @@ # installing problemtools on the system properly, this script should # not be used. -export PYTHONPATH -PYTHONPATH="$(dirname "$(dirname "$(readlink -f "$0")")")${PYTHONPATH:+:}$PYTHONPATH" -exec python3 -m problemtools.verifyproblem "$@" +exec "$(dirname "$(readlink -f "$0")")/.run_in_venv.sh" problemtools.verifyproblem "$@" From a072f3d3fec71d092b6ca3008b25b058503d7db4 Mon Sep 17 00:00:00 2001 From: Gunnar Kreitz Date: Thu, 24 Apr 2025 14:59:48 +0200 Subject: [PATCH 07/11] Update CI workflow to match readme for build requirements (plus build-essentials) --- .github/workflows/python-app.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/python-app.yml b/.github/workflows/python-app.yml index 79b82285..bc33d8d3 100644 --- a/.github/workflows/python-app.yml +++ b/.github/workflows/python-app.yml @@ -26,7 +26,7 @@ jobs: with: python-version: ${{ matrix.python-version }} - name: Install apt packages (for debbuild) - run: sudo apt-get install debhelper dh-python python3-pytest libboost-regex-dev build-essential + run: sudo apt-get install debhelper dh-virtualenv dpkg-dev python3-venv automake g++ make libboost-regex-dev libgmp-dev python3 git build-essential shell: bash - name: Install dependencies run: | From 900106cde0d7f2c9928e1381d70eb159b1065b84 Mon Sep 17 00:00:00 2001 From: Gunnar Kreitz Date: Thu, 24 Apr 2025 15:14:19 +0200 Subject: [PATCH 08/11] Force dh_virtualenv to use builtin venv (debugging CI crash) --- debian/rules | 3 +++ 1 file changed, 3 insertions(+) diff --git a/debian/rules b/debian/rules index dd6a9c48..b03fb50e 100755 --- a/debian/rules +++ b/debian/rules @@ -7,6 +7,9 @@ %: dh $@ --with python-virtualenv +override_dh_virtualenv: + dh_virtualenv --builtin-venv + override_dh_strip: dh_strip --exclude=/PIL/ --exclude=/pillow.libs/ From dc3b704861f4c6543a6126d4170b3da2d7ec3c6f Mon Sep 17 00:00:00 2001 From: Gunnar Kreitz Date: Thu, 24 Apr 2025 15:27:45 +0200 Subject: [PATCH 09/11] Restructure CI/CD to separate deb building from python unit tests This should make things a bit quicker (we can start with python tests without waiting for a ton of apt dependencies) and cheaper (we don't build deb twice). It also seems like *something* confuses dh_virtualenv, I'm starting to suspect actions/setup-python. --- .github/workflows/python-app.yml | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/.github/workflows/python-app.yml b/.github/workflows/python-app.yml index bc33d8d3..64462a66 100644 --- a/.github/workflows/python-app.yml +++ b/.github/workflows/python-app.yml @@ -13,8 +13,7 @@ permissions: contents: read jobs: - build: - + pythontests: runs-on: ubuntu-latest strategy: matrix: @@ -25,9 +24,6 @@ jobs: uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - - name: Install apt packages (for debbuild) - run: sudo apt-get install debhelper dh-virtualenv dpkg-dev python3-venv automake g++ make libboost-regex-dev libgmp-dev python3 git build-essential - shell: bash - name: Install dependencies run: | python -m pip install --upgrade pip @@ -40,10 +36,18 @@ jobs: flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics --exclude examples/ # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics --exclude examples/ - - name: Build debian packages - run: make builddeb - name: Test with pytest run: pytest - name: Run mypy run: | mypy --non-interactive --config-file mypy.ini -p problemtools + + packages: # Use a separate job to test debian packaging to speed things up (no need to test this for every python version above) + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Install apt packages (for debbuild) + run: sudo apt-get install debhelper dh-virtualenv dpkg-dev python3-venv automake g++ make libboost-regex-dev libgmp-dev python3 git build-essential + shell: bash + - name: Build debian packages + run: make builddeb From 461da03b243f6269d182fb437fdb2a9a6cb92b59 Mon Sep 17 00:00:00 2001 From: Gunnar Kreitz Date: Thu, 24 Apr 2025 15:44:07 +0200 Subject: [PATCH 10/11] Stop exposing __version__, users should use importlib.metadata.version instead --- problemtools/__init__.py | 1 - 1 file changed, 1 deletion(-) diff --git a/problemtools/__init__.py b/problemtools/__init__.py index 8dee4bf8..e69de29b 100644 --- a/problemtools/__init__.py +++ b/problemtools/__init__.py @@ -1 +0,0 @@ -from ._version import __version__ From d99b67e28ed96ca318d905d455a3270ce3735a08 Mon Sep 17 00:00:00 2001 From: Gunnar Kreitz Date: Thu, 24 Apr 2025 15:50:37 +0200 Subject: [PATCH 11/11] Hardcode path to python, as dh_virtualenv fails to discover it in CI --- debian/rules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/rules b/debian/rules index b03fb50e..2c10725f 100755 --- a/debian/rules +++ b/debian/rules @@ -8,7 +8,7 @@ dh $@ --with python-virtualenv override_dh_virtualenv: - dh_virtualenv --builtin-venv + dh_virtualenv --builtin-venv --python /usr/bin/python3 override_dh_strip: dh_strip --exclude=/PIL/ --exclude=/pillow.libs/