Skip to main content

Python command line utility that installs wheels into Swift packages.

Project description

pyto-pkg

Python command line utility that installs wheels into Swift packages. Scripts are shared accross platforms (even when installed from wheels), but extensions are installed in os specific Apple Frameworks only if a supported wheel is found. The installed platforms are written in *.dist-info/platforms.txt.

This does not provide a cross compilation environment and is only meant to be used to install wheels and pure Python packages.

Also, this is made to work with pyto-runtime so tagging works differently than the official iOS wheels.

Supported platforms are: ios, ios-simulator, ios-macabi, tvos, tvos-simulator, watchos and watchos-simulator. Wheels must not contain the minimum os version or the llvm platform name. Example of valid wheel name: numpy-2.3.0-cp314-cp314-ios_arm64.whl.

Usage

$ pip install pyto-pkg
$ pyto-pkg --output SwiftPackagePath install numpy

The python version used to run pyto-pkg will be the version running pip. You can configure multiple Python versions with different packages in a single Swift Package.

You can pass a requirements file with -r. By default, pyto-pkg installs wheels for all supported platforms, but you can specify them with the -t argument, or you can customize them by package by adding a coma after the package name or version. Then you can write the platforms name, followed by an underscore and the architecture separated by a coma. If you want to just exclude a platform, put an exclamation mark before the platform name. For example:

opencv-contrib-python==4.13.0+d87edc6,!watchos_armv7k
torch==2.8.0a0+gitde3aca3,ios_arm64,ios-macabi_arm64,ios-macabi_x86_64

Pass --help for more options. By default, wheels will be pulled from https://git.gatit.es/api/packages/pyto/pypi/simple but you can change it with --index-url. Wheels are preferred over tar balls and pip will fallback to the default index repository if no wheels or packages are found in the specified repo index. You can also skip scripts with --no-scripts so you can pip install the wheels at runtime while keeping the extensions. However you need to be sure that the version of the package installed at runtime matches the version of the extensions stored in the app bundle.

Adding dependencies

You can pass a custom Package.swift manifest template path with the --manifest option so you can add your own dependencies. This is what your template should include:

// swift-tools-version: 5.9

import PackageDescription

let package = Package(
    name: "%PACKAGE_NAME%",
    products: [
        .library(
            name: "%TARGET_NAME%",
            targets: ["%TARGET_NAME%"]),
    ],

    targets: [
        .target(
            name: "%TARGET_NAME%",
            dependencies: [
%FRAMEWORK_DEPENDENCIES%
            ],
            resources: [
%RESOURCES%
            ]),

%FRAMEWORKS%
    ]
)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyto_pkg-2.3.tar.gz (12.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyto_pkg-2.3-py3-none-any.whl (14.3 kB view details)

Uploaded Python 3

File details

Details for the file pyto_pkg-2.3.tar.gz.

File metadata

  • Download URL: pyto_pkg-2.3.tar.gz
  • Upload date:
  • Size: 12.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for pyto_pkg-2.3.tar.gz
Algorithm Hash digest
SHA256 690c0fda3292399dcb6381ad41100b04a1321563d6efec065b7e5db7de10358c
MD5 118f4b0fd15d32f53e06750e278400ae
BLAKE2b-256 f9755e24669eabe6077dca9d9dd46c4b8180e08660188ffcd0c2e3dfaf4f47b4

See more details on using hashes here.

File details

Details for the file pyto_pkg-2.3-py3-none-any.whl.

File metadata

  • Download URL: pyto_pkg-2.3-py3-none-any.whl
  • Upload date:
  • Size: 14.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for pyto_pkg-2.3-py3-none-any.whl
Algorithm Hash digest
SHA256 2dcaebbe416ff2cede0837eaf72f2c021ee70cef88858258832abb57a8ef7324
MD5 fcf2dfffce24f3456f3c4f2e4c321937
BLAKE2b-256 10a33bdeb1b6e81dc974d48da8088efea9141197e3149b09bd40f92414493055

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page