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

Add user-friendly functions to add locations #184

Merged
merged 5 commits into from
Oct 18, 2024
Merged

Add user-friendly functions to add locations #184

merged 5 commits into from
Oct 18, 2024

Conversation

richfitz
Copy link
Member

This annoyed me every time I tried to show someone orderly, so fixing it now before I teach it to a room of people.

I was trying to be too general with orderly_location_add but we can make it much nicer if we have functions orderly_location_add_path etc with nice arguments, docs and autocomplete for them.

For custom locations we might add similar functions within their packages then if users use library() they'll be available.

A very noisy diff but this is mostly just using the new version throughout the tests

@richfitz richfitz marked this pull request as ready for review October 17, 2024 16:31
@richfitz richfitz requested a review from plietar October 17, 2024 16:31
Copy link
Member

@plietar plietar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes thank you. This has annoyed me many times before as well.

One alternative would be to have a generic orderly_location_add, which just takes a string and figures it out, like Git does it. We would need some kind of negotiation to determine if an http URL is an outpack_server or a Packit instance (or we use packit+https://, but that's ugly). We would lose some flexibility if we did that though.

In any case this PR is a good step forward already as is.

As a side-note, at some point maybe before next week's workshop I want to get Packit to display on its home page the line of code needed to add the location to a local workspace, in an easily copy-pasteable way, similar to how GitHub does for new repositories.

##'
##' We currently support two types of locations - `path`, which points
##' We currently support three types of locations - `path`, which points
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

two types of locations and off by one errors 😁

##'
##' @param path The path to the other archive root. This should
##' generally be an absolute path, or the behaviour of outpack will
##' be unreliable.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be worth cleaning up and defining the semantics of a relative path at some point (not in this PR). IMO it should be relative to the orderly root, and be resolved each time we use the location, not when it is first added.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you thinking here again of people on the cluster where directories "move"?

##' @param token The value for your your login token (currently this
##' is a GitHub token with `read:org` scope). If `NULL`, orderly2
##' will perform an interactive authentication against GitHub to
##' obtain one.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Technically this can be a Packit JWT instead of a GitHub PAT, but we don't really publicize any way of obtaining those so I think it is fine if you don't want to mention it here.

This is the only place a JWT would be used today: https://github.com/mrc-ide/orderly-action/blob/main/packit-login.R#L65-L69

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just copied this in from the string that was present in the Details for now

@richfitz
Copy link
Member Author

One alternative would be to have a generic orderly_location_add, which just takes a string and figures it out, like Git does it. We would need some kind of negotiation to determine if an http URL is an outpack_server or a Packit instance (or we use packit+https://, but that's ugly). We would lose some flexibility if we did that though.

No objection to supporting that; it's concice and would be portable to the Python version too. But it would make custom locations hard to support, and we already have a couple of those now.

As a side-note, at some point maybe before next week's workshop I want to get Packit to display on its home page the line of code needed to add the location to a local workspace, in an easily copy-pasteable way, similar to how GitHub does for new repositories.

This is a great idea

@richfitz richfitz merged commit 581a8e9 into main Oct 18, 2024
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants