Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Workspace, repository, and label terms are still confusing, esp. w.r.t. repostiory_name #16210

Closed
EricCousineau-TRI opened this issue Sep 2, 2022 · 10 comments
Assignees
Labels
P1 I'll work on this now. (Assignee required) team-Documentation Documentation improvements that cannot be directly linked to other team labels team-ExternalDeps External dependency handling, remote repositiories, WORKSPACE file. type: documentation (cleanup)

Comments

@EricCousineau-TRI
Copy link
Contributor

Description of the feature request:

It is a bit confusing two grok the two differences:

  • Label.workspace_name does not have @ in its name. However, native.repository_name() does have @ in its name. Is this nuance documented? (both are stated as "names")
  • I see the components that form a Label. However, it's a bit hard to denote the difference between "just" a package name (w.r.t. the 3 components) vs. a "qualified" package name (e.g. label of form {qualified_package}:{name}). Is there guidance on this?

The following docs are uber helpful:

But it'd still be nice to have something that denotes the minor difference, as well indicates some of term like "qualified package" to denote @workspace//package.

What underlying problem are you trying to solve with this feature?

Making terminology and usages clear and consistent eventually, and sifting through workarounds to #16209 (if that issue is actually valid).

Which operating system are you running Bazel on?

Ubuntu 20.04

What is the output of bazel info release?

release 5.1.0

If bazel info release returns development version or (@non-git), tell us how you built Bazel.

No response

What's the output of git remote get-url origin; git rev-parse master; git rev-parse HEAD ?

[email protected]:EricCousineau-TRI/repro.git
3c8f9afe4b0498b2920c262aebc5a756f75714bc
3c8f9afe4b0498b2920c262aebc5a756f75714bc

Have you found anything relevant by searching the web?

see above

Any other information, logs, or outputs that you want to share?

If at all helpful, this is some dumb heuristics from the following code (uncommenting certain pieces of code)
https://github.com/EricCousineau-TRI/repro/blob/3c8f9afe4b0498b2920c262aebc5a756f75714bc/bazel/label_stuff/defs.bzl#L22-L95

Label decomposition
//:lib:
  workspace:
  package:
  name: lib
//pkg:pkg:
  workspace:
  package: pkg
  name: pkg
//pkg:lib:
  workspace:
  package: pkg
  name: lib
@repo//:lib:
  workspace: repo
  package:
  name: lib
@repo//pkg:pkg:
  workspace: repo
  package: pkg
  name: pkg
@repo//pkg:lib:
  workspace: repo
  package: pkg
  name: lib

native.x() output:
In //pkg
  repository_name: @
  package_name: pkg
In //
  repository_name: @
  package_name:
In @repo//pkg
  repository_name: @repo
  package_name: pkg
In @repo
  repository_name: @repo
  package_name:
@sgowroji sgowroji added type: documentation (cleanup) team-ExternalDeps External dependency handling, remote repositiories, WORKSPACE file. untriaged labels Sep 5, 2022
@Wyverald Wyverald added P2 We'll consider working on this in future. (Assignee optional) and removed untriaged labels Sep 5, 2022
@Wyverald Wyverald added this to the 6.0.0 release blockers milestone Sep 5, 2022
@Wyverald
Copy link
Member

Wyverald commented Sep 5, 2022

Thanks for filing this. I'll definitely take some time to tackle this for 6.0.0, together with #15821

@Wyverald Wyverald self-assigned this Sep 5, 2022
@EricCousineau-TRI
Copy link
Contributor Author

Sweet, thanks!

If it helps at all, here was motivating application (or attempt haha):
EDIT: Usage https://github.com/EricCousineau-TRI/repro/tree/cf66d0d27ca9faad922d38f343bd693a43537483/drake_stuff/drake_downstream_pybind

