{"id":13810720,"url":"https://github.com/tanin47/bazel-pex-pip","last_synced_at":"2026-03-13T17:42:33.234Z","repository":{"id":141278942,"uuid":"88120278","full_name":"tanin47/bazel-pex-pip","owner":"tanin47","description":null,"archived":false,"fork":false,"pushed_at":"2017-04-14T04:37:37.000Z","size":10,"stargazers_count":11,"open_issues_count":2,"forks_count":3,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-05-13T00:45:47.086Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tanin47.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2017-04-13T03:17:00.000Z","updated_at":"2019-08-26T11:43:18.000Z","dependencies_parsed_at":"2024-01-15T13:36:01.453Z","dependency_job_id":null,"html_url":"https://github.com/tanin47/bazel-pex-pip","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tanin47%2Fbazel-pex-pip","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tanin47%2Fbazel-pex-pip/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tanin47%2Fbazel-pex-pip/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tanin47%2Fbazel-pex-pip/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tanin47","download_url":"https://codeload.github.com/tanin47/bazel-pex-pip/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253850875,"owners_count":21973671,"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-08-04T03:00:24.121Z","updated_at":"2026-03-13T17:42:33.045Z","avatar_url":"https://github.com/tanin47.png","language":"Python","funding_links":[],"categories":["Additional language support"],"sub_categories":[],"readme":"Example of Bazel with pex and pip\n==================================\n\nThis repo is a working example showing how to use [Bazel](https://bazel.build/)\nwith [pex](https://github.com/pantsbuild/pex) and\n[pip](https://github.com/pypa/pip).\n\nThis repo is meant to be educational. Therefore, please read the code.\n\nThe example shows:\n\n* pulls dependencies using pip\n* builds a single binary with pex\n* reads a resource file\n\n\nUsage\n-------\n\n1. `bazel build main.pex`\n2. `./bazel-bin/main.pex`\n\nThe output:\n\n```\nCurrent file's path: /usr/local/google/home/tanin/.pex/code/e7c476458b50c0339f6e515b84111b4dd9dee723/test.py\nappdirs' path: /usr/local/google/home/tanin/.pex/install/appdirs-1.4.3-py2.py3-none-any.whl.88ca3acdb0294d36138be8eb8d73eb234d0cc1d3/appdirs-1.4.3-py2.py3-none-any.whl/appdirs.pyc\nTest.json's content: TEST\nFinished.\n```\n\nNotice that `appdirs` comes from within `.pex`.\n\n\nDesign Decision\n-----------------\n\n### Why do we choose pex over [subpar](https://github.com/google/subpar)?\n\nSubpar doesn't support extracting resource files from the archive. If we have a\nmore complex use case (e.g. executing a bash script), we can't use subpar.\n\nPex, on another hand, can set `zip_safe=False` which extracts the archive before\nexecuting the python code.\n\n\nSpecial Thanks\n----------------\n\n* [The snippet](https://github.com/bazelbuild/bazel/issues/699#issuecomment-262091510) on pip integration from @trivigy\n* [The pex integration](https://github.com/benley/bazel_rules_pex) from @benley\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftanin47%2Fbazel-pex-pip","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftanin47%2Fbazel-pex-pip","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftanin47%2Fbazel-pex-pip/lists"}