soniaai / rules_poetry

Bazel rules that use Poetry for Python package management
MIT License
72 stars 22 forks source link

feature/issue-15-dev-deps #18

Closed njlr closed 1 year ago

njlr commented 1 year ago

This PR adds support for dependency groups (as suggested in https://github.com/soniaai/rules_poetry/issues/15).

There are two key changes:

  1. The mapping is reorganized a bit to include all of the groups
  2. An optional group argument is added to the dependency function
py_test(
    name = "test_dep_group",
    size = "small",
    srcs = ["test_dep_group.py"],
    python_version = "PY3",
    deps = [
        dependency("cowsay", group = "custom"),
    ],
)

According to the Poetry docs, all dependencies, even across groups, must resolve to the same:

All dependencies must be compatible with each other across groups since they will be resolved regardless of whether they are required for installation or not (see Installing group dependencies).

So we can share the install targets across all groups!

Despite this, the implementation will check the dependency is accessed with the proper group.

_This PR depends on PR https://github.com/soniaai/rules_poetry/pull/17_

njlr commented 1 year ago

@NathanHowell

NathanHowell commented 1 year ago

@NathanHowell

I'll take a look tomorrow, these came in when I was out on vacation and got lost in the notification flood