Commit graph

11 commits

Author SHA1 Message Date
haarisr
1c2a7f6a85
Use directory instead of file when searching for uv.toml file (#3203)
## Summary

The function `find_in_directory` joins `uv.toml`. The initial join in
`user` is redundant.

Also a small comment fix.

## Test Plan

Not really sure how to test this. Please suggest if any tests need to be
added.
2024-04-23 14:36:38 -04:00
Zanie Blue
b9419e67aa
Add preview mode and use for warning in uv run (#3192)
Adds hidden `--preview` / `--no-preview` flags with `UV_PREVIEW`
environment variable support. Copies the `PreviewMode` type from Ruff.

Does a little bit of extra work to port `uv run` to the new settings
model.

Note we allow `uv run` invocations without preview and only use its
presence to toggle an experimental warning.

## Test plan

```
❯ cargo run -q -- run --no-workspace -- python --version
warning: `uv run` is experimental and may change without warning.
Python 3.12.2
❯ cargo run -q -- run --no-workspace --preview -- python --version
Python 3.12.2
❯ UV_PREVIEW=1 cargo run -q -- run --no-workspace -- python --version
Python 3.12.2
```
2024-04-22 15:41:15 -05:00
Charlie Marsh
70b6bde254
Add --python-platform to configuration (#3147)
## Summary

Just for consistency with `--python-version`.
2024-04-19 23:08:03 +00:00
Charlie Marsh
dfccdb0e39
Enable global configuration files (#3049)
## Summary

Enables `uv` to read configuration from (e.g.)
`/Users/crmarsh/.config/uv/uv.toml` on macOS and Linux, and
`C:\Users\Charlie\AppData\Roaming\uv\uv.toml` on Windows.

This differs slightly from Ruff, which uses the `Application Support`
directory on macOS. But I've deviated here. based on the preferences
expressed in https://github.com/astral-sh/ruff/issues/10739.
2024-04-17 13:59:50 -04:00
Charlie Marsh
c6e75f8b35
Add --config-file support (#3047)
## Summary

Users can now pass a config file on the command line, e.g., with
`--config-file /path/to/file.py`.
2024-04-17 17:32:29 +00:00
Charlie Marsh
7fb2bf816f
Add JSON Schema support (#3046)
## Summary

This PR adds JSON Schema support. The setup mirrors Ruff's own.
2024-04-17 17:24:41 +00:00
Charlie Marsh
e5d4ea55ca
Merge workspace settings with CLI settings (#3045)
## Summary

This PR adds the structs and logic necessary to respect settings from
the workspace. It's a ton of code, but it's mostly mechanical. And,
believe it or not, I pulled out a few refactors in advance to trim down
the code and complexity.

The highlights are:

- All CLI arguments are now `Option`, so that we can detect whether they
were provided (i.e., we can't let Clap fill in the defaults).
- We now have a `*Settings` struct for each command, which merges the
CLI and workspace options (e.g., `PipCompileSettings`).

I've only implemented `PipCompileSettings` for now. If approved, I'll
implement the others prior to merging, but it's very mechanical and I
both didn't want to do the conversion prior to receiving feedback _and_
realized it would make the PR harder to review.
2024-04-17 17:03:29 +00:00
Charlie Marsh
b1cb193d12
Add some tracing to workspace discovery (#3084) 2024-04-17 01:54:08 +00:00
Charlie Marsh
f9c4ca3473
Fix reference to pyproject.toml path in workspace discovery (#3083)
This is why we write tests 😂
2024-04-17 01:41:00 +00:00
Charlie Marsh
40d5a8adcf
Flatten settings into a single struct (#3079)
## Summary

This division proved to be not-so-useful in subsequent PRs.
2024-04-17 00:15:09 +00:00
Charlie Marsh
295b58ad37
Add uv-workspace crate with settings discovery and deserialization (#3007)
## Summary

This PR adds basic struct definitions along with a "workspace" concept
for discovering settings. (The "workspace" terminology is used to match
Ruff; I did not invent it.)

A few notes:

- We discover any `pyproject.toml` or `uv.toml` file in any parent
directory of the current working directory. (We could adjust this to
look at the directories of the input files.)
- We don't actually do anything with the configuration yet; but those
PRs are large and I want this to be reviewed in isolation.
2024-04-16 13:56:47 -04:00