Skip to content

Commit

Permalink
Version 0.4.2: Update setuptools to use pyproject.toml
Browse files Browse the repository at this point in the history
Still based on Fast Downward 13.06
  • Loading branch information
roeger authored Dec 18, 2024
1 parent c60b6ab commit f12666c
Show file tree
Hide file tree
Showing 5 changed files with 186 additions and 169 deletions.
134 changes: 68 additions & 66 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,99 +3,101 @@ name: Deploy
on: push

jobs:
build-linux:
name: Build linux Python wheels
runs-on: ubuntu-latest
build_wheels_mac_ubuntu:
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
# macos-13 is an intel runner
os: [ubuntu-latest, macos-13]

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Build manylinux Python wheels
uses: RalfG/[email protected]_x86_64
with:
python-versions: 'cp36-cp36m cp37-cp37m'
- uses: actions/checkout@v4

- uses: actions/setup-python@v5

- name: Install build tools
run: python -m pip install --upgrade pip setuptools==75.3.0

- name: Build wheels
uses: pypa/[email protected]
env:
CIBW_SKIP: '*-musllinux_*'

- uses: actions/upload-artifact@master
- uses: actions/upload-artifact@v4
with:
name: linux-wheels
path: dist/*-manylinux*.whl
name: cibw-wheels-${{ matrix.os }}
path: ./wheelhouse/*.whl


build-windows:
name: Build windows Python wheel
runs-on: windows-2022
env:
CC: cl
CXX: cl
# CIBW_BUILD_VERBOSITY: 3
build_wheels_mac_arm64:
name: Build wheels on macos-14
runs-on: macos-14 # apple silicon

steps:
- name: Clone UP Fast Downward repository
uses: actions/checkout@v4

- uses: actions/setup-python@v3

- name: Install cibuildwheel
run: python -m pip install cibuildwheel==2.15.0

- uses: ilammy/msvc-dev-cmd@v1

- name: Build 64-bit wheel
run: python -m cibuildwheel --output-dir dist
- uses: actions/checkout@v4

- uses: actions/setup-python@v5

- name: Install build tools
run: python -m pip install --upgrade pip setuptools==75.3.0

- name: Build wheels
uses: pypa/[email protected]
env:
CIBW_BUILD: cp36-win_amd64
CIBW_REPAIR_WHEEL_COMMAND_MACOS: "" # skip repair step

- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
name: windows-wheel
path: dist/*.whl
name: cibw-wheels-macos-14
path: ./wheelhouse/*.whl


build_wheels_windows:
name: Build wheels on windows-latest
runs-on: windows-latest
env:
CC: cl
CXX: cl

build-mac:
name: Build macOS Python wheel
runs-on: macOS-11
steps:
- uses: actions/checkout@v4

- uses: actions/setup-python@v5

- name: Install build tools
run: python -m pip install --upgrade pip setuptools==75.3.0

- uses: actions/setup-python@v3

- name: Install cibuildwheel
run: python -m pip install cibuildwheel==2.15.0
- uses: ilammy/msvc-dev-cmd@v1

- name: Build wheel
run: python -m cibuildwheel --output-dir dist
- name: Build wheels
uses: pypa/cibuildwheel@v2.22.0
env:
CIBW_ARCHS_MACOS: "x86_64 arm64"
CIBW_BUILD: cp38-win_amd64

- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
name: mac-wheel
path: dist/*.whl
name: cibw-wheels-windows-latest
path: ./wheelhouse/*.whl


run-tox-test:
name: Test wheels
needs: [build-linux, build-mac]
name: Test wheels on mac and linux
needs: [build_wheels_mac_ubuntu, build_wheels_mac_arm64]
runs-on: ${{ matrix.version.os }}
strategy:
matrix:
version:
- {os: ubuntu-20.04, python: '3.8'}
- {os: ubuntu-22.04, python: '3.10'}
- {os: macOS-11, python: '3.10'}
- {os: ubuntu-latest, python: '3.10'}
- {os: macos-13, python: '3.10'}
- {os: macos-14, python: '3.12'}
steps:
- name: Clone repository
uses: actions/checkout@v4

- uses: actions/download-artifact@master
with:
name: linux-wheels
path: dist

- uses: actions/download-artifact@master
with:
name: mac-wheel
name: cibw-wheels-${{ matrix.version.os }}
path: dist

- name: Install Python
Expand All @@ -115,8 +117,8 @@ jobs:
run-tox-test-windows:
name: Test wheels
needs: [build-windows]
name: Test wheels on windows
needs: [build_wheels_windows]
runs-on: ${{ matrix.version.os }}
strategy:
matrix:
Expand All @@ -129,7 +131,7 @@ jobs:

- uses: actions/download-artifact@master
with:
name: windows-wheel
name: cibw-wheels-windows-latest
path: dist

- name: Install Python
Expand All @@ -156,17 +158,17 @@ jobs:
steps:
- uses: actions/download-artifact@master
with:
name: linux-wheels
name: cibw-wheels-ubuntu-latest
path: dist

- uses: actions/download-artifact@master
with:
name: windows-wheel
name: cibw-wheels-windows-latest
path: dist

- uses: actions/download-artifact@master
with:
name: mac-wheel
name: cibw-wheels-macos-13
path: dist

- run: ls dist
Expand Down
3 changes: 3 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
# Release notes
UP Fast Downward 0.4.2
- Update packaging (using pyproject.toml)

UP Fast Downward 0.4.1
- Generate Python wheels compatible with Mac Apple Silicon M1/M2
- Update README.md (current state of development and default configurations)
Expand Down
54 changes: 54 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
[project]
name = "up_fast_downward"
version = "0.4.2"
description = "Unified Planning Integration of the Fast Downward planning system"
readme = {text = "This package makes the [Fast Downward](https://www.fast-downward.org/) planning system available in the [unified_planning library](https://github.com/aiplan4eu/unified-planning).", content-type = "text/markdown"}
requires-python = ">=3.8"
license = {text = "GPL-3.0-only"}
authors = [
{name = "UNIBAS Team"},
]
maintainers = [
{name = "Gabriele Röger", email = "[email protected]"},
]
dependencies = ["setuptools>=59.6.0"]
classifiers = [
"Development Status :: 4 - Beta",
"License :: OSI Approved :: GNU General Public License v3 (GPLv3)",
"Programming Language :: Python :: 3",
"Topic :: Scientific/Engineering :: Artificial Intelligence",
]

[project.urls]
Homepage = "https://github.com/aiplan4eu/up-fast-downward/"

[tool.setuptools]
py-modules = ["up_fast_downward._custom_build"]

[tool.setuptools.packages.find]
where = ["."]
include = ["up_fast_downward"] # ["*"] by default
#find = {}

[tool.setuptools.package-data]
up_fast_downward = [
'fast_downward.py',
'fast_downward_grounder.py',
'utils.py',
'downward/fast-downward.py',
'downward/README.md', 'downward/LICENSE.md',
'downward/builds/release/bin/*',
'downward/builds/release/bin/translate/*',
'downward/builds/release/bin/translate/pddl/*',
'downward/builds/release/bin/translate/pddl_parser/*',
'downward/driver/*', 'downward/driver/portfolios/*'
]

[tool.setuptools.cmdclass]
build_py = "up_fast_downward._custom_build.install_fast_downward"
bdist_wheel = "up_fast_downward._custom_build.bdist_wheel"

[build-system]
requires = ["setuptools>=59.6"]
build-backend = "setuptools.build_meta"

112 changes: 9 additions & 103 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,108 +1,14 @@
#!/usr/bin/env python3
import subprocess
import setuptools
from setuptools import dist

from setuptools import setup
from setuptools.command.build_py import build_py
from setuptools.command.develop import develop
import os
import urllib
import shutil
import sys

try:
from wheel.bdist_wheel import bdist_wheel as _bdist_wheel
class BinaryDistribution(dist.Distribution):
"""This class makes 'bdist_wheel' include an ABI tag on the wheel."""

class bdist_wheel(_bdist_wheel):
def has_ext_modules(self):
return True

def finalize_options(self):
_bdist_wheel.finalize_options(self)
# Mark us as not a pure python package
self.root_is_pure = False

def get_tag(self):
python, abi, plat = _bdist_wheel.get_tag(self)
# We don't link with python ABI, but require python3
python, abi = 'py3', 'none'
return python, abi, plat
except ImportError:
bdist_wheel = None



FAST_DOWNWARD_REPO = 'https://github.com/aibasel/downward.git'
FAST_DOWNWARD_RELEASE = 'release-23.06'
#FAST_DOWNWARD_RELEASE = None
# CHANGESET is ignored if release is not None
FAST_DOWNWARD_CHANGESET = 'bd3c63647a42c9a5f103402615ca991d23a88d55'


def clone_and_compile_fast_downward():
curr_dir = os.getcwd()
print("Cloning Fast Downward repository...")
if FAST_DOWNWARD_RELEASE is not None:
subprocess.run(['git', 'clone', '-b', FAST_DOWNWARD_RELEASE, FAST_DOWNWARD_REPO])
else:
subprocess.run(['git', 'clone', FAST_DOWNWARD_REPO])

shutil.move('downward', 'up_fast_downward/downward')
os.chdir('up_fast_downward/downward')
if FAST_DOWNWARD_RELEASE is None:
subprocess.run(['git', 'checkout', FAST_DOWNWARD_CHANGESET])
print("Building Fast Downward (this can take some time)...")
build = subprocess.run(['python', 'build.py', 'release'],
stdout = subprocess.PIPE, stderr = subprocess.PIPE,
universal_newlines = True)
# print(build.stdout)
# print(build.stderr)
os.chdir(curr_dir)


class install_fast_downward(build_py):
"""Custom install command."""

def run(self):
clone_and_compile_fast_downward()
build_py.run(self)


class install_fast_downward_develop(develop):
"""Custom install command."""
def run(self):
clone_and_compile_fast_downward()
develop.run(self)

long_description = "This package makes the [Fast Downward](https://www.fast-downward.org/) planning system available in the [unified_planning library](https://github.com/aiplan4eu/unified-planning) by the [AIPlan4EU project](https://www.aiplan4eu-project.eu/)."

setup(name='up_fast_downward',
version='0.4.1',
description='Unified Planning Integration of the Fast Downward planning system',
long_description=long_description,
long_description_content_type="text/markdown",
author='UNIBAS Team',
author_email='[email protected]',
url='https://github.com/aiplan4eu/up-fast-downward/',
classifiers=['Development Status :: 4 - Beta',
'License :: OSI Approved :: GNU General Public License v3 (GPLv3)',
'Programming Language :: Python :: 3',
'Topic :: Scientific/Engineering :: Artificial Intelligence'
],
packages=['up_fast_downward'],
package_data={
"": ['fast_downward.py',
'fast_downward_grounder.py',
'utils.py',
'downward/fast-downward.py',
'downward/README.md', 'downward/LICENSE.md',
'downward/builds/release/bin/*',
'downward/builds/release/bin/translate/*',
'downward/builds/release/bin/translate/pddl/*',
'downward/builds/release/bin/translate/pddl_parser/*',
'downward/driver/*', 'downward/driver/portfolios/*']
},
cmdclass={
'bdist_wheel': bdist_wheel,
'build_py': install_fast_downward,
'develop': install_fast_downward_develop,
},
has_ext_modules=lambda: True
)
setuptools.setup(
distclass=BinaryDistribution,
)
Loading

0 comments on commit f12666c

Please sign in to comment.