Age | Commit message (Collapse) | Author |
|
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
|
|
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
|
|
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.
|
|
This markdown file maintains the current status of our bzlmod
implementation. Created section in README and linked to the bzlmod doc.
|
|
Change instruction to refer to `MODULE.bazel` instead of
`MODULES.bazel`.
|
|
- 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.
|
|
This was pointed out in a thread on bazel-discuss@googlegroups.com
|
|
* Add py_proto_library
* Bump versions of rules_proto and protobuf
* Update documentation
* Bump rules_pkg version
|
|
|
|
`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.
|
|
|
|
Co-authored-by: Alex Eagle <alex@aspect.dev>
|
|
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>
|
|
* Remove legacy pip_import
* Remove legacy pip_import
* Generate docs
|
|
* Add caveat about `python_register_toolchains` rule's hermeticity.
* Fix typos and grammar
|
|
(#656)
* Allow `python_register_toolchains.name` to be the resolved interpreter repo
* Removed `{name}_resolved_interpreter` repository
|
|
|
|
* 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>
|
|
|
|
Co-authored-by: Alex Eagle <eagle@post.harvard.edu>
|
|
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
|
|
|
|
Co-authored-by: Jonathon Belotti <jonathon@canva.com>
|
|
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>
|
|
|
|
|
|
|
|
(#495)
Co-authored-by: Henry Fuller <hrofuller@gmail.com>
|
|
|
|
|
|
pip_import (#445)
|
|
* 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.
|
|
|
|
(#402)
|
|
|
|
|
|
|
|
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.
|
|
* README update: remove outdated refs to 'pip_import', add 'Recent Update', remove 'git_repository' usage
* add section about legacy 'pip_import'
|
|
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
|
|
|
|
This adds a more nuanced CODEOWNERS and explains its purpose in CONTRIBUTING.md.
Fixes #291.
|
|
|
|
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>
|
|
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).
|
|
https://buildkite.com/bazel/rules-python-plus-bazelisk-migrate
|
|
Follow-up to #237. Moves development workflow info to CONTRIBUTING.md. Fixes
the instructions for how to use the Bazel Federation.
|
|
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.
|
|
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.
|
|
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.
|