{"id":27212112,"url":"https://github.com/oxidase/ofiuco","last_synced_at":"2026-01-31T07:09:57.653Z","repository":{"id":148846540,"uuid":"620909032","full_name":"oxidase/ofiuco","owner":"oxidase","description":"Bazel rules for use poetry lock files with cross-platform Python packages support ","archived":false,"fork":false,"pushed_at":"2025-01-08T05:45:29.000Z","size":929,"stargazers_count":22,"open_issues_count":10,"forks_count":3,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-08T06:27:34.332Z","etag":null,"topics":["bazel","cross-platform","python","python-poetry"],"latest_commit_sha":null,"homepage":"","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/oxidase.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"AUTHORS","dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-03-29T15:55:42.000Z","updated_at":"2025-01-08T05:28:08.000Z","dependencies_parsed_at":"2023-07-06T09:33:31.366Z","dependency_job_id":"8aa80bd5-db17-4777-835a-0b1aa1ccc4f8","html_url":"https://github.com/oxidase/ofiuco","commit_stats":null,"previous_names":["oxidase/ofiuco"],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oxidase%2Fofiuco","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oxidase%2Fofiuco/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oxidase%2Fofiuco/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oxidase%2Fofiuco/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/oxidase","download_url":"https://codeload.github.com/oxidase/ofiuco/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248142985,"owners_count":21054671,"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":["bazel","cross-platform","python","python-poetry"],"created_at":"2025-04-10T01:58:19.944Z","updated_at":"2026-01-31T07:09:57.645Z","avatar_url":"https://github.com/oxidase.png","language":"Starlark","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ⛎ Ofiuco Rules for Bazel\n\n## Overview\n\nThe repository defines Bazel installation rules for multi-platform Python lock files.\nThe major difference to pip rules in [rules_python](https://github.com/bazelbuild/rules_python) is that Python packages are installed as `py_library` targets and not as external repositories.\nThis allows to use platform information of resolved Python toolchains and build cross-platform Python artifacts.\n\nMinimum requirements:\n\n* Bazel 8.x and rules_python with registered Python \u003e= 3.11 toolchain.\n\n## Getting started\n\n### Update lock files\n\nA lock file in the workspace can be updated using a host Python interpreter as\n```\npython3 -m pip install poetry\n\npoetry update\n```\n\nor using a pre-defined target\n```\nload(\"@ofiuco//python:poetry.bzl\", \"poetry_lock\")\n\npoetry_lock(\n    name = \"lock\",\n    toml = \"pyproject.toml\",\n    lock = \"poetry.lock\",\n)\n```\n\nIn both cases the host interpreter is used in the latter case poetry package with dependencies is installed as an external repository.\n\n### Import `ofiuco` as a module\n\nTo import `ofiuco` in your project, you first need to add it to your `MODULE.bazel` file\n\n```python\nbazel_dep(name = \"rules_python\", version = \"1.8.0-rc2\")\n\npython = use_extension(\"@rules_python//python/extensions:python.bzl\", \"python\")\npython.toolchain(python_version = \"3.13\")\nuse_repo(python, \"python_3_13\")\n\nbazel_dep(name = \"ofiuco\", version = \"0.8.2\")\n\nparse = use_extension(\"@ofiuco//python:extensions.bzl\", \"parse\")\nparse.lock(\n    name = \"python\",\n    lock = \"@//path/to:poetry_or_uv.lock\",\n    toml = \"@//path/to:pyproject.toml\",\n)\nuse_repo(parse, \"python\")\n```\n\nand Python dependencies can be used as\n\n```python\npy_library(\n    name = \"mylib\",\n    srcs = [\"mylib.py\"],\n    deps = [\n        \"@python//:package1\",\n        \"@python//:package2\",\n    ]\n)\n```\nor to include all Python dependencies you can use `:all` synthetic target as\n```python\npy_library(\n    name = \"mylib\",\n    srcs = [\"mylib.py\"],\n    deps = [\n        \"@python//:all\",\n    ]\n)\n```\n\nIf `all` is a legit package name then the synthetic target will have one or more underscores to disambiguate names.\n\n\n### Update uv.lock.json\n\n```\ncargo install --git https://github.com/bazel-contrib/multitool\nfish_add_path $HOME/.cargo/bin\n\nmultitool --lockfile python/private/uv.lock.json update\n```\n\n### Building at Windows platforms\n\n\n1. Install Scoop\nhttps://github.com/ScoopInstaller/Install?tab=readme-ov-file#for-admin\n\n```\nirm get.scoop.sh -outfile 'install.ps1'\n.\\install.ps1 -RunAsAdmin\n```\n\n2. Install git and emacs\n\n```\nscoop install git\nscoop bucket add extras\nscoop install grep emacs bazelisk zip unzip python vcredist2022 WinDirStat\nscoop bucket add milnak https://github.com/milnak/scoop-bucket\nscoop install milnak/windbg\n```\n\n3. Instal VisualStudio build tools\n\n```\n# Source - https://stackoverflow.com/a\n# Posted by caiohamamura, modified by community. See post 'Timeline' for change history\n# Retrieved 2025-12-31, License - CC BY-SA 4.0\n\nwinget install Microsoft.VisualStudio.2022.BuildTools --force --override \"--wait --passive --add Microsoft.VisualStudio.Component.VC.Tools.x86.x64 --add Microsoft.VisualStudio.Component.Windows10SDK\"\n```\n\n4. Set Python files associations\ncmd /c assoc .py=Python.File\ncmd /c assoc .pyz=Python.File\ncmd /c ftype Python.File=\"C:\\\\Users\\\\Administrator\\\\scoop\\\\apps\\\\python\\\\current\\\\python.exe\" \"%1\" %*\n\nwinget install Microsoft.VisualStudio.2022.BuildTools\n\n5. Checkout ofiuco\n\ngit clone git://oxidase@github.com/oxidase/ofiuco/\ncd ofiuco\nbazelisk test //...\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foxidase%2Fofiuco","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Foxidase%2Fofiuco","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foxidase%2Fofiuco/lists"}