{"id":18244268,"url":"https://github.com/stackb/pycross_image","last_synced_at":"2026-03-19T03:29:23.257Z","repository":{"id":225194884,"uuid":"764897871","full_name":"stackb/pycross_image","owner":"stackb","description":"Container image rules for python using rules_pycross","archived":false,"fork":false,"pushed_at":"2024-03-16T19:56:36.000Z","size":200,"stargazers_count":2,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-14T14:51:40.440Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Starlark","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/stackb.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-02-28T22:53:54.000Z","updated_at":"2024-10-24T21:08:40.000Z","dependencies_parsed_at":"2024-03-16T22:55:37.835Z","dependency_job_id":"d288af47-866b-48c1-9646-cdaa4e5495c6","html_url":"https://github.com/stackb/pycross_image","commit_stats":null,"previous_names":["stackb/pycross_image"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stackb%2Fpycross_image","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stackb%2Fpycross_image/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stackb%2Fpycross_image/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stackb%2Fpycross_image/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/stackb","download_url":"https://codeload.github.com/stackb/pycross_image/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247902245,"owners_count":21015414,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-05T09:15:57.386Z","updated_at":"2026-01-21T21:36:14.285Z","avatar_url":"https://github.com/stackb.png","language":"Starlark","readme":"# @pycross_image\n\n![build-status](https://github.com/stackb/pycross_image/actions/workflows/ci.yaml/badge.svg)\n\nBazel starlark rules for building container images from `py_binary` using\n[@rules_pycross](https://github.com/jvolkman/rules_pycross) :sparkles:.\n\nProvides:\n\n- `load(\"@pycross_image//bazel/rules:oci.bzl\", \"py_image\")`\n  - image rule compatible with\n    [@rules_oci](https://github.com/bazel-contrib/rules_oci)\n- `load(\"@pycross_image//bazel/rules:docker.bzl\", \"py_image\")`\n  - image rule compatible with\n    [@rules_docker](https://github.com/bazelbuild/rules_docker)\n\n## Installation \u0026 Usage\n\nSee [releases] page for an `http_archive` of the latest `@pycross_image`.\n\nExamples:\n\n- [@rules_oci example](example/oci/WORKSPACE.in)\n- [@rules_docker example](example/docker/WORKSPACE.in)\n\nA few notes about the workspace setup:\n\n- It's divided into \"steps\" based on load statement dependencies.  `step1.bzl`\n  only depends on things declared in `repositories.bzl`, `step2.bzl` depends on\n  things declared in `step1.bzl`, etc (this pattern is from\n  [tensorflow](https://github.com/tensorflow/tensorflow/tree/master/tensorflow)).\n- Your workspace may already contain some of these dependencies.  Also, selected\n  external workspace names may be differ from yours. Use the example as a study\n  guide rather than canonical reference.\n- The examples are only tested with the older `WORKSPACE`.  The rules may not be\n  compatible with `bzlmod` yet.\n\n## How it Works\n\n```mermaid\ngraph TD;\n    pypi[(pypi)]\n    DefaultInfo[[DefaultInfo]]\n    numpy{{numpy}}\n    grpclib{{grpclib}}\n\n    subgraph linux_x86_64\n        image.tar--\u003eimage;\n        image--\u003eapp_layer;\n        image--\u003esite_packages_layer;\n        image--\u003einterpreter_layer;\n        app_layer--\u003eDefaultInfo;\n        site_packages_layer--\u003eDefaultInfo;\n        interpreter_layer--\u003eDefaultInfo;\n    end\n\n    DefaultInfo--transition :linux_x86_64--\u003epycross_binary;\n    pycross_binary--\u003epy_binary;\n    py_binary--\u003enumpy;\n    py_binary--\u003egrpclib;\n\n    numpy-.-\u003enumpy-cp310-macosx_arm64.whl\n    numpy-.-\u003enumpy-cp310-manylinux_x86_64.whl\n    grpclib-.-\u003egrpclib.whl\n    numpy-cp310-macosx_arm64.whl--\u003epypi\n    numpy-cp310-manylinux_x86_64.whl--\u003epypi\n\n    subgraph zig_toolchain\n        grpclib.whl--\u003egrpclib-tar.gz\n    end\n\n    grpclib-tar.gz--\u003epypi\n\n    style pypi fill:#3171b2,stroke:#333\n    style numpy fill:#5d97d2,stroke:#3171b2,color:black\n    style grpclib fill:#5d97d2,stroke:#3171b2,color:black\n    style grpclib.whl stroke:#bc082b\n\n    style numpy-cp310-manylinux_x86_64.whl stroke:#bc082b\n    style numpy-cp310-macosx_arm64.whl stroke:#bb22d8\n    style linux_x86_64 stroke:#bc082b,fill:none\n```\n\nIn this example the `py_binary` rule has `deps` on two python wheels:\n  - `numpy` has a binary wheel available from pypi for both the darwin and linux\n    platforms.\n  - `grpclib` only has a source distribution available.\n\nThe `pycross_binary` rule transitions from the host platform to `:linux_x86_64`.\n  - the transition affects how `@rules_pycross` fetches wheels.  If the binary\n    distribution is available, take it.\n  - if the binary distribution is not available, compile from source using (in\n    this case, with `zig` and `@hermetic_cc_toolchains`).\n\nThe image is partitioned into three tar layers by matching against filename\npatterns (see rule implementation for details).\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstackb%2Fpycross_image","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstackb%2Fpycross_image","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstackb%2Fpycross_image/lists"}