@Wyverald Wyverald added P1 I'll work on this now. (Assignee required) and removed P2 We'll consider working on this in future. (Assignee optional) labels Sep 15, 2022
@Wyverald Wyverald removed this from the 6.0.0 release blockers milestone Sep 15, 2022
@Wyverald
Copy link
Member

Taking this off the milestone for now since it doesn't block branch cut. Will have to finish this before 6.0 launch though.

@ShreeM01 ShreeM01 added the team-Documentation Documentation improvements that cannot be directly linked to other team labels label Dec 5, 2022
@Wyverald
Copy link
Member

@bazel-io fork 7.1.0

@fmeum
Copy link
Collaborator

fmeum commented Dec 13, 2023

@Wyverald Could we also backport this to 6.5.0? Otherwise we will have to wait for one more year before we can disable the old API and/or allow rulesets to drop the feature detection required to work with both.

@Wyverald
Copy link
Member

@bazel-io fork 6.5.0

@Wyverald
Copy link
Member

Note -- there's another commit incoming that'll rename the new Label.local_target_label to Label.same_package_label. We should remember to cherry-pick that one into both 7.1.0 and 6.5.0 too.

copybara-service bot pushed a commit that referenced this issue Dec 18, 2023
"local" is an incredibly overloaded term.

Follow-up for #16210

RELNOTES: Label.local_target_label is renamed to Label.same_package_label.
PiperOrigin-RevId: 591940544
Change-Id: Ic050234471dc7c729a014794de57590a145b1e34
Wyverald added a commit that referenced this issue Dec 18, 2023
Been a long time coming.

* `native.repository_name()` is deprecated (has a spurious `@` prefix). A new method `native.repo_name()` is introduced instead.
* `Label.workspace_name` is deprecated (misnomer). A new field `Label.repo_name` is introduced instead.
* `Label.relative()` is deprecated (error-prone). A new method `Label.local_target_label()` is introduced with narrowed focus, alongside which `native.package_relative_label()` and `Label()` are recommended as replacements.

And then a bunch of documentation cleanups, hopefully reducing any potential confusion.

Fixes #16210.

RELNOTES:
Various methods and fields related to labels and repos are deprecated in favor of new options with clearer naming and intent. The deprecated APIs can be disabled by setting `--noincompatible_enable_deprecated_label_apis`.
* `native.repository_name()` is deprecated in favor of the new `native.repo_name()`.
* `Label.workspace_name` is deprecated in favor of the new `Label.repo_name`.
* `Label.relative()` is deprecated in favor of the new `Label.local_target_label()` alongside the existing `native.package_relative_label()` and `Label()`.
PiperOrigin-RevId: 590712228
Change-Id: I1724f3c4f3c21876a67f4a0291f6ebc0a1fa4b75
Wyverald added a commit that referenced this issue Dec 18, 2023
"local" is an incredibly overloaded term.

Follow-up for #16210

RELNOTES: Label.local_target_label is renamed to Label.same_package_label.
PiperOrigin-RevId: 591940544
Change-Id: Ic050234471dc7c729a014794de57590a145b1e34
@iancha1992
Copy link
Member

Note -- there's another commit incoming that'll rename the new Label.local_target_label to Label.same_package_label. We should remember to cherry-pick that one into both 7.1.0 and 6.5.0 too.

@Wyverald I just wanted to follow up on this. Do you want us to cherry-pick 6cb2d86 now to 7.1.0 and 6.5.0? Or are you pushing more changes?

@iancha1992
Copy link
Member

A fix for this issue has been included in Bazel 6.5.0 RC1. Please test out the release candidate and report any issues as soon as possible. Thanks!

Wyverald added a commit that referenced this issue Jan 22, 2024
Been a long time coming.

* `native.repository_name()` is deprecated (has a spurious `@` prefix). A new method `native.repo_name()` is introduced instead.
* `Label.workspace_name` is deprecated (misnomer). A new field `Label.repo_name` is introduced instead.
* `Label.relative()` is deprecated (error-prone). A new method `Label.local_target_label()` is introduced with narrowed focus, alongside which `native.package_relative_label()` and `Label()` are recommended as replacements.

And then a bunch of documentation cleanups, hopefully reducing any potential confusion.

Fixes #16210.

RELNOTES:
Various methods and fields related to labels and repos are deprecated in favor of new options with clearer naming and intent. The deprecated APIs can be disabled by setting `--noincompatible_enable_deprecated_label_apis`.
* `native.repository_name()` is deprecated in favor of the new `native.repo_name()`.
* `Label.workspace_name` is deprecated in favor of the new `Label.repo_name`.
* `Label.relative()` is deprecated in favor of the new `Label.local_target_label()` alongside the existing `native.package_relative_label()` and `Label()`.
PiperOrigin-RevId: 590712228
Change-Id: I1724f3c4f3c21876a67f4a0291f6ebc0a1fa4b75
Wyverald added a commit that referenced this issue Jan 22, 2024
"local" is an incredibly overloaded term.

Follow-up for #16210

RELNOTES: Label.local_target_label is renamed to Label.same_package_label.
PiperOrigin-RevId: 591940544
Change-Id: Ic050234471dc7c729a014794de57590a145b1e34
github-merge-queue bot pushed a commit that referenced this issue Jan 22, 2024
Been a long time coming.

* `native.repository_name()` is deprecated (has a spurious `@` prefix).
A new method `native.repo_name()` is introduced instead.
* `Label.workspace_name` is deprecated (misnomer). A new field
`Label.repo_name` is introduced instead.
* `Label.relative()` is deprecated (error-prone). A new method
`Label.local_target_label()` is introduced with narrowed focus,
alongside which `native.package_relative_label()` and `Label()` are
recommended as replacements.

And then a bunch of documentation cleanups, hopefully reducing any
potential confusion.

Fixes #16210.

RELNOTES:
Various methods and fields related to labels and repos are deprecated in
favor of new options with clearer naming and intent. The deprecated APIs
can be disabled by setting
`--noincompatible_enable_deprecated_label_apis`.
* `native.repository_name()` is deprecated in favor of the new
`native.repo_name()`.
* `Label.workspace_name` is deprecated in favor of the new
`Label.repo_name`.
* `Label.relative()` is deprecated in favor of the new
`Label.same_package_label()` alongside the existing
`native.package_relative_label()` and `Label()`.
Wyverald added a commit that referenced this issue Jan 23, 2024
Been a long time coming.

* `native.repository_name()` is deprecated (has a spurious `@` prefix).
A new method `native.repo_name()` is introduced instead.
* `Label.workspace_name` is deprecated (misnomer). A new field
`Label.repo_name` is introduced instead.
* `Label.relative()` is deprecated (error-prone). A new method
`Label.local_target_label()` is introduced with narrowed focus,
alongside which `native.package_relative_label()` and `Label()` are
recommended as replacements.

And then a bunch of documentation cleanups, hopefully reducing any
potential confusion.

Fixes #16210.

RELNOTES:
Various methods and fields related to labels and repos are deprecated in
favor of new options with clearer naming and intent. The deprecated APIs
can be disabled by setting
`--noincompatible_enable_deprecated_label_apis`.
* `native.repository_name()` is deprecated in favor of the new
`native.repo_name()`.
* `Label.workspace_name` is deprecated in favor of the new
`Label.repo_name`.
* `Label.relative()` is deprecated in favor of the new
`Label.same_package_label()` alongside the existing
`native.package_relative_label()` and `Label()`.
@iancha1992
Copy link
Member

A fix for this issue has been included in Bazel 7.1.0 RC1. Please test out the release candidate and report any issues as soon as possible. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P1 I'll work on this now. (Assignee required) team-Documentation Documentation improvements that cannot be directly linked to other team labels team-ExternalDeps External dependency handling, remote repositiories, WORKSPACE file. type: documentation (cleanup)
Projects
None yet
Development

No branches or pull requests

6 participants