diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 13dbbe4..75a4942 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -1,131 +1,159 @@ +# This file is autogenerated by maturin v1.3.0 +# To update, run +# +# maturin generate-ci github --pytest +# name: CI on: push: - branches: [ main ] + branches: + - main + - master + tags: + - '*' pull_request: - branches: [ main ] - release: - types: [published] + workflow_dispatch: -concurrency: - group: ${{ github.head_ref || github.run_id }} - cancel-in-progress: true +permissions: + contents: read jobs: - test: - runs-on: ${{ matrix.os }} - strategy: - matrix: - os: [ubuntu-latest, macos-latest, windows-latest] - python-version: ['3.7', '3.10'] - steps: - - uses: actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: stable - override: true - - uses: actions/checkout@v3 - - uses: actions/cache@v3 - with: - path: | - ~/.cargo/bin/ - ~/.cargo/registry/index/ - ~/.cargo/registry/cache/ - ~/.cargo/git/db/ - target/ - key: ${{ runner.os }}-python-${{ matrix.python-version }}-cargo-${{ hashFiles('**/Cargo.lock') }} - - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python-version }} - cache: 'pip' - cache-dependency-path: 'Pipfile.lock' - - name: pip install pipenv - run: pip install -U pip pipenv - - name: pipenv install - run: pipenv install --dev --python ${{ matrix.python-version }} - - run: pipenv run maturin develop - - run: pipenv run pytest - - run: pipenv run maturin sdist -o dist - if: ${{ matrix.os == 'ubuntu-latest' && matrix.python-version == '3.10' }} - - name: Upload wheels - if: ${{ matrix.os == 'ubuntu-latest' && matrix.python-version == '3.10' }} - uses: actions/upload-artifact@v3 - with: - name: wheels - path: dist - linux: runs-on: ubuntu-latest - needs: test strategy: matrix: - python-version: ['3.7', '3.8', '3.9', '3.10', '3.11'] + target: [x86_64, x86, aarch64, armv7, s390x, ppc64le] steps: - - uses: actions/checkout@v3 - - uses: PyO3/maturin-action@v1 - with: - manylinux: auto - command: build - args: --release -o dist -i python${{ matrix.python-version }} - - name: Upload wheels - uses: actions/upload-artifact@v3 - with: - name: wheels - path: dist + - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 + with: + python-version: '3.10' + - name: Build wheels + uses: PyO3/maturin-action@v1 + with: + target: ${{ matrix.target }} + args: --release --out dist --find-interpreter + sccache: 'true' + manylinux: auto + - name: Upload wheels + uses: actions/upload-artifact@v3 + with: + name: wheels + path: dist + - name: pytest + if: ${{ startsWith(matrix.target, 'x86_64') }} + shell: bash + run: | + set -e + pip install pyoxipng --find-links dist --force-reinstall + pip install pytest + pytest + - name: pytest + if: ${{ !startsWith(matrix.target, 'x86') && matrix.target != 'ppc64' }} + uses: uraimo/run-on-arch-action@v2.5.0 + with: + arch: ${{ matrix.target }} + distro: ubuntu22.04 + githubToken: ${{ github.token }} + install: | + apt-get update + apt-get install -y --no-install-recommends python3 python3-pip + pip3 install -U pip pytest + run: | + set -e + pip3 install pyoxipng --find-links dist --force-reinstall + pytest windows: runs-on: windows-latest - needs: test strategy: matrix: - python-version: ['3.7', '3.8', '3.9', '3.10', '3.11'] + target: [x64, x86] steps: - - uses: actions/checkout@v3 - - uses: PyO3/maturin-action@v1 - with: - command: build - args: --release -o dist -i python${{ matrix.python-version }} - - name: Upload wheels - uses: actions/upload-artifact@v3 - with: - name: wheels - path: dist + - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 + with: + python-version: '3.12' + architecture: ${{ matrix.target }} + - name: Build wheels + uses: PyO3/maturin-action@v1 + with: + target: ${{ matrix.target }} + args: --release --out dist --interpreter 3.8 3.9 3.10 3.11 3.12 + sccache: 'true' + - name: Upload wheels + uses: actions/upload-artifact@v3 + with: + name: wheels + path: dist + - name: pytest + if: ${{ !startsWith(matrix.target, 'aarch64') }} + shell: bash + run: | + set -e + pip install pyoxipng --find-links dist --force-reinstall + pip install pytest + pytest macos: runs-on: macos-latest - needs: test strategy: matrix: - python-version: ['3.7', '3.8', '3.9', '3.10', '3.11'] + target: [x86_64, aarch64] steps: - - uses: actions/checkout@v3 - - uses: PyO3/maturin-action@v1 - with: - command: build - args: --release -o dist --universal2 -i python${{ matrix.python-version }} - - name: Upload wheels - uses: actions/upload-artifact@v3 - with: - name: wheels - path: dist + - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 + with: + python-version: '3.10' + - name: Build wheels + uses: PyO3/maturin-action@v1 + with: + target: ${{ matrix.target }} + args: --release --out dist --interpreter 3.8 3.9 3.10 3.11 3.12 + sccache: 'true' + - name: Upload wheels + uses: actions/upload-artifact@v3 + with: + name: wheels + path: dist + - name: pytest + if: ${{ !startsWith(matrix.target, 'aarch64') }} + shell: bash + run: | + set -e + pip install pyoxipng --find-links dist --force-reinstall + pip install pytest + pytest + + sdist: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Build sdist + uses: PyO3/maturin-action@v1 + with: + command: sdist + args: --out dist + - name: Upload sdist + uses: actions/upload-artifact@v3 + with: + name: wheels + path: dist release: name: Release runs-on: ubuntu-latest if: "startsWith(github.ref, 'refs/tags/')" - needs: [ macos, windows, linux ] + needs: [linux, windows, macos, sdist] steps: - uses: actions/download-artifact@v3 with: name: wheels - - uses: actions/setup-python@v4 - with: - python-version: '3.10' - name: Publish to PyPI + uses: PyO3/maturin-action@v1 env: - TWINE_USERNAME: __token__ - TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} - run: | - pip install --upgrade twine - twine upload --skip-existing * + MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_PASSWORD }} + with: + command: upload + args: --non-interactive --skip-existing * diff --git a/Cargo.lock b/Cargo.lock index 82da2a4..9a6578d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -316,18 +316,18 @@ dependencies = [ [[package]] name = "memoffset" -version = "0.6.5" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5aa361d4faea93603064a027415f07bd8e1d5c88c9fbf68bf56a285428fd79ce" +checksum = "5de893c32cde5f383baa4c04c5d6dbdd735cfd4a794b0debdb2bb1b421da5ff4" dependencies = [ "autocfg", ] [[package]] name = "memoffset" -version = "0.7.1" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5de893c32cde5f383baa4c04c5d6dbdd735cfd4a794b0debdb2bb1b421da5ff4" +checksum = "5a634b1c61a95585bd15607c6ab0c4e5b226e695ff2800ba0cdccddf208c406c" dependencies = [ "autocfg", ] @@ -463,14 +463,14 @@ dependencies = [ [[package]] name = "pyo3" -version = "0.17.3" +version = "0.19.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "268be0c73583c183f2b14052337465768c07726936a260f480f0857cb95ba543" +checksum = "e681a6cfdc4adcc93b4d3cf993749a4552018ee0a9b65fc0ccfad74352c72a38" dependencies = [ "cfg-if", "indoc", "libc", - "memoffset 0.6.5", + "memoffset 0.9.0", "parking_lot", "pyo3-build-config", "pyo3-ffi", @@ -480,9 +480,9 @@ dependencies = [ [[package]] name = "pyo3-build-config" -version = "0.17.3" +version = "0.19.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28fcd1e73f06ec85bf3280c48c67e731d8290ad3d730f8be9dc07946923005c8" +checksum = "076c73d0bc438f7a4ef6fdd0c3bb4732149136abd952b110ac93e4edb13a6ba5" dependencies = [ "once_cell", "target-lexicon", @@ -490,9 +490,9 @@ dependencies = [ [[package]] name = "pyo3-ffi" -version = "0.17.3" +version = "0.19.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f6cb136e222e49115b3c51c32792886defbfb0adead26a688142b346a0b9ffc" +checksum = "e53cee42e77ebe256066ba8aa77eff722b3bb91f3419177cf4cd0f304d3284d9" dependencies = [ "libc", "pyo3-build-config", @@ -500,9 +500,9 @@ dependencies = [ [[package]] name = "pyo3-macros" -version = "0.17.3" +version = "0.19.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94144a1266e236b1c932682136dc35a9dee8d3589728f68130c7c3861ef96b28" +checksum = "dfeb4c99597e136528c6dd7d5e3de5434d1ceaf487436a3f03b2d56b6fc9efd1" dependencies = [ "proc-macro2", "pyo3-macros-backend", @@ -512,9 +512,9 @@ dependencies = [ [[package]] name = "pyo3-macros-backend" -version = "0.17.3" +version = "0.19.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8df9be978a2d2f0cdebabb03206ed73b11314701a5bfe71b0d753b81997777f" +checksum = "947dc12175c254889edc0c02e399476c2f652b4b9ebd123aa655c224de259536" dependencies = [ "proc-macro2", "quote", diff --git a/Cargo.toml b/Cargo.toml index 7cb15d8..0239c4a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,5 +9,5 @@ name = "oxipng" crate-type = ["cdylib"] [dependencies] -pyo3 = { version = "0.17.3", features = ["extension-module"] } +pyo3 = { version = "0.19.2", features = ["extension-module"] } oxipng = { version = "8.0.*" } diff --git a/Pipfile.lock b/Pipfile.lock index 94be94a..c31a5c2 100644 --- a/Pipfile.lock +++ b/Pipfile.lock @@ -22,160 +22,161 @@ "index": "pypi", "version": "==1.4.1" }, - "attrs": { - "hashes": [ - "sha256:29adc2665447e5191d0e7c568fde78b21f9672d344281d0c6e1ab085429b22b6", - "sha256:86efa402f67bf2df34f51a335487cf46b1ec130d02b8d39fd248abfd30da551c" - ], - "markers": "python_version >= '3.5'", - "version": "==22.1.0" - }, "black": { "hashes": [ - "sha256:101c69b23df9b44247bd88e1d7e90154336ac4992502d4197bdac35dd7ee3320", - "sha256:159a46a4947f73387b4d83e87ea006dbb2337eab6c879620a3ba52699b1f4351", - "sha256:1f58cbe16dfe8c12b7434e50ff889fa479072096d79f0a7f25e4ab8e94cd8350", - "sha256:229351e5a18ca30f447bf724d007f890f97e13af070bb6ad4c0a441cd7596a2f", - "sha256:436cc9167dd28040ad90d3b404aec22cedf24a6e4d7de221bec2730ec0c97bcf", - "sha256:559c7a1ba9a006226f09e4916060982fd27334ae1998e7a38b3f33a37f7a2148", - "sha256:7412e75863aa5c5411886804678b7d083c7c28421210180d67dfd8cf1221e1f4", - "sha256:77d86c9f3db9b1bf6761244bc0b3572a546f5fe37917a044e02f3166d5aafa7d", - "sha256:82d9fe8fee3401e02e79767016b4907820a7dc28d70d137eb397b92ef3cc5bfc", - "sha256:9eedd20838bd5d75b80c9f5487dbcb06836a43833a37846cf1d8c1cc01cef59d", - "sha256:c116eed0efb9ff870ded8b62fe9f28dd61ef6e9ddd28d83d7d264a38417dcee2", - "sha256:d30b212bffeb1e252b31dd269dfae69dd17e06d92b87ad26e23890f3efea366f" + "sha256:031e8c69f3d3b09e1aa471a926a1eeb0b9071f80b17689a655f7885ac9325a6f", + "sha256:13a2e4a93bb8ca74a749b6974925c27219bb3df4d42fc45e948a5d9feb5122b7", + "sha256:13ef033794029b85dfea8032c9d3b92b42b526f1ff4bf13b2182ce4e917f5100", + "sha256:14f04c990259576acd093871e7e9b14918eb28f1866f91968ff5524293f9c573", + "sha256:24b6b3ff5c6d9ea08a8888f6977eae858e1f340d7260cf56d70a49823236b62d", + "sha256:403397c033adbc45c2bd41747da1f7fc7eaa44efbee256b53842470d4ac5a70f", + "sha256:50254ebfa56aa46a9fdd5d651f9637485068a1adf42270148cd101cdf56e0ad9", + "sha256:538efb451cd50f43aba394e9ec7ad55a37598faae3348d723b59ea8e91616300", + "sha256:638619a559280de0c2aa4d76f504891c9860bb8fa214267358f0a20f27c12948", + "sha256:6a3b50e4b93f43b34a9d3ef00d9b6728b4a722c997c99ab09102fd5efdb88325", + "sha256:6ccd59584cc834b6d127628713e4b6b968e5f79572da66284532525a042549f9", + "sha256:75a2dc41b183d4872d3a500d2b9c9016e67ed95738a3624f4751a0cb4818fe71", + "sha256:7d30ec46de88091e4316b17ae58bbbfc12b2de05e069030f6b747dfc649ad186", + "sha256:8431445bf62d2a914b541da7ab3e2b4f3bc052d2ccbf157ebad18ea126efb91f", + "sha256:8fc1ddcf83f996247505db6b715294eba56ea9372e107fd54963c7553f2b6dfe", + "sha256:a732b82747235e0542c03bf352c126052c0fbc458d8a239a94701175b17d4855", + "sha256:adc3e4442eef57f99b5590b245a328aad19c99552e0bdc7f0b04db6656debd80", + "sha256:c46767e8df1b7beefb0899c4a95fb43058fa8500b6db144f4ff3ca38eb2f6393", + "sha256:c619f063c2d68f19b2d7270f4cf3192cb81c9ec5bc5ba02df91471d0b88c4c5c", + "sha256:cf3a4d00e4cdb6734b64bf23cd4341421e8953615cba6b3670453737a72ec204", + "sha256:cf99f3de8b3273a8317681d8194ea222f10e0133a24a7548c73ce44ea1679377", + "sha256:d6bc09188020c9ac2555a498949401ab35bb6bf76d4e0f8ee251694664df6301" ], "index": "pypi", - "version": "==22.12.0" + "markers": "python_version >= '3.8'", + "version": "==23.9.1" }, "click": { "hashes": [ - "sha256:7682dc8afb30297001674575ea00d1814d808d6a36af415a82bd481d37ba7b8e", - "sha256:bb4d8133cb15a609f44e8213d9b391b0809795062913b383c62be0ee95b1db48" + "sha256:ae74fb96c20a0277a1d615f1e4d73c8414f5a98db8b799a7931d1582f3390c28", + "sha256:ca9853ad459e787e2192211578cc907e7594e294c7ccc834310722b41b9ca6de" ], "markers": "python_version >= '3.7'", - "version": "==8.1.3" - }, - "colorama": { - "hashes": [ - "sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44", - "sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6" - ], - "markers": "sys_platform == 'win32'", - "version": "==0.4.6" + "version": "==8.1.7" }, "exceptiongroup": { "hashes": [ - "sha256:542adf9dea4055530d6e1279602fa5cb11dab2395fa650b8674eaec35fc4a828", - "sha256:bd14967b79cd9bdb54d97323216f8fdf533e278df937aa2a90089e7d6e06e5ec" + "sha256:097acd85d473d75af5bb98e41b61ff7fe35efe6675e4f9370ec6ec5126d160e9", + "sha256:343280667a4585d195ca1cf9cef84a4e178c4b6cf2274caef9859782b567d5e3" ], "markers": "python_version < '3.11'", - "version": "==1.0.4" + "version": "==1.1.3" }, "importlib-metadata": { "hashes": [ - "sha256:d5059f9f1e8e41f80e9c56c2ee58811450c31984dfa625329ffd7c0dad88a73b", - "sha256:d84d17e21670ec07990e1044a99efe8d615d860fd176fc29ef5c306068fda313" + "sha256:3ebb78df84a805d7698245025b975d9d67053cd94c79245ba4b3eb694abe68bb", + "sha256:dbace7892d8c0c4ac1ad096662232f831d4e64f4c4545bd53016a3e9d4654743" ], "index": "pypi", - "version": "==5.1.0" + "markers": "python_version >= '3.8'", + "version": "==6.8.0" }, "iniconfig": { "hashes": [ - "sha256:011e24c64b7f47f6ebd835bb12a743f2fbe9a26d4cecaa7f53bc4f35ee9da8b3", - "sha256:bc3af051d7d14b2ee5ef9969666def0cd1a000e121eaea580d4a313df4b37f32" + "sha256:2d91e135bf72d31a410b17c16da610a82cb55f6b0477d1a902134b24a455b8b3", + "sha256:b6a85871a79d2e3b22d2d1b94ac2824226a63c6b741c88f7ae975f18b6778374" ], - "version": "==1.1.1" + "markers": "python_version >= '3.7'", + "version": "==2.0.0" }, "maturin": { "hashes": [ - "sha256:021e0b557e907027a6c7f10968635fd4c15522eee0688fed031b1ac6240ecac4", - "sha256:09a45f7ca1c7b8a64af76d164536c361156f7368bcf4e8933988ed05e47f79da", - "sha256:47f47f36af28b36b4af725d32587ec802df21914e475d2b10adc6a83b59f13e6", - "sha256:5cacccb60a02819c32e2743baa953b9f3a4c43ea065ec1842a3d4d01db26fbc4", - "sha256:6bc21576a6261f7b88eb467e794d9824f5ef9aef57396ffaaf625e329e0c3c4c", - "sha256:7adc959064e770554be4022e15ee336d2dfe0d0a2997e5517d4533ea5d2d0622", - "sha256:94eefb5629af1f77ed369f66154ca811c20bf75964edf47783783a10dee41cb9", - "sha256:9be53311235473351e6318fd25bd35bf7685eb8dab987e09487313b240abb63c", - "sha256:9e9e6cd6d4884c25e053de10f9eba152adc9598e00c4fc9d4abe90636f42fdef", - "sha256:ad20875b5a44bc51b2cbc4eadec5fb4a5d5332a21eb55ffe26961bb30b497e65", - "sha256:bc04ddf1fb8acfeec59ead17c8fd89db39d708f548571461d5f6899bd0b759a2", - "sha256:de9f1577fe421ffe9b22b4465ef082ca24349952bc4d236a6ab76edd9d04e889", - "sha256:e7234801d48d65c2176d1f9e4e1a373c15c2ee9cd4df3a0e3796513eae3ebb3d" + "sha256:05639678b78a0df1abb4542925ee3eb5fc91ff3846878d584db8c7a6dbf2f54f", + "sha256:1b6b3a4d28c168a7a4773a406effb71c6245400e3d1fb08db3ebc5706669c706", + "sha256:2686f747980c9ef4a278542b209504b03c7576487b13b9655a6cbd40f3b98a73", + "sha256:329820228baa9158d69c8e36e2fd3d7df3163a66df8ae739caa6cb5289955646", + "sha256:416b0a48b8785555c5060d6fec97f69545c92ffe24df074c8a716d83fa8ab66b", + "sha256:777bd6b5a6b6fdafcef69168c3938f35efba6e8ca3e7657940dfca4fa077920f", + "sha256:84d9136cd241868a8c57116f6bc20e4560b70e96c60fefc3bcbc7ad15dbb7eb7", + "sha256:91ab057ae8d8992ad3a4312e8f379cbe1a8a3289f7d2a58969407e94355bfccc", + "sha256:d612878b75bb60946a45e9534bfd9e759e84d68cc6afe8d46c572d0c3b17bb4e", + "sha256:dcc292547986fa93254b07d6d9f01a417b46a3fa55d5c45db65e71b285922f26", + "sha256:f2dfe86b37f7747712f3a910e3321e955efabe2c0e1de19563cea8d05bbee5b6", + "sha256:f319b89025632099b197a686251f25def39f982f44474b8ba66c6d5f7e6abcde", + "sha256:f6c69bc7ae147a5effd55587447b35cab1ceb726ba244d08698bc7518b8688ac" ], "index": "pypi", - "version": "==0.14.6" + "markers": "python_version >= '3.7'", + "version": "==1.3.0" }, "mypy-extensions": { "hashes": [ - "sha256:090fedd75945a69ae91ce1303b5824f428daf5a028d2f6ab8a299250a846f15d", - "sha256:2d82818f5bb3e369420cb3c4060a7970edba416647068eb4c5343488a6c604a8" + "sha256:4392f6c0eb8a5668a69e23d168ffa70f0be9ccfd32b5cc2d26a34ae5b844552d", + "sha256:75dbf8955dc00442a438fc4d0666508a9a97b6bd41aa2f0ffe9d2f2725af0782" ], - "version": "==0.4.3" + "markers": "python_version >= '3.5'", + "version": "==1.0.0" }, "packaging": { "hashes": [ - "sha256:2198ec20bd4c017b8f9717e00f0c8714076fc2fd93816750ab48e2c41de2cfd3", - "sha256:957e2148ba0e1a3b282772e791ef1d8083648bc131c8ab0c1feba110ce1146c3" + "sha256:048fb0e9405036518eaaf48a55953c750c11e1a1b68e0dd1a9d62ed0c092cfc5", + "sha256:8c491190033a9af7e1d931d0b5dacc2ef47509b34dd0de67ed209b5203fc88c7" ], "markers": "python_version >= '3.7'", - "version": "==22.0" + "version": "==23.2" }, "pathspec": { "hashes": [ - "sha256:3c95343af8b756205e2aba76e843ba9520a24dd84f68c22b9f93251507509dd6", - "sha256:56200de4077d9d0791465aa9095a01d421861e405b5096955051deefd697d6f6" + "sha256:1d6ed233af05e679efb96b1851550ea95bbb64b7c490b0f5aa52996c11e92a20", + "sha256:e0d8d0ac2f12da61956eb2306b69f9469b42f4deb0f3cb6ed47b9cce9996ced3" ], "markers": "python_version >= '3.7'", - "version": "==0.10.3" + "version": "==0.11.2" }, "platformdirs": { "hashes": [ - "sha256:1a89a12377800c81983db6be069ec068eee989748799b946cce2a6e80dcc54ca", - "sha256:b46ffafa316e6b83b47489d240ce17173f123a9b9c83282141c3daf26ad9ac2e" + "sha256:cf8ee52a3afdb965072dcc652433e0c7e3e40cf5ea1477cd4b3b1d2eb75495b3", + "sha256:e9d171d00af68be50e9202731309c4e658fd8bc76f55c11c7dd760d023bda68e" ], "markers": "python_version >= '3.7'", - "version": "==2.6.0" + "version": "==3.11.0" }, "pluggy": { "hashes": [ - "sha256:4224373bacce55f955a878bf9cfa763c1e360858e330072059e10bad68531159", - "sha256:74134bbf457f031a36d68416e1509f34bd5ccc019f0bcc952c7b909d06b37bd3" + "sha256:cf61ae8f126ac6f7c451172cf30e3e43d3ca77615509771b3a984a0730651e12", + "sha256:d89c696a773f8bd377d18e5ecda92b7a3793cbe66c87060a6fb58c7b6e1061f7" ], - "markers": "python_version >= '3.6'", - "version": "==1.0.0" + "markers": "python_version >= '3.8'", + "version": "==1.3.0" }, "pytest": { "hashes": [ - "sha256:892f933d339f068883b6fd5a459f03d85bfcb355e4981e146d2c7616c21fef71", - "sha256:c4014eb40e10f11f355ad4e3c2fb2c6c6d1919c73f3b5a433de4708202cade59" + "sha256:1d881c6124e08ff0a1bb75ba3ec0bfd8b5354a01c194ddd5a0a870a48d99b002", + "sha256:a766259cfab564a2ad52cb1aae1b881a75c3eb7e34ca3779697c23ed47c47069" ], "index": "pypi", - "version": "==7.2.0" + "markers": "python_version >= '3.7'", + "version": "==7.4.2" }, "tomli": { "hashes": [ "sha256:939de3e7a6161af0c887ef91b7d41a53e7c5a1ca976325f429cb46ea9bc30ecc", "sha256:de526c12914f0c550d15924c62d72abc48d6fe7364aa87328337a31007fe8a4f" ], - "markers": "python_full_version < '3.11.0a7'", + "markers": "python_version < '3.11'", "version": "==2.0.1" }, "typing-extensions": { "hashes": [ - "sha256:1511434bb92bf8dd198c12b1cc812e800d4181cfcb867674e0f8279cc93087aa", - "sha256:16fa4864408f655d35ec496218b85f79b3437c829e93320c7c9215ccfd92489e" + "sha256:8f92fc8806f9a6b641eaa5318da32b44d401efaac0f6678c9bc448ba3605faa0", + "sha256:df8e4339e9cb77357558cbdbceca33c303714cf861d1eef15e1070055ae8b7ef" ], "index": "pypi", - "version": "==4.4.0" + "markers": "python_version >= '3.8'", + "version": "==4.8.0" }, "zipp": { "hashes": [ - "sha256:83a28fcb75844b5c0cdaf5aa4003c2d728c77e05f5aeabe8e95e56727005fbaa", - "sha256:a7a22e05929290a67401440b39690ae6563279bced5f314609d9d03798f56766" + "sha256:0e923e726174922dce09c53c59ad483ff7bbb8e572e00c7f7c46b88556409f31", + "sha256:84e64a1c28cf7e91ed2078bb8cc8c259cb19b76942096c8d7b84947690cabaf0" ], - "markers": "python_version >= '3.7'", - "version": "==3.11.0" + "markers": "python_version >= '3.8'", + "version": "==3.17.0" } } } diff --git a/pyproject.toml b/pyproject.toml index a432909..30863ad 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,10 +1,10 @@ [build-system] -requires = ["maturin>=0.14,<0.15"] +requires = ["maturin~=1.3.0"] build-backend = "maturin" [project] name = "pyoxipng" -requires-python = ">=3.7" +requires-python = ">=3.8" version = "8.0.0" description = "Python wrapper for multithreaded .png image file optimizer oxipng" readme = "README.md" diff --git a/src/lib.rs b/src/lib.rs index e8de00f..0e4b99b 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -12,9 +12,9 @@ create_exception!(oxipng, PngError, PyException); /// Optimize the png file at the given input location. Optionally send it to the /// given output location. -#[pyfunction(kwds = "**")] -#[pyo3(text_signature = "(input, output, **kwargs)")] -fn optimize(input: &PyAny, output: Option<&PyAny>, kwds: Option<&PyDict>) -> PyResult<()> { +#[pyfunction] +#[pyo3(signature = (input, output=None, **kwargs))] +fn optimize(input: &PyAny, output: Option<&PyAny>, kwargs: Option<&PyDict>) -> PyResult<()> { let inpath = PathBuf::from(input.str()?.to_str()?); let outpath = if let Some(out) = output { Some(PathBuf::from(out.str()?.to_str()?)) @@ -25,15 +25,15 @@ fn optimize(input: &PyAny, output: Option<&PyAny>, kwds: Option<&PyDict>) -> PyR let inpath = op::InFile::Path(inpath); let outpath = op::OutFile::Path(outpath); - op::optimize(&inpath, &outpath, &parse::parse_kw_opts(kwds)?) + op::optimize(&inpath, &outpath, &parse::parse_kw_opts(kwargs)?) .or_else(|err| Err(PngError::new_err(parse::png_error_to_string(&err))))?; Ok(()) } -#[pyfunction(kwds = "**")] -#[pyo3(text_signature = "(data, **kwargs)")] -fn optimize_from_memory(data: &PyBytes, kwds: Option<&PyDict>) -> PyResult> { - let output = op::optimize_from_memory(data.as_bytes(), &parse::parse_kw_opts(kwds)?) +#[pyfunction] +#[pyo3(signature = (data, **kwargs))] +fn optimize_from_memory(data: &PyBytes, kwargs: Option<&PyDict>) -> PyResult> { + let output = op::optimize_from_memory(data.as_bytes(), &parse::parse_kw_opts(kwargs)?) .or_else(|err| Err(PngError::new_err(parse::png_error_to_string(&err))))?; Python::with_gil(|py| { let bytes: Py = PyBytes::new(py, &*output).into();