Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 6 additions & 44 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,69 +9,31 @@ on:
types: [published]

jobs:
build_sdist:
name: Build source distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: actions/setup-python@v5
name: Install Python

- name: Install build dependencies
run: python -m pip install build setuptools

- name: Build sdist
run: python -m build --sdist

- uses: actions/upload-artifact@v4
with:
name: sdist
path: dist/*.tar.gz

build_wheels:
name: Build wheels on ${{ matrix.os }} (${{ matrix.build }})
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
build: [cp39, cp310, cp311, cp312, cp313]
os: [ubuntu-24.04, ubuntu-24.04-arm, windows-2022, windows-11-arm, macos-13, macos-14]

steps:
- uses: actions/checkout@v4

- uses: actions/setup-python@v5

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

- name: Set up QEMU
if: runner.os == 'Linux'
uses: docker/setup-qemu-action@v3
with:
platforms: arm64

- name: Build wheels
run: python -m cibuildwheel --output-dir wheelhouse
env:
CIBW_BUILD: ${{ matrix.build }}-*
CIBW_ARCHS_LINUX: auto aarch64
CIBW_ARCHS_MACOS: universal2
CIBW_TEST_COMMAND: pytest {project}/tests
CIBW_TEST_SKIP: "cp313* *linux_aarch64 *-macosx_universal2:x86_64 *musllinux* *i686 *win32"
uses: pypa/[email protected]

- uses: actions/upload-artifact@v4
with:
name: wheel-${{ matrix.os }}-${{ matrix.build }}
name: wheel-${{ matrix.os }}
path: ./wheelhouse/*.whl

publish:
name: Upload packages to PyPI
needs: [build_wheels, build_sdist]
needs: build_wheels
runs-on: ubuntu-latest
if: github.event_name == 'release' && github.event.action == 'published'
steps:
- uses: actions/download-artifact@v4
- uses: actions/download-artifact@v5
with:
merge-multiple: true
path: dist
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -172,3 +172,4 @@ Icon
Network Trash Folder
Temporary Items
.apdisk
uv.lock
30 changes: 22 additions & 8 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ authors = [
description = "Python package for working with Adobe Photoshop PSD files"
readme = "README.rst"
keywords = ["photoshop", "psd"]
license = { text = "MIT License" }
license = "MIT"
dependencies = [
"typing-extensions;python_version<'3.11'",
"docopt>=0.6.0",
Expand All @@ -26,22 +26,20 @@ dependencies = [
classifiers = [
"Development Status :: 4 - Beta",
"Intended Audience :: Developers",
"License :: OSI Approved :: MIT License",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: 3.14",
"Topic :: Multimedia :: Graphics",
"Topic :: Multimedia :: Graphics :: Viewers",
"Topic :: Multimedia :: Graphics :: Graphics Conversion",
"Topic :: Software Development :: Libraries :: Python Modules",
]
requires-python = ">=3.9"

[project.optional-dependencies]
[dependency-groups]
dev = ["pytest", "pytest-cov", "ipython", "ruff", "types-docopt"]
docs = ["sphinx", "sphinx_rtd_theme"]

Expand All @@ -57,9 +55,25 @@ psd_tools = ["*.pyx"]
[tool.setuptools.dynamic]
version = { attr = "psd_tools.version.__version__" }

[tool.cibuildwheel]
test-requires = ["pytest", "pytest-cov", "ipython"]

[tool.pytest.ini_options]
testpaths = ["tests"]
addopts = "--cov=psd_tools"

[tool.cibuildwheel]
archs = "auto64"
skip = "cp3{9,10}-win_arm64 cp314t-*"
test-skip = "cp39-musllinux_aarch64 *-win_arm64" # SciPy does not provide wheels for these platforms
test-requires = ["pytest", "pytest-cov", "ipython"]
test-command = "pytest {project}/tests"

[[tool.cibuildwheel.overrides]]
select = "cp3{13,14}-{manylinux,musllinux,macos}*"
before-build = "bash tools/configure_abi_tag.sh"

[tool.cibuildwheel.windows]
repair-wheel-command = ["pipx run delvewheel repair -v -w {dest_dir} {wheel}"]

[[tool.cibuildwheel.overrides]]
select = "cp3{13,14}-{manylinux,musllinux,macos}*"
inherit.repair-wheel-command = "append"
repair-wheel-command = "pipx run abi3audit --strict --report {wheel}"
4 changes: 4 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@
"psd_tools.compression._rle",
["src/psd_tools/compression/_rle.pyx"],
extra_compile_args=["/d2FH4-"] if sys.platform == "win32" else [],
define_macros=[("Py_LIMITED_API", 0x03130000)]
if sys.version_info >= (3, 13)
else [],
py_limited_api=True if sys.version_info >= (3, 13) else False,
)
]

Expand Down
4 changes: 2 additions & 2 deletions tests/psd_tools/api/test_layers.py
Original file line number Diff line number Diff line change
Expand Up @@ -534,7 +534,7 @@ def test_clear(group, pixel_layer, type_layer, smartobject_layer, fill_layer):


def test_index(group, pixel_layer, type_layer, smartobject_layer, fill_layer):
with pytest.raises(ValueError, match=r".* is not in list"):
with pytest.raises(ValueError, match=r".* not in list"):
group.index(pixel_layer)

group.extend([pixel_layer, type_layer, smartobject_layer, fill_layer])
Expand All @@ -546,7 +546,7 @@ def test_index(group, pixel_layer, type_layer, smartobject_layer, fill_layer):

group.clear()

with pytest.raises(ValueError, match=r".* is not in list"):
with pytest.raises(ValueError, match=r".* not in list"):
group.index(fill_layer)


Expand Down
9 changes: 9 additions & 0 deletions tools/configure_abi_tag.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/usr/bin/env bash

set -eux

# Add a setup.cfg file to configure the ABI tag for the built wheel.
tee setup.cfg <<EOF
[bdist_wheel]
py_limited_api = cp313
EOF