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

Move from a shared tools.toml to separated tool receipts #4560

Merged
merged 2 commits into from
Jun 26, 2024

Conversation

zanieb
Copy link
Member

@zanieb zanieb commented Jun 26, 2024

Refactors the installed tool metadata per commentary in #4492

We now store a uv-receipt.toml per tool install instead of a single tools.toml

@zanieb zanieb added the preview Experimental behavior label Jun 26, 2024
@zanieb zanieb force-pushed the zb/tool-install-toml branch 2 times, most recently from 376afb9 to 233ba59 Compare June 26, 2024 18:07
@zanieb
Copy link
Member Author

zanieb commented Jun 26, 2024

I'll build more work on top of this demonstrating the purpose of the tool metadata entries, since there are some open questions about that.

@charliermarsh
Copy link
Member

Is it a goal or an explicit non-goal to support installing multiple versions of a given package?

@zanieb
Copy link
Member Author

zanieb commented Jun 26, 2024

Good question. I think if you want to do that then you need to provide a "suffix" to distinguish the entry points and we'd use that suffix in the tool name path. I'm kind of on the fence about that functionality to start.

@charliermarsh
Copy link
Member

In the initial design documents, I seem to recall something like uv tool run black+22.0.0. Or maybe that was for Python?

@charliermarsh
Copy link
Member

I think in cargo-dist they call this a "receipt", it's like a manifest that records what we installed. I might find terminology like that a little more intuitive than tool.toml which "feels" user-edited.

@zanieb
Copy link
Member Author

zanieb commented Jun 26, 2024

In the initial design documents...

We talked about that but people weren't really into it. If you're using uv tool run there's no reason to install something though. It was the idea of an automatic suffix with +<version>.

I think in cargo-dist they call this a "receipt"...

Down to call it that. As I mentioned before, I want to have a user-edited tool declaration eventually but am moving to this for now as it's clearer that it's not supposed to be user edited.

@zanieb
Copy link
Member Author

zanieb commented Jun 26, 2024

For reference, pipx uses pipx_metadata.json:

{
    "injected_packages": {},
    "main_package": {
        "app_paths": [
            {
                "__Path__": "/Users/zb/.local/pipx/venvs/black/bin/black",
                "__type__": "Path"
            },
            {
                "__Path__": "/Users/zb/.local/pipx/venvs/black/bin/blackd",
                "__type__": "Path"
            }
        ],
        "app_paths_of_dependencies": {},
        "apps": [
            "black",
            "blackd"
        ],
        "apps_of_dependencies": [],
        "include_apps": true,
        "include_dependencies": false,
        "man_pages": [],
        "man_pages_of_dependencies": [],
        "man_paths": [],
        "man_paths_of_dependencies": {},
        "package": "black",
        "package_or_url": "black",
        "package_version": "24.4.2",
        "pip_args": [],
        "suffix": ""
    },
    "pipx_metadata_version": "0.4",
    "python_version": "Python 3.12.3",
    "source_interpreter": {
        "__Path__": "/opt/homebrew/opt/python@3.12/libexec/bin/python",
        "__type__": "Path"
    },
    "venv_args": []
}% 

@zanieb zanieb changed the title Move from a shared tools.toml to separate tool.toml entries Move from a shared tools.toml to separated tool receipts Jun 26, 2024
Base automatically changed from zb/tool-install-force to main June 26, 2024 20:03
@zanieb zanieb marked this pull request as ready for review June 26, 2024 20:03
@zanieb
Copy link
Member Author

zanieb commented Jun 26, 2024

I guess it makes sense to write JSON directly? I don't have strong feelings about the format but am leaning towards just leaving it.

@charliermarsh charliermarsh merged commit fc681ec into main Jun 26, 2024
47 checks passed
@charliermarsh charliermarsh deleted the zb/tool-install-toml branch June 26, 2024 20:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
preview Experimental behavior
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants