aboutsummaryrefslogtreecommitdiff
path: root/README.md
AgeCommit message (Collapse)Author
2023-06-15feat(bzlmod)!: Calling pip multiple times allowing for multiple Python ↵Chris Love
versions (#1254) Implementing the capability to call pip bzlmod extension multiple times. We can now call the pip extension with the same hub name multiple times. This allows a user to have multiple different requirement files based on the Python version. With workspace, we need incompatible aliases because you get @pip//tabulate or @pip_tabulate//:pkg. The requirement() macro hides this, but changing the flag becomes a breaking change if you've manually referenced things. With bzlmod, though, the @pip_tabulate style isn't a realistic option (you'd have to use_repo everything, which is a huge pain). So we have chosen to have `@pip//tabulate`. This commit implements that capability for pip.parse to determine the Python version from programmatically the provided interpreter. See https://github.com/bazelbuild/rules_python/blob/76aab0f91bd614ee1b2ade310baf28c38695c522/python/extensions/pip.bzl#L88 For more in-depth implementation details. INTERFACE CHANGE:: - pip.parse argument python_version is introduced but not required. When possible, it is inferred. BREAKING CHANGE: * `pip.parse()` extension: the `name` attribute is renamed `hub_name`. This is to reflect that the user-provided name isn't unique to each `pip.parse()` call. We now have a hub that is created, and each pip.parse call creates a spoke. * `pip.parse()` extension: the `incompatible_generate_aliases` arg is removed; behavior has changed to assume it is always True. * `pip.parse()` calls are collected under the same `hub_name` to support multiple Python versions under the same resulting repo name (the hub name0. Close: #1229
2023-06-12feat(bzlmod): Register a default toolchain (#1259)upstream/0.23.0Richard Levasseur
This makes rules_python always provide a default toolchain when using bzlmod. Note that, unlike workspace builds, the default is not the local system Python (`@bazel_tools//tools/python:autodetecting_toolchain`). Instead, the default is a hermetic runtime, but no guarantees are made about the particular version used. In practice, it will be the latest available Python version. Work towards #1233
2023-06-01feat(bzlmod): Moving register.toolchains internal (#1238)Chris Love
This commit moves the register.toolchains bzlmod call to inside of rules_python. Instead of a user having to call register.toolchains in their MODULE.bazel, rules_python/MODULE.bazel calls it on the internal hub. This is a breaking change if you are using register.toolchains inside of submodules. Using register.toolchains inside of submodules is not recommended anyways. This is now broken because we are not creating a repo for every Python version toolchain. All of the toochain calls exist now in the hub's repo BUILD.bazel file.
2023-05-15Adding bzlmod support document (#1214)Chris Love
This markdown file maintains the current status of our bzlmod implementation. Created section in README and linked to the bzlmod doc.
2023-05-01type:docs Update README.md (#1186)Wei
Change instruction to refer to `MODULE.bazel` instead of `MODULES.bazel`.
2023-04-03docs: Updating documentation for bzlmod (#1149)Chris Love
- Updated primary README.md to include documentation for using bzlmod or a WORKSPACE file. - Updated gazelle/README.md to include documentation for only using bzlmod and provided a link to the older docs. - Included other general updates for the gazelle documentation.
2023-03-04chore: fix some lingering GH archive URLs (#1108)Alex Eagle
This was pointed out in a thread on bazel-discuss@googlegroups.com
2023-01-18Implement py_proto_library (#832)Ivo List
* Add py_proto_library * Bump versions of rules_proto and protobuf * Update documentation * Bump rules_pkg version
2022-12-30Fix broken link. (#955)Philipp Stephani
2022-11-02Update `pip_install` to `pip_parse` in README.md (#852)Ekesh Kumar
`pip_install` is deprecated and will be removed in a future release. The example has already been updated to `pip_parse`, but the caption has not been updated yet.
2022-09-25Standardise on pip_parse (#807)upstream/0.13.0Greg Roodt
2022-06-28. (#738)Greg Roodt
Co-authored-by: Alex Eagle <alex@aspect.dev>
2022-06-21Provide current_py_toolchain (#731)jheaff1
This commit introduces the current_py_toolchain rule, exposing the PYTHON2 and PYTHON3 "make" variables in bazel rules, analagous to @bazel_tools//tools/cpp:current_cc_toolchain. See https://docs.bazel.build/versions/main/be/make-variables.html#custom_variables Co-authored-by: Thulio Ferraz Assis <3149049+f0rmiga@users.noreply.github.com>
2022-06-09Remove legacy pip_import (#726)upstream/0.9.0Greg Roodt
* Remove legacy pip_import * Remove legacy pip_import * Generate docs
2022-05-10Add caveat about python_register_toolchain's hermeticty to README (#698)Jonathon Belotti
* Add caveat about `python_register_toolchains` rule's hermeticity. * Fix typos and grammar
2022-03-16Allow `python_register_toolchains.name` to be the resolved interpreter repo ↵UebelAndre
(#656) * Allow `python_register_toolchains.name` to be the resolved interpreter repo * Removed `{name}_resolved_interpreter` repository
2022-03-14docs: avoid users on 3.10 by accident (#653)Alex Eagle
2022-03-09feat: cpython toolchains (#618)Thulio Ferraz Assis
* feat: cpython toolchains for linux and macos Signed-off-by: Thulio Ferraz Assis <3149049+f0rmiga@users.noreply.github.com> * feat: compile zstd if missing Signed-off-by: Thulio Ferraz Assis <3149049+f0rmiga@users.noreply.github.com> * fix: buildifier Signed-off-by: Thulio Ferraz Assis <3149049+f0rmiga@users.noreply.github.com> * fix: make python_repositories reproducible Signed-off-by: Thulio Ferraz Assis <3149049+f0rmiga@users.noreply.github.com> * rename: python_repositories -> python_repository Signed-off-by: Thulio Ferraz Assis <3149049+f0rmiga@users.noreply.github.com> * fix: linter Signed-off-by: Thulio Ferraz Assis <3149049+f0rmiga@users.noreply.github.com> * feat: make interpreter files publicly visible Signed-off-by: Thulio Ferraz Assis <3149049+f0rmiga@users.noreply.github.com> * fix: add files to py_runtime Signed-off-by: Thulio Ferraz Assis <3149049+f0rmiga@users.noreply.github.com> * Account for some platforms not having all versions * Added windows support to hermetic toolchains (#628) * Added windows support to hermetic toolchains * Update python/repositories.bzl Co-authored-by: Thulio Ferraz Assis <3149049+f0rmiga@users.noreply.github.com> * Update python/repositories.bzl Co-authored-by: Thulio Ferraz Assis <3149049+f0rmiga@users.noreply.github.com> * Update python/repositories.bzl Co-authored-by: Thulio Ferraz Assis <3149049+f0rmiga@users.noreply.github.com> * Update python/repositories.bzl Co-authored-by: Thulio Ferraz Assis <3149049+f0rmiga@users.noreply.github.com> Co-authored-by: Thulio Ferraz Assis <3149049+f0rmiga@users.noreply.github.com> * refactor: simplify logic for release urls Also, added a helper target to print the release hashes. Signed-off-by: Thulio Ferraz Assis <3149049+f0rmiga@users.noreply.github.com> * feat: Provide a host platform alias (#635) * feat: Provide a host platform alias This lets users and repository rules access the interpreter for whatever host the repository is running on. * Apply suggestions from code review Co-authored-by: Thulio Ferraz Assis <3149049+f0rmiga@users.noreply.github.com> * fix: files excludes Signed-off-by: Thulio Ferraz Assis <3149049+f0rmiga@users.noreply.github.com> * fix: macOS dislikes --recursive Signed-off-by: Thulio Ferraz Assis <3149049+f0rmiga@users.noreply.github.com> * fix: buildifier issues Signed-off-by: Thulio Ferraz Assis <3149049+f0rmiga@users.noreply.github.com> * Allow previous indygreg releases (#636) This gives us more python patch versions * fix: put back zstd support for older releases Signed-off-by: Thulio Ferraz Assis <3149049+f0rmiga@users.noreply.github.com> * fix: hash calculator Signed-off-by: Thulio Ferraz Assis <3149049+f0rmiga@users.noreply.github.com> * feat: use hermetic interpreter with pip_parse and pip_install Signed-off-by: Thulio Ferraz Assis <3149049+f0rmiga@users.noreply.github.com> * fix: add missing attrs back for zstd Signed-off-by: Thulio Ferraz Assis <3149049+f0rmiga@users.noreply.github.com> * fix: expose zstd attributes Signed-off-by: Thulio Ferraz Assis <3149049+f0rmiga@users.noreply.github.com> * fix: normalize OS names Signed-off-by: Thulio Ferraz Assis <3149049+f0rmiga@users.noreply.github.com> * fix: linting issues Signed-off-by: Thulio Ferraz Assis <3149049+f0rmiga@users.noreply.github.com> * fix: support windows in the aliases Signed-off-by: Thulio Ferraz Assis <3149049+f0rmiga@users.noreply.github.com> * fix: linting issues Signed-off-by: Thulio Ferraz Assis <3149049+f0rmiga@users.noreply.github.com> * fix: windows python.exe instead of python3.exe Signed-off-by: Thulio Ferraz Assis <3149049+f0rmiga@users.noreply.github.com> * fix: use consts for OS names Signed-off-by: Thulio Ferraz Assis <3149049+f0rmiga@users.noreply.github.com> * feat: always use latest toolchain for test Signed-off-by: Thulio Ferraz Assis <3149049+f0rmiga@users.noreply.github.com> * fix: expose versions.bzl Signed-off-by: Thulio Ferraz Assis <3149049+f0rmiga@users.noreply.github.com> * refactor: move toolchain tests out of private Signed-off-by: Thulio Ferraz Assis <3149049+f0rmiga@users.noreply.github.com> * feat: acceptance tests for the toolchains Signed-off-by: Thulio Ferraz Assis <3149049+f0rmiga@users.noreply.github.com> * fix: rewrite test in py to work on windows Signed-off-by: Thulio Ferraz Assis <3149049+f0rmiga@users.noreply.github.com> * fix: README example Co-authored-by: UebelAndre <github@uebelandre.com> * fix: use toolchain to run acceptance tests Signed-off-by: Thulio Ferraz Assis <3149049+f0rmiga@users.noreply.github.com> * feat: use matrix for acceptance tests Signed-off-by: Thulio Ferraz Assis <3149049+f0rmiga@users.noreply.github.com> * fix: support acceptance_tests on windows Signed-off-by: Thulio Ferraz Assis <3149049+f0rmiga@users.noreply.github.com> * feat: alias for pip Signed-off-by: Thulio Ferraz Assis <3149049+f0rmiga@users.noreply.github.com> * fix?: include call to windows cmd Signed-off-by: Thulio Ferraz Assis <3149049+f0rmiga@users.noreply.github.com> * Fix windows acceptance tests (#641) * Fix windows acceptance tests * test * todo: remove Co-authored-by: Thulio Ferraz Assis <3149049+f0rmiga@users.noreply.github.com> * refactor: polishing Windows testing support Signed-off-by: Thulio Ferraz Assis <3149049+f0rmiga@users.noreply.github.com> * fix: unset py2_runtime Signed-off-by: Thulio Ferraz Assis <3149049+f0rmiga@users.noreply.github.com> * rename: host -> resolved_interpreter Signed-off-by: Thulio Ferraz Assis <3149049+f0rmiga@users.noreply.github.com> * doc: add reference to quirks in python-build-standalone Signed-off-by: Thulio Ferraz Assis <3149049+f0rmiga@users.noreply.github.com> * feat: allow a distutils.cfg to be passed Signed-off-by: Thulio Ferraz Assis <3149049+f0rmiga@users.noreply.github.com> * fix: buildifier (again) Signed-off-by: Thulio Ferraz Assis <3149049+f0rmiga@users.noreply.github.com> * Minor code review suggestions (#642) * Minor code review suggestions * Apply suggestions from code review Co-authored-by: Thulio Ferraz Assis <3149049+f0rmiga@users.noreply.github.com> * fix: depset concat Signed-off-by: Thulio Ferraz Assis <3149049+f0rmiga@users.noreply.github.com> Co-authored-by: Alex Eagle <alex@aspect.dev> Co-authored-by: UebelAndre <github@uebelandre.com>
2022-01-05Fix buildozer command for substituting deps (#596)Henry Fuller
2022-01-03Update README to say that using `requirement()` is optional (#594)Josh Wilson
Co-authored-by: Alex Eagle <eagle@post.harvard.edu>
2022-01-02Simplify release (#587)Alex Eagle
Instead of building our own .tgz file with release artifacts, just let GitHub do it. Makes the release instructions much quicker, and doesn't require a review pass for releases, so we'll do them more frequently. fixes #586
2021-12-28Deleted legacy pip_import rule (#582)UebelAndre
2021-11-01Use 0.5.0 in README (#562)Alex Saveau
Co-authored-by: Jonathon Belotti <jonathon@canva.com>
2021-10-25Remove 'experimental' from pip_parse section (#551)Jeremy Volkman
Removes the "Experimental" tag from the `pip_parse` section of the README, and adds a note about the relatively new `compile_pip_requirements` rule. Co-authored-by: Alex Eagle <eagle@post.harvard.edu>
2021-09-12Release 0.4.0upstream/0.4.0Alex Eagle
2021-08-17replace obsolete 'master' branch refs (#513)Jonathon Belotti
2021-07-05Improve README documentation of pip_install rule [tiny] (#501)Jonathon Belotti
2021-06-24remove wording incorrectly suggesting python2 was supported by pip_install ↵Jonathon Belotti
(#495) Co-authored-by: Henry Fuller <hrofuller@gmail.com>
2021-06-23update README to point at latest release, 0.3.0, and latest master commit (#494)Jonathon Belotti
2021-04-120.2.0 README update (#444)Jonathon Belotti
2021-04-01You only need to specify extras in the requirement macro if using legacy ↵Jonathon Belotti
pip_import (#445)
2021-03-22Incrementally download wheels at workspace time. (#432)Henry Fuller
* Create support for lazily fetched repo's. Refactor pip_repository rule to invoke different scripts based on the value of the incremental attribute to the rule. Create a new macro in repositories.bzl which will instantiate all the child repos representing individual python packages. Refactor code which is repeated between the parse_requirements_to_bzl scripts and the extract_wheels script.
2021-01-28pip_repositories() is deprecated. remove directive to use it from README (#407)Jonathon Belotti
2021-01-24remove inaccuracy in README about default py interpreter used by pip_install ↵Jonathon Belotti
(#402)
2021-01-10Remove the rules_python_external README (#391)Jonathon Belotti
2021-01-05do not show 'pip3_import' as alternative to 'pip_install' in README (#398)Jonathon Belotti
2020-12-24Fix typo in readme. (#396)Kevin Wang
2020-10-26Remove py_repositories (#370)Alex Eagle
This adds useless setup code to a users WORKSPACE file. The idea that we could add some transitive WORKSPACE dependencies is flawed without a working support for this in Bazel. Anything we add in that function later is a breaking change for users, in that they might call our py_repositories() before fetching rules_xx, and we already installed an incompatible rules_xx. Since adding anything here is a breaking change, we can always put it back later as a breaking change to the rules. However I would argue strongly that rules_python is too core in the dependency chain for it to *ever* grow transitive dependencies. Like rules_nodejs we should either vendor code we need privately or strip development-only dependencies from our distribution, and never suggest that users call a rules_python function that installs other starlark code.
2020-10-16README update (related to 0.1.0 release) (#369)Jonathon Belotti
* README update: remove outdated refs to 'pip_import', add 'Recent Update', remove 'git_repository' usage * add section about legacy 'pip_import'
2020-07-14Remove mention and usage of Bazel Federation (#339)Alex Eagle
It's currently a stalled project so it's not useful for us to direct new users there in our README. Separately it is harder to develop on rules_python since it is currently not self-contained. For example it's hard to find or adjust the version of rules_pkg without looking/editing in the federation repo. Tony says this is an okay change: https://github.com/bazelbuild/bazel-federation/commit/63f9746afd4e8564d1033c529ce5065f69d6c7f9#commitcomment-40577834
2020-05-19point README readers to new 0.0.2 release (#302)Jonathon Belotti
2020-05-12Add documentation of community / Bazel team ownership (#308)Jon Brandvein
This adds a more nuanced CODEOWNERS and explains its purpose in CONTRIBUTING.md. Fixes #291.
2020-04-09Add information regarding support (#290)upstream/0.0.2Laurent Le Brun
2020-03-03README: Add missing http_archive import (#266)Ed Baunton
Currently if you copy and paste the documented workspace methods you get a failure that `http_archive` is not specified: it needs to be imported. Co-authored-by: lberki <lberki@users.noreply.github.com>
2019-11-15Add pip3_import (#256)Jon Brandvein
This adds `pip3_import` as a wrapper around `pip_import` that sets `python_interpreter` to `"python3"`. This is important for requesting the Python 3 version of a package on systems where the `"python"` command is Python 2 (which is most of them). We decline to add an analogous `pip2_import` wrapper at this time, because the command `"python2"` does not exist on all platforms by default (e.g. macOS). `piptool.py` is updated to prefix the names of the wheel repos (an implementation detail of rules_python) with the name given to `pip_import`. This is needed to avoid shadowing wheel repos when the same wheel name is used by separate `pip_import` invocations -- in particular when the same wheel is used for both PY2 and PY3. (Thanks to @joshclimacell for pointing this detail out in his prototype 90a70d5a550a01646966ce61156e6f83f02b4b73.) Regenerated the .par files and docs. Also updated the README to better explain the structure of the packaging rules. This includes mentioning `pip3_import`, concerns around versioning / hermeticity, and not depending on the wheel repo names (use `requirement()` instead).
2019-10-31Add badge for incompatible flag pipeline (#247)Marcel Hlopko
https://buildkite.com/bazel/rules-python-plus-bazelisk-migrate
2019-10-18README improvements (#239)Jon Brandvein
Follow-up to #237. Moves development workflow info to CONTRIBUTING.md. Fixes the instructions for how to use the Bazel Federation.
2019-10-09Fix WORKSPACE/distro boilerplate (#238)Jon Brandvein
We don't have a toolchain method, so don't try to call one in WORKSPACE. Add optional pip_repositories() call to README and add note that relnotes need manual editing for this.
2019-10-08Update README (#237)upstream/0.0.1Jon Brandvein
Expand the Overview. Add more context on core rules vs packaging rules and level of support. Add instructions for using Bazel Federation. Move pip stuff to sub-headings.
2019-08-02Update README and add py_repositories() (#218)Jon Brandvein
Update the README file to explain the difference between the core Python rules and the packaging rules. Add the py_repositories() hook and recommend that users add it to their WORKSPACE files. Background on the py_repositories() hook: I don't know what this might be useful for at the moment, but I found pip_repositories() to be helpful when I added a deprecation message for renaming the workspace to @rules_python. So it's probably a good idea to have this just in case. Also fix and regenerate docs.