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
6 changes: 3 additions & 3 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ module(
compatibility_level = 1,
)

bazel_dep(name = "bazel_skylib", version = "1.9.0")
bazel_dep(name = "bazel_skylib", version = "1.9.2")
bazel_dep(name = "platforms", version = "1.1.0")
bazel_dep(name = "rules_cc", version = "0.2.21")
bazel_dep(name = "rules_cc", version = "0.2.22")
bazel_dep(name = "rules_multitool", version = "1.11.1")
bazel_dep(name = "rules_python", version = "2.2.0")
bazel_dep(name = "rules_rust", version = "0.71.3")
bazel_dep(name = "rules_rust", version = "0.70.0")
bazel_dep(name = "rules_shell", version = "0.8.0")

python = use_extension("@rules_python//python/extensions:python.bzl", "python")
Expand Down
38 changes: 38 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,3 +134,41 @@ winget install Microsoft.VisualStudio.2022.BuildTools
git clone git://oxidase@github.com/oxidase/ofiuco/
cd ofiuco
bazelisk test //...


## Get ABI tags

Use Google Cloud to run queries like
https://console.cloud.google.com/bigquery?pli=1&project=ee-mkrasnyk&ws=!1m12!1m5!4m3!1sbigquery-public-data!2spypi!3sdistribution_metadata!23sRESOURCE_LIST!1m5!1m3!1see-mkrasnyk!2sbquxjob_45e08a26_19fcd8c67e4!3sUS!23sQUERY_RESOURCE

to find Wasm32
```
SELECT DISTINCT
REGEXP_EXTRACT(
filename,
r'((?:cp|pp|py)[^-]+-[^-]+-pyemscripten_[0-9]+_[0-9]+_wasm32)\.whl$'
) AS wheel_tags
FROM
`bigquery-public-data.pypi.distribution_metadata`
WHERE
LOWER(filename) LIKE '%.whl'
AND LOWER(filename) LIKE '%pyemscripten%'
ORDER BY
wheel_tags;
```

or Android tags
```
SELECT DISTINCT
REGEXP_EXTRACT(
filename,
r'((?:cp|pp|py)[^-]+-[^-]+-android_[0-9]+_.*)\.whl$'
) AS wheel_tags
FROM
`bigquery-public-data.pypi.distribution_metadata`
WHERE
LOWER(filename) LIKE '%.whl'
AND LOWER(filename) LIKE '%-android%'
ORDER BY
wheel_tags;
```
1 change: 1 addition & 0 deletions examples/simple/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ py_test(
":pre-commit",
"@poetry//:aioboto3",
"@poetry//:annetbox[async]",
"@poetry//:cryptography",
"@poetry//:pytest",
"@poetry//:urllib3[brotli]",
"@poetry//:urllib3[h2]",
Expand Down
1,380 changes: 695 additions & 685 deletions examples/simple/poetry.lock

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions examples/simple/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ dependencies = [
"aiobotocore<3",
"annetbox[sync,async]",
"botocore[crt]",
"cryptography",
"pre-commit",
"pytest",
"setuptools",
Expand Down
6 changes: 6 additions & 0 deletions examples/simple/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,11 @@ def test_annetbox_extra():
assert aiohttp, "annetbox[async]"


def test_cryptography():
import cryptography

assert cryptography


if __name__ == "__main__":
sys.exit(pytest.main(sys.argv))
57 changes: 57 additions & 0 deletions python/platforms/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ python_abi_tags = [
["py2.py3", None, "none", "no"],
["py3", None, "none", "no"],
["cp3x", None, "abi3", "no"],
] + [
# ABI abi3 versions
["cp3" + str(minor), "3." + str(minor), "abi3", "no"] for minor in range(4, 17)
] + [
# ABI m versions
["cp3" + str(minor), "3." + str(minor), "cp3" + str(minor) + "m", "no"] for minor in range(4, 8)
Expand Down Expand Up @@ -151,3 +154,57 @@ ios_versions = [
["arm64", "iphonesimulator"],
["x86_64", "iphonesimulator"],
]]

# Android
constraint_setting(name = "android_version", default_constraint_value = ":android_31")
android_versions = range(20, 36)
[constraint_value(name = "android_{}".format(version), constraint_setting = ":android_version") for version in android_versions]

android_cpu_remap = {
"aarch64": "arm64_v8a",
"armv7": "armeabi_v7a",
"x86_32": "x86",
}

[config_setting(
name = "{python_tag}-{abi_tag}-android_{android_version}_{cpu}".format(python_tag=python_tag, abi_tag=abi_tag, cpu=android_cpu_remap.get(cpu, cpu), android_version=android_version),
constraint_values = [
"@platforms//cpu:{cpu}".format(cpu=cpu),
"@platforms//os:android",
":android_{android_version}".format(android_version=android_version),
],
flag_values = {
"@rules_python//python/config_settings:python_version_major_minor": python_version,
"@rules_python//python/config_settings:py_freethreaded": freethreaded,
} if python_version else {},
)
for python_tag, python_version, abi_tag, freethreaded in python_abi_tags
for cpu in ["aarch64", "armv7", "ppc", "ppc64le", "riscv64", "riscv32", "s390x", "x86_32", "x86_64"]
for android_version in android_versions]


# PyEmscripten
constraint_setting(name = "pyemscripten_release", default_constraint_value = ":pyemscripten_2026_0_wasm32")
pyemscripten_releases = [
"pyemscripten_2024_0_wasm32",
"pyemscripten_2025_0_wasm32",
"pyemscripten_2026_0_wasm32",
]
[constraint_value(name = version, constraint_setting = ":pyemscripten_release") for version in pyemscripten_releases]

[config_setting(
name = "{python_tag}-{abi_tag}-{platform}".format(python_tag=python_tag, abi_tag=abi_tag, platform=platform),
constraint_values = [
"@platforms//os:emscripten",
":{release}".format(release=platform),

],
flag_values = {
"@rules_python//python/config_settings:python_version_major_minor": python_version,
} if python_version else {},
)
for python_tag, python_version, abi_tag in \
[["cp3" + str(minor), "3." + str(minor), "abi3"] for minor in range(10, 17)] + \
[["cp3" + str(minor), "3." + str(minor), "cp3" + str(minor)] for minor in range(13, 17)] + \
[["py2.py3", None, "none"], ["py3", None, "none"], ["cp3x", None, "abi3"]]
for platform in pyemscripten_releases]
Loading