Commit graph

312 commits

Author SHA1 Message Date
Charlie Marsh
df84d25a7e
Implement uv build (#6895)
## Summary

This PR exposes uv's PEP 517 implementation via a `uv build` frontend,
such that you can use `uv build` to build source and binary
distributions (i.e., wheels and sdists) from a given directory.

There are some TODOs that I'll tackle in separate PRs:

- [x] Support building a wheel from a source distribution (rather than
from source) (#6898)
- [x] Stream the build output (#6912)

Closes https://github.com/astral-sh/uv/issues/1510

Closes https://github.com/astral-sh/uv/issues/1663.
2024-09-04 11:23:46 -04:00
Zanie Blue
1996067f81
Add note to extra and all-extras in uv sync help (#7013) 2024-09-04 15:05:21 +00:00
Zanie Blue
dd2b2eb3fe
Fix available Docker image rendering and shorten list (#7017) 2024-09-04 08:47:34 -05:00
Charlie Marsh
3d75df6ab2
Bump version to v0.4.4 (#6988) 2024-09-04 00:30:38 +00:00
Zanie Blue
1fd27d768e
Add instructions for installing from Cargo (#6979) 2024-09-04 00:24:55 +00:00
Zanie Blue
88ba1e90a0
Add docs for UV_PROJECT_ENVIRONMENT (#6987) 2024-09-03 19:47:05 -04:00
Charlie Marsh
50d7b9c38a
Pin .python-version in uv init (#6869)
## Summary

I'm not convinced that the behavior is correct as-implemented. When the
user passes a `--python >=3.8` or we discover a `requires-python` from
the workspace, we're currently writing that request out to
`.python-version`. I would probably rather that we write the resolved
patch version?

Closes https://github.com/astral-sh/uv/issues/6821.
2024-09-03 19:43:50 -04:00
Zanie Blue
3e8d53c8eb
Document use of the file:// scheme in Python installation mirrors (#6984)
Documenting https://github.com/astral-sh/uv/pull/6950
2024-09-03 18:38:16 -05:00
Zanie Blue
614839e88b
Add optional dependencies section to the lockfile document (#6982)
Closes https://github.com/astral-sh/uv/issues/6729
2024-09-03 19:37:36 -04:00
Zanie Blue
4a6bea5321
Fix outdated references to the help menu documentation in the first steps page (#6980) 2024-09-03 17:14:38 -05:00
Zanie Blue
d87256bebe
Improve project handling in uv venv (#6835)
- Respect `UV_PROJECT_ENVIRONMENT` when in project root
- Add `--no-project` and `--no-workspace` to opt-out of above and
`requires-python` detection
- Rename `[NAME]` to `[PATH]` in CLI
2024-09-03 14:22:30 -05:00
eth3lbert
c667588524
Show env option in CLI reference documentation (#6863)
## Summary

Closes #6469.

<img width="721" alt="image"
src="https://github.com/user-attachments/assets/be144e43-e02f-473e-921c-91cf00c3c8d3">
2024-09-03 12:10:49 -05:00
David Bern
b7795024a8
docs docker.md: example to use bind mounts (#6921)
## Summary

Update the extended docker example to use bind mounts and avoid creating
extra layers and avoid copying files into layers

This is in line with the official Docker templates for Python
applications (you can try them out using `docker init`. I found them
very helpful!)
2024-09-03 09:36:54 -05:00
samypr100
37e25e2b1d
feat: introduce more docker tags for uv (#6053)
## Summary

Closes https://github.com/astral-sh/uv/issues/5610

This PR introduces additional images with the uv/uvx binaries from
scratch for both amd64/arm64 and make the mapping easy to configure by
generating the Dockerfile on the fly. This approach focuses on
minimizing CI time by taking advantage of dedicating a worker per
mapping (20-30s~ per job).

This PR also fixes `org.opencontainers.image.version` for all tags
(including the one from `scratch) to contain the right release version
instead of branch name `main` (default when no tag patterns are
specified).

For example, on release `x.y.z`, this will publish the following image
tags with format `ghcr.io/astral-sh/uv:{tag}` with manifests for both
amd64/arm64. This also include `x.y` tags for each respective additional
tag.

* From **scratch**: `latest`, `x.y.z`, `x.y` (currently being published)
* From **alpine:3.20**: `alpine`, `alpine3.20`, `x.y.z-alpine`,
`x.y.z-alpine3.20`
* From **debian:bookworm-slim**: `debian-slim`, `bookworm-slim`,
`x.y.z-debian-slim`, `x.y.z-bookworm-slim`
* From **buildpack-deps:bookworm**: `debian`, `bookworm`,
`x.y.z-debian`, `x.y.z-bookworm`
* From **python:3.12-alpine**: `python3.12-alpine`,
`x.y.z-python3.12-alpine`
* From **python:3.11-alpine**: `python3.11-alpine`,
`x.y.z-python3.11-alpine`
* From **python:3.10-alpine**: `python3.10-alpine`,
`x.y.z-python3.10-alpine`
* From **python:3.9-alpine**: `python3.9-alpine`,
`x.y.z-python3.9-alpine`
* From **python:3.8-alpine**: `python3.8-alpine`,
`x.y.z-python3.8-alpine`
* From **python:3.12-bookworm**: `python3.12-bookworm`,
`x.y.z-python3.12-bookworm`
* From **python:3.11-bookworm**: `python3.11-bookworm`,
`x.y.z-python3.11-bookworm`
* From **python:3.10-bookworm**: `python3.10-bookworm`,
`x.y.z-python3.10-bookworm`
* From **python:3.9-bookworm**: `python3.9-bookworm`,
`x.y.z-python3.9-bookworm`
* From **python:3.8-bookworm**: `python3.8-bookworm`,
`x.y.z-python3.8-bookworm`
* From **python:3.12-slim-bookworm**: `python3.12-slim-bookworm`,
`x.y.z-python3.12-slim-bookworm`
* From **python:3.11-slim-bookworm**: `python3.11-slim-bookworm`,
`x.y.z-python3.11-slim-bookworm`
* From **python:3.10-slim-bookworm**: `python3.10-slim-bookworm`,
`x.y.z-python3.10-slim-bookworm`
* From **python:3.9-slim-bookworm**: `python3.9-slim-bookworm`,
`x.y.z-python3.9-slim-bookworm`
* From **python:3.8-slim-bookworm**: `python3.8-slim-bookworm`,
`x.y.z-python3.8-slim-bookworm`
2024-09-03 08:44:01 -05:00
Charlie Marsh
ccdf2d793b
Add --no-hashes to uv export (#6954)
## Summary

Closes https://github.com/astral-sh/uv/issues/6944.
2024-09-02 22:12:29 -04:00
Charlie Marsh
b229230643
Use | for page separator in meta titles (#6953)
I generally prefer this style:

![Screenshot 2024-09-02 at 8 41
38 PM](https://github.com/user-attachments/assets/795dab85-b6c4-4278-913f-1d723379b225)
2024-09-03 00:42:59 +00:00
Charlie Marsh
fe17797240
Update URL in structured schema (#6952) 2024-09-02 20:28:36 -04:00
Charlie Marsh
92e93da81d
Add static assets to docs pages (#6951)
## Summary

This PR points the docs towards the static assets that we use for
`astral.sh`, so that we can use shared assets for the Ruff and uv docs.
2024-09-02 20:00:30 -04:00
Charlie Marsh
47f4ca24b3
Bump version to v0.4.3 (#6947) 2024-09-02 17:18:57 -04:00
Charlie Marsh
736ccb950a
Bump version to v0.4.2 (#6916) 2024-09-01 13:37:27 -04:00
Ed Morley
a5f1e1c765
Fix typos in docs, error messages and comments (#6910) 2024-09-01 11:37:43 +00:00
Mathieu Kniewallner
c9e4395322
docs: add missing console highlights (#6900)
## Summary

Spotted a few missing `console` highlights in the documentation.
2024-08-31 19:04:19 -04:00
Mathieu Kniewallner
fe5f085299
chore: run cargo dev generate-all on CI and locally (#6899)
## Summary

Noticed that running `cargo dev generate-all` on `main` produced changes
and saw that that the command is not run on the CI nor as a pre-commit
hook.

Not sure if having the command running as a pre-commit hook is something
we want, so I can remove it if you prefer. I find that nice to have as
it's probably easy to forget to run it, especially for new contributors
(and it will only run if there are changes in `uv_cli` or `uv_settings`
crates).

## Test Plan

- Added `cargo dev generate-all --mode check` on the CI, which produced
[this failing
job](2951669939)
- Ran `cargo dev generate-all` locally and committed the changes, which
produced [this succeeding
job](2951674494)
2024-08-31 19:03:53 -04:00
Ed Morley
d2df51f5f5
Fix missing word in config files docs (#6901) 2024-08-31 22:33:59 +01:00
Charlie Marsh
83467f0a51
Fix typos (#6891) 2024-08-30 19:45:33 -04:00
David Cardozo
0510842e1b
fix: typo in alternative-indexes.md docs (#6877)
## Summary

Small typo on the guide for alternative index

## Test Plan

I rerun the documentation to see the typo gone.
2024-08-30 11:11:36 -04:00
Charlie Marsh
823f23e225
Bump version to v0.4.1 (#6870) 2024-08-30 10:07:06 -04:00
Den Kasyanov
0ceefb3c88
Update FastAPI integration docs (#6833) (#6850)
## Summary

- Fixed the directory structure and commands for the second scenario
#6833
- Added a headline "Migrating an existing FastAPI project" because the
first part looks like a migration scenario, but didn't have its own
section before.
- Added explicit `--app` flags to commands to emphasize that the
commands create an Application project. Although maybe unnecessary
considering that `--app` is now default.
- Added instructions for testing that the dev server and Docker image
work correctly
- Took the liberty of adding a `project` at the root of all directory
structures and appropriate commands.
- With explicitly defined root directory it is easier to differentiate
between the `project` root directory and FastAPI's `app` directory.
- Without it it could be less obvious for developers less familiar with
FastAPI. Had a similar issue when started using Django several years
ago.
- If I left `app` in the command, then after copying the **app
directory** from https://github.com/astral-sh/uv-fastapi-example the
path would be `app/app/...`.
- Cleaned up glyphs in tree sctructures that were copied from FastAPI
docs.

## Caveats

- On project initialization `hello.py` is created. It is not reflected
in directory structure trees in this PR and may be slightly confusing
for developers less familiar with uv.
- I believe it will be soon addressed in #6750 and after that the docs
will reflect actual directory structure.
2024-08-30 10:00:26 -04:00
Zanie Blue
c91c99b35e
Drop old content from the FastAPI guide (#6851) 2024-08-29 22:22:37 -05:00
konsti
a39eb61ade
Use windows registry to discover python (#6761)
Our current strategy of parsing the output of `py --list-paths` to get
the installed python versions on windows is brittle (#6524, missing
`py`, etc.) and it's slow (10ms last time i measured).

Instead, we should behave spec-compliant and read the python versions
from the registry following PEP 514.

It's not fully clear which errors we should ignore and which ones we
need to raise.

We're using the official rust-for-windows crates for accessing the
registry.

Fixes #1521
Fixes #6524
2024-08-29 22:48:22 +02:00
Shantanu
57cb9c2957
Add docs for inline exclude newer (#6831)
See https://github.com/astral-sh/uv/pull/6562
2024-08-29 15:44:47 -05:00
Zanie Blue
09e359f5ad
Add a link to the multiple index docs in the alternative index guide (#6826) 2024-08-29 15:27:48 -05:00
Charlie Marsh
cbfc928a9c
Add uv export --format requirements.txt (#6778)
## Summary

The interface here is intentionally a bit more limited than `uv pip
compile`, because we don't want `requirements.txt` to be a system of
record -- it's just an export format. So, we don't write annotation
comments (i.e., which dependency is requested from which), we don't
allow writing extras, etc. It's just a flat list of requirements, with
their markers and hashes.

Closes #6007.

Closes #6668.

Closes #6670.
2024-08-29 17:46:42 +00:00
Franco Mariluis
670e9603ee
add docs for AWS CodeArtifact (#6816)
<!--
Thank you for contributing to uv! To help us out with reviewing, please
consider the following:

- Does this pull request include a summary of the change? (See below.)
- Does this pull request include a descriptive title?
- Does this pull request include references to any relevant issues?
-->

## Summary

This adds explicit information about using `uv` with AWS CodeArtifact
(both as an extra index to fetch private packages and also to publish
packages using `twine`).

## Test Plan

I'm currently using this setup with several private projects that use
CodeArtifact.

---------

Co-authored-by: Zanie Blue <contact@zanie.dev>
2024-08-29 12:40:41 -05:00
Charlie Marsh
f2ce80589f
Omit [pip] section from configuration file docs (#6814)
## Summary

Closes https://github.com/astral-sh/uv/issues/6800.
2024-08-29 12:57:13 -04:00
my1e5
f956ab8fae
Update default hello.py to pass ruff format (#6811)
Closes https://github.com/astral-sh/uv/issues/6808
2024-08-29 10:31:52 -04:00
Zanie Blue
aad00d22e4
Fix up reference to environment markers in resolver reference (#6773) 2024-08-28 18:00:43 -04:00
Zanie Blue
98577b52bf
Enumerate available Docker tags (#6768) 2024-08-28 13:51:23 -05:00
Charlie Marsh
d9bd3bc7a5
Bump to v0.4.0 (#6764) 2024-08-28 17:29:16 +00:00
Charlie Marsh
cef3d35405
Support {package}@{version} in uv tool install (#6762)
## Summary

Closes https://github.com/astral-sh/uv/issues/6759.

Closes https://github.com/astral-sh/uv/issues/6535.
2024-08-28 12:40:49 -04:00
Zanie Blue
451eef31a6
Bind to the host to allow connections in FastAPI Docker example (#6753)
This wouldn't allow connections as written
2024-08-28 10:33:54 -05:00
Zanie Blue
37e29f1109
Update FastAPI guide for virtual projects and use uv init to create the pyproject.toml (#6752)
Follows https://github.com/astral-sh/uv/pull/6751

Matches https://github.com/astral-sh/uv-fastapi-example/pull/3
2024-08-28 10:33:46 -05:00
Zanie Blue
50c4341cc6
Remove build system from FastAPI guide (#6751)
Matches https://github.com/astral-sh/uv-fastapi-example/pull/2
2024-08-28 10:33:38 -05:00
Zanie Blue
f96b4c7837
Add dependabot and renovate documentation page (#6236)
cc @mkniewallner

---------

Co-authored-by: Mathieu Kniewallner <mathieu.kniewallner@gmail.com>
2024-08-28 07:41:23 -05:00
Zanie Blue
75a5066e10
Improvements to the application and library documentation (#6726) 2024-08-27 23:15:12 +00:00
Charlie Marsh
c1e831881b
Update workspace documentation to remove legacy virtual projects (#6720) 2024-08-27 17:31:12 -04:00
Zanie Blue
d5d8375c7e
Update project documentation for the application / library concepts (#6718)
Follows https://github.com/astral-sh/uv/pull/6689 and
https://github.com/astral-sh/uv/pull/6585
2024-08-27 16:22:31 -05:00
Zanie Blue
bc5b069a61
Add --app and --lib options to uv init (#6689)
Changes the `uv init` experience with a focus on working for more
use-cases out of the box.

- Adds `--app` and `--lib` options to control the created project style
- Changes the default from a library with `src/` and a build backend
(`--lib`) to an application that is not packaged (`--app`)
- Hides the `--virtual` option and replaces it with `--package` and
`--no-package`
- `--no-package` is not allowed with `--lib` right now, but it could be
in the future once we understand a use-case
- Creates a runnable project
- Applications have a `hello.py` file which you can run with `uv run
hello.py`
- Packaged applications, e.g., `uv init --app --package` create a
package and script entrypoint, which you can run with `uv run hello`
- Libraries provide a demo API function, e.g., `uv run python -c "import
name; print(name.hello())"` — this is unchanged

Closes #6471
2024-08-27 18:08:09 +00:00
Charlie Marsh
eb14056e9c
Add support for virtual projects (#6585)
## Summary

The basic idea here is: any project can either be a package, or not
("virtual").

If a project is virtual, we don't build or install it.

A project is virtual if either of the following are true:

- `tool.uv.virtual = true` is set.
- `[build-system]` is absent.

The concept of "virtual projects" only applies to workspace member right
now; it doesn't apply to `path` dependencies which are treated like
arbitrary Python source trees.

TODOs that should be resolved prior to merging:

- [ ] Documentation
- [ ] How do we reconcile this with "virtual workspace roots" which are
a little different -- they omit `[project]` entirely and don't even have
a name?
- [x] `uv init --virtual` should create a virtual project rather than a
virtual workspace.
- [x] Running `uv sync` in a virtual project after `uv init --virtual`
shows `Audited 0 packages in 0.01ms`, which is awkward. (See:
https://github.com/astral-sh/uv/pull/6588.)

Closes https://github.com/astral-sh/uv/issues/6511.
2024-08-27 13:42:46 -04:00
Zanie Blue
c56102bde3
Fix some broken links (#6705) 2024-08-27 17:24:49 +00:00