question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Dependency groups

See original GitHub issue

The goal of this feature is to make it easier for users to extract dependencies for a particular usage or platform.

Inside the manifest, we should allow the user to tag dependencies as belonging to particular groups.

It might look like this:

[[dependency]]
package = "github.com/abc/def"
version = "*"
groups = [ "dev" ]

[[dependency]]
package = "github.com/abc/ijk"
version = "*"
groups = [ "macos" ]

[[dependency]]
package = "github.com/abc/lmno"
version = "*"
groups = [ "dev", "linux" ]

By default, a dependency would not belong to any groups.

We would then provide a macro in buckaroo_macros.bzl that allows the user to extract all dependencies for a given group:

load('//:buckaroo_macros.bzl', 'buckaroo_deps_from_group')

cxx_binary(
  name = 'app', 
  srcs = [
    'main.cpp', 
  ],
  platform_deps = [
    ('macos.*', buckaroo_deps_from_group('macos')),
  ], 
)

Open questions:

  • What if the same package is in more than one dependency? Merge the groups?
  • What is a valid group? Alphanumeric?

This is how we should support development and platform dependencies.

Issue Analytics

  • State:open
  • Created 5 years ago
  • Comments:6

github_iconTop GitHub Comments

1reaction
njlrcommented, Feb 21, 2019

Given that the build scripts are written in Python (well, a Python variant called Skylark), a filter function is definitely possible. We can also have named arguments as you suggest (dev = True).

I think this could work well.

However, this leaves the question of custom groups. I think that this feature is very important, because we cannot anticipate all of the kinds of dependency that people might have.

We could also consider doing both! I’m not sure if the complexity will be worth it though.

1reaction
njlrcommented, Feb 21, 2019

Hi @iwatakeshi, thanks for the response!

Our initial idea was exactly as you describe, with os and dev as built-in concepts. We came up with two issues with this approach.

1. What do the macros look like when the user extracts the dependency?

With the “groups” approach, it looks like this:

macos_deps = buckaroo_deps_group([ 'macos' ])
macos_dev_deps = buckaroo_deps_group([ 'macos', 'dev' ])

But with the “os + dev” approach it (might) look like this:

macos_deps = buckaroo_deps_os('macos')
macos_dev_deps = buckaroo_deps_os_dev('macos') # Feels wrong!

I think the first way looks nicer. What do you think?

2. How do we support other kinds of group?

There might be more types of dependency, not just platform-specific or development-specific.

With the “groups” approach, the user can just define a new group:

[[dependency]]
package = "github.com/abc/lmno"
version = "*"
groups = [ "custom" ]

and use it like this:

custom_deps = buckaroo_deps_group([ 'custom' ])

I’m not sure how this could work with the “os + dev” approach. Any ideas?

None of this is implemented yet, so we would appreciate your thoughts!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Dependency groups
A dependency manager for .NET with support for NuGet packages and git repositories.
Read more >
About group dependencies
Group Members are monitors that make up the group. Group Dependencies are monitors that must remain available for all members to function properly....
Read more >
Using Dependency Groups
Dependency groups prevent a user from selecting selector values that yield empty search results, so that when two or more selectors are in...
Read more >
Defining a default dependency group
In the Default Dependency Group field, select one of the available transaction dependency groups from the drop-down list. Refer to Table 1 for...
Read more >
What's the difference between extras and groups in poetry?
Dependency groups in Poetry gives you the ability to put dependencies together you might only need in certain stages during development - ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found