Commit Graph

178 Commits

Author SHA1 Message Date
Charlie Marsh ae35a215c6
Accept `setup.py` and `setup.cfg` files in compile (#2634)
## Summary

This costs us ~nothing now that we support using PEP 517 hooks for
`pyproject.toml`.

## Test Plan

`cargo test`
2024-03-25 20:39:35 +00:00
Charlie Marsh 01b7a27be4
Add top-level benchmark to the README (#2622)
## Summary

Steps involved in creating this:

- Open the raw data in
[Vega-Lite](https://vega.github.io/editor/#/url/vega-lite/N4IgJAzgxgFgpgWwIYgFwhgF0wBwqgegIDc4BzJAOjIEtMYBXAI0poHsDp5kTykBaADZ04JAKyUAVhDYA7EABoQAEySYUqUMSSCGcCGgDaoTGzaC0IHAwBmNmvKVQksOJYDuSAE4JFIJnCysMheANaWXvrmpH6YNAhuqAAMlEkAjADMACwA7GIAbBn5AJw5ABxiYlkATGn5SnEJAGJsPmqWKekGAL4KJmYW6NZ2Dn7Orh7evkoBQTAh4egOEOqCFg3xiZ1iOfnVZcXFSWUbza3ImB2p+T19IKbmlsP2jiDj8JZQ5sp+s8HeixAkRkghipy2lDESSSWQyOSSxXye3BLTal3QKSht36jyGbDgmC8AE8xi4PuhPD5foF-mEIlFQW5wWgUvkktVyvDqvkcllodDqijzu0MZQ2dj7gMnrYXqSJugvoIfjMafMAZZlqt1vdNizKDkjjk0pk0sU6vz0kK0VcDRKHoMrPjCSSnGTEiBKdN-KqFhrZCsdNrGhDimUcrUykUxEcLWkrRcroc7VKhjQcPwvggcDRBEy3m7JlSVXNfehgdE88G0GlIQU6vkxGUEVl4yKQDWCsncVZlF73u7PdSS+qlv6tbFdagawcSvk0tUsmbDsviq30e3KEcuw6cE7iXLyW9vkPaYDNYGJwk0NVKPOF-kso3o-UdWdregb-Pt09ewf3YrlW9Yc6VHAM1kvRIbyyMMkiKNI+SSF9g1RBMP0oRdvyGX9XXlD0phPNUQKBBkwVfRIMkoOE+SyWEMmOBDoQyNdLAouFMMdAl9xww8AII0tiJBUiq1QLJKGqYoCgqaFigyQUyJQttRLo9js3TTNs1zP9PmPYtT3pQTK0nUTKjEDJSjSMosnnZj0GMm4QF6HEdzTfgICJIItIpfDdMIs8xwvZkRLFDJMmgjIym5GyQFEwoVJctyPO4-8dKAvTQPHQKclSapGJhNkyjZaE43k4V1yy9kVOw-NcN4nz+PLRkILQLLahycKihhJdlyilrqh6ABdXp7i8JB-Rsc4jFAexBEwOAvEsVRMAYBBKH7AACABeDa1oAck9HaHLuabZvm9BFuWyg-l8zbtp2881gO7p+qcOR7DINBQBwJBlGUBx3uSJQvpGhADFQYwQFkJArzOuAbCQBgZpaWRLiUbRdHdfgkBwHBc1cokVkQBQACFhFkUIAFkXAAZXx2aECRzAFAAHRAKnyHxNaAFUAEkWYUAAJOBGTiZwFAAQS8GgdAUCBRogVy5poGxmZAMXsdzNaAGFzFaNaAFEEDYSQaD5lm2bIDmef1w3jZZw7QEh6GdUwXNtcEVo-DRvRLAAYgyf2A-tiGofdQQkACQQ3Y91GdG99A-YD-2HOejA4G+uaPpAMOI4ZzO4AADxwU6VFh+HEbkS4hriF24FzzQQALouFtLhHMFzqu6FzBmAHU4BoMgsDQKEkirgv0Smiu88L4vlBb8vkcOo93dO0BG+L7Ohaj+buiG0sJ4X+u1+buHW-bl7l6npv0A3yOde3jua8z8aD9X6fj7LtvJ6GiBmGrrvJ8Pm-GGJ956VyUM-TAvd+6D1QMPIaSB840FBqAG+W9L7r3DpvO+i8b511flfEuIDP4Lwfv-F+DcgGEI-mfZ2ZDIF9wHuiYeGwa5oMAQQv+cA0GkNrhXKmNAABeiR5xDVzGQQIPx66cJ7gwmBzDaFcOwew4unDuEsLofwoR1Y5KoKUfgjBEc1FZ0wYIPBFCCGzyITQ6RAD9Hv1Pl-IaxAaBwHcJnFYXg2ChESLIBGgghpMBcKEMgniGCyEkcNOWQNAhgJABAL6UA-poCKDMIJIS2BhIiYSKJ3gYl+DhlAAkmdPFuPrvYIWESrq+iUDILw65Z7QAkUk9RPi-FKHgOnU6vi1g7yUA1GI9doA6ESKAfOfpZ44AkXkpQJJRwTKmSQ7+kyoB5yCGwX6sh-qgFmVNFxSpLD2liESSZlhZBsAQA4HQfgEFIMziEmgki4aCAgHAFpaBumCCULgvhgjhFyRFqEUGTyXlfJMQABW+hs-6aQkhKGUOcpAoxUDArgN-Vo6IPlDTGfXJAZAQl8FmpYH+Xpyn7PQFWBoxz3QAEcGCjWrmoGgpEbnIIUe8tpxiI560oedFaXs4BrQANS7QgAdDYUBQjazCeiJiOoJWaK2KCiOEKfpJNQC+G+YthBkHkAqGJGclVCwZgq7R4rJVKKBGQQJAAKecOQFB2odRyBQKRqhiAAJR+HucoNhlqbWOoDc611Hq-DwuQEilFO8hrwGgeiI4Sh3APPoGgBCoKiQZzBqAfigT5pKBpOstVoAIC-Mzvy6sGQhqKg9vXL44S6DsF1SYfQ9S1AXXtDdXazwHBipAGW+OhQ+Ri01ovPtIAfYDqSEOhyvSTAjTGhNTNIBjoZpUK2la7aACEW1O0ym7cnJQe97hUoOWPa52rdVZ1hijfwSAXmk3dBcn6mk4XYpfBAk1U45LTQdAnROi981QszrNfO48l17KyZsBSlcZ2RPnVSRdy6Z5rsoO2rat0u2yEeinQ9mBj3ktPUoHQ-cL25hsNewJd6HAPoecoZ9KhX3gJ+Voz9jHkZQMYZYJgx4hoAcLfcU9ZTwMHMg6VRe37M61t+nEOQQHm0LWQ6h9Du7MOe1ju6X9gcnFqd9onJOUbBrdCAA).
- Download as SVG.
- Manually edit to: (1) remove all class names, (2) change the width and
height to match the view box, (3) change puffin to uv, (4) make uv bold.
- Copy to create the dark-mode variant, and replace `#333333` with
`#C9D1D9`.
2024-03-22 16:07:31 -04:00
Auca Coyan 7d5d9a92c3
return the link to the CI badge (#2616)
## Summary

After I did #2612 , broke the badge and #2613 fixed it (thanks konstin!)
I return the functionality to go to the actions tab when you click the
badge:

[![Actions
status](https://github.com/astral-sh/uv/actions/workflows/ci.yml/badge.svg)](https://github.com/astral-sh/uv/actions)
2024-03-22 15:58:10 +00:00
konsti a4fb2ad739
Add missing .yml for badge (#2613) 2024-03-22 13:55:50 +00:00
Auca Coyan c1e1562a89
Update badge to current CI status. Remove the link to `/actions` (#2612)
## Summary

Hi! I noticed the badge in the `README.md` says CI it's failing

[![Actions
status](https://github.com/astral-sh/uv/workflows/CI/badge.svg)](https://github.com/astral-sh/uv/actions)

But current main CI is okay. The problem is that badge is bringing the
latest actions ran in the repo. Even if it's from a PR
So I changed to this link:

![Action
Status](https://github.com/astral-sh/uv/actions/workflows/ci.yml/badge.svg)

It shows the current main branch CI status, but _I couldn't get the link
to work (go into `uv/actions`)_. Is it acceptable to lose some
functionality in order to display the correct information?

## Test Plan

manually
2024-03-22 12:38:56 +00:00
T-256 eb59cdaee9
Add example for compile current env packages (#1968)
## Summary
I was going to create a feature-request issue for adding graph like
showing of currently installed dependencies in venv, but then I found
`uv pip freeze | uv pip compile` is what I'm looking for.

As one who manually pip-installs packages every once in a while (instead
of edit `requirements.in` each time), after a while I would need to have
graph of installed packages (e.g. to see how uninstallinga packages
effects on others).

I found this command is so useful and wondered if we could have this in
docs as one of `uv` features.
## Test Plan

<!-- How was it tested? -->

---------

Co-authored-by: Zanie Blue <contact@zanie.dev>
2024-03-18 20:06:15 -05:00
Zanie Blue 1d63b1cf7b
Document HTTP authentication (#2425) 2024-03-13 22:53:26 +00:00
Charlie Marsh bfddd729b7
Add `UV_NATIVE_TLS` environment variable (#2412)
Closes https://github.com/astral-sh/uv/issues/2409.
2024-03-13 14:29:31 +00:00
samypr100 e0ac5b4e84
feat: keep backwards compatibility with `SSL_CERT_FILE` without requiring `--native-tls` (#2401)
## Summary

Small follow up to https://github.com/astral-sh/uv/pull/2362 to check if
`SSL_CERT_FILE` is set to enable `--native-tls` functionality. This
maintains backwards compatibility with `0.1.17` and below users
leveraging only `SSL_CERT_FILE`.

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

## Test Plan

<!-- How was it tested? -->
Assuming `SSL_CERT_FILE` is already working via `--native-tls`, this is
simply a shortcut to enable `--native-tls` functionality implicitly
while still being able to let `rustls-native-certs` handle the loading
of `SSL_CERT_FILE` instead of ourselves.

Edit: Manually tested by setting up own self-signed CA certificate
bundle and set `SSL_CERT_FILE` to this and confirmed the loading happens
without having to specify `--native-tls`.
2024-03-13 04:33:10 +00:00
Robert Resch 7cb01688aa
Fix left over after renaming UV_SYSTEM to UV_SYSTEM_PYTHON (#2379)
<!--
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

<!-- What's the purpose of the change? What does it do, and why? -->
Fix left over after renaming UV_SYSTEM to UV_SYSTEM_PYTHON in
https://github.com/astral-sh/uv/pull/2354
CC @charliermarsh 

## Test Plan

<!-- How was it tested? -->
2024-03-12 10:10:01 +01:00
Charlie Marsh e9c16e9aa2
Enable TLS native root toggling at runtime (#2362)
## Summary

It turns out that on macOS, reading the native certificates can add
hundreds of milliseconds to client initialization. This PR makes
`--native-tls` a command-line flag, to toggle (at runtime) the choice of
the `webpki` roots or the native system roots.

You can't accomplish this kind of configuration with the `reqwest`
builder API, so instead, I pulled out the heart of that logic from the
crate
(e319263851/src/async_impl/client.rs (L498)),
and modified it to allow toggling a choice of root.

Note that there's an open PR for this in reqwest
(https://github.com/seanmonstar/reqwest/pull/1848), along with an issue
(https://github.com/seanmonstar/reqwest/issues/1843), which I may ping,
but it's been around for a while and I believe reqwest is focused on its
next major release.

Closes https://github.com/astral-sh/uv/issues/2346.
2024-03-12 04:05:49 +00:00
Robert Resch 85483e88a4
Add env UV_SYSTEM as alias to --system (#2354)
## Summary

Add a new env variable `UV_SYSTEM` as alias for the cli argument
`--system`.
Use cases:
- No need to specify on each uv call inside the docker container the
`--system` flag
- It allows installing and configuring uv in a base container and in the
child containers nobody needs to know if you need the `--system` cli
flag
- The Home Assistant development env can be set up via devcontainer or a
venv. Both use some common scripts. Instead of adding duplicate or
special code to identify the dev container to set the `--system` flag,
it would be nicer to set it via an env variable.

I'm unfamiliar with Rust and tried to add the support by looking at the
code.

## Test Plan

I did test it manually
`UV_SYSTEM_PYTHON=true uv pip install requests`
2024-03-11 20:56:45 +00:00
Charlie Marsh a9a211a407
Document the environment variables that uv respects (#2318)
Closes https://github.com/astral-sh/uv/issues/2303.
2024-03-10 00:47:46 +00:00
Charlie Marsh 791207c14f
Add `PIP_COMPATIBILITY.md` to document known deviations from `pip` (#2244)
## Summary

Closes https://github.com/astral-sh/uv/issues/2023.
2024-03-06 21:33:27 +00:00
Zanie Blue ffb69e3f48
Expose the `--exclude-newer` flag (#2166)
Closes https://github.com/astral-sh/uv/issues/2088
2024-03-04 17:51:19 +00:00
Charlie Marsh 782a862e92
Add caveats on `--system` support to the README (#2131)
## Summary

Covering some of the limitations from
https://github.com/astral-sh/uv/issues/2113.
2024-03-02 10:07:57 -05:00
samypr100 5083f51d68
docs: add note about ssl_cert_file env var (#2124) 2024-03-02 01:37:27 +00:00
Charlie Marsh b983ff4fa7
Prioritize `PATH` over `py --list-paths` in Windows selection (#2057)
`uv --system` is failing in GitHub Actions, because `py --list-paths`
returns all the pre-cached Pythons:

```
-V:3.12 *        C:\hostedtoolcache\windows\Python\3.12.2\x64\python.exe
-V:3.12-32       C:\hostedtoolcache\windows\Python\3.12.2\x86\python.exe
-V:3.11          C:\hostedtoolcache\windows\Python\3.11.8\x64\python.exe
-V:3.11-32       C:\hostedtoolcache\windows\Python\3.11.8\x86\python.exe
-V:3.10          C:\hostedtoolcache\windows\Python\3.10.11\x64\python.exe
-V:3.10-32       C:\hostedtoolcache\windows\Python\3.10.11\x86\python.exe
-V:3.9           C:\hostedtoolcache\windows\Python\3.9.13\x64\python.exe
-V:3.9-32        C:\hostedtoolcache\windows\Python\3.9.13\x86\python.exe
-V:3.8           C:\hostedtoolcache\windows\Python\3.8.10\x64\python.exe
-V:3.8-32        C:\hostedtoolcache\windows\Python\3.8.10\x86\python.exe
-V:3.7           C:\hostedtoolcache\windows\Python\3.7.9\x64\python.exe
-V:3.7-32        C:\hostedtoolcache\windows\Python\3.7.9\x86\python.exe
```

So, our default selector returns the first entry here. But none of these
are actually in `PATH` except the one that the user installed via
`actions/setup-python@v5` -- that's the point of the action, that it
puts the correct versions in `PATH`.

It seems to me like we should prioritize `PATH` over `py --list-paths`.
Is there a good reason not to do this?

Closes: https://github.com/astral-sh/uv/issues/2056
2024-02-29 15:06:29 +00:00
Charlie Marsh f68b2d1d5e
Bump version to v0.1.12 (#2051) 2024-02-28 15:36:22 -05:00
Charlie Marsh 3116c371a7
Add `uv pip install --python` to README (#2030) 2024-02-27 21:54:33 -05:00
samypr100 53a250714c
docs: clarify lowest vs lowest-direct resolutions (#1954)
## Summary

Closes #1915

Small change to clarify lowest vs lowest-direct.
2024-02-24 22:15:01 +00:00
konsti af06a6fe0a
Use more universal windows install instructions (#1811)
Recommend installing uv on windows with

```
powershell -c "irm https://astral.sh/uv/install.ps1 | iex"
```

instead of

```
irm https://astral.sh/uv/install.ps1 | iex
```

to support installing on cmd.exe, the classic non-powershell windows
command prompt.

See https://github.com/axodotdev/cargo-dist/issues/458 for background.
This will also be included in the next cargo-dist release.

I have confirmed this passes on
 * Command Prompt
 * Windows PowerShell
 * PowerShell
 * git bash

Closes #1750

CC @12932 this fixes the uv command prompt installation.
2024-02-22 09:25:33 +00:00
Zanie Blue d80eee1f8c
Add docs for git authentication (#1844)
[Rendered](https://github.com/astral-sh/uv/blob/zb/auth-docs/README.md#git-authentication)

Adds docs for
- #1781 
- #1717
2024-02-21 21:30:11 -05:00
samypr100 b3be53bb46
[docs] Update README.md to include extras example (#1806)
## Summary

<!-- What's the purpose of the change? What does it do, and why? -->
There was no example of to hint support for extras in the README.md.

I added one example in the install section that is used in the uv tests.
2024-02-21 20:13:07 -06:00
samypr100 f441f8fa9b
docs: update venv activation for windows (#1836)
## Summary

Follow on to PR https://github.com/astral-sh/uv/pull/1811 as part of
issue https://github.com/astral-sh/uv/issues/1750. This change updates
the windows venv activation to work for both Powershell and Command
Prompt instead of just Powershell. This also aligns with what `uv venv`
displays.
2024-02-21 22:16:40 +00:00
Orhun Parmaksız 25f0157f0a
docs(readme): add instructions for installing on Arch Linux (#1765)
## Summary

I packaged `uv` in the official repositories:
https://archlinux.org/packages/extra/x86_64/uv/

This PR simply updates README.md to add the instructions to install the
package.

## Test Plan

None.
2024-02-20 11:33:56 -05:00
12932 f668fd8d59
Clarify Windows install command in README.md (#1751)
Specify that the command to run for Windows is for powershell

## Summary

Clarifies the usage of the command to run to install uv on Windows
(powershell only)

## Test Plan

It wasn't 😈

---------

Co-authored-by: konsti <konstin@mailbox.org>
2024-02-20 12:54:35 +00:00
Charlie Marsh bb876d95ed
Move `uv clean` to `uv cache clean` (#1733)
## Summary

This opens up space to add other cache-related commands. (`uv clean`
continues to work for backwards compatibility but is hidden from the
CLI.)
2024-02-20 04:14:05 +00:00
Henry Schreiner c6fd3d97fb
fix: remove uv version from uv pip compile header (#1716)
## Summary

This fixes https://github.com/astral-sh/uv/issues/1704 by removing the
version from the produced header.

## Test Plan

Checked with clippy, and tests are updated too.
2024-02-19 20:26:53 +00:00
kopp 4b92a51218
fix: use --override rather than -o to specify overrides in README.md (#1668)
## Summary

Fix documentation (Readme.md):
`-o` is the short for `--output-file`, so using `-o overrides.txt` would
store the output in `overrides.txt` rather than using that as overrides.

## Test Plan

no tests for docs (yet?)
2024-02-18 17:55:27 -06:00
Zanie Blue fd1af476b2
Add brew to readme (#1629)
Closes https://github.com/astral-sh/uv/issues/1627
2024-02-18 07:49:50 +00:00
Charlie Marsh 1110489c29
Bump version to v0.1.3 (#1557) 2024-02-16 19:45:29 -05:00
Dylan Storey 63987e4f8f
Provide example of file based package install. (#1424)
Added example to install packages from a file w/o editable mode.

I use `pip install .` in a number of CI/CD and build scripts - it wasn't
obvious to me how to achieve this with uv as `uv pip install .` throws
an error about package names being expected to start with an
alphanumeric character.

---------

Co-authored-by: Zanie Blue <contact@zanie.dev>
2024-02-16 14:34:04 +00:00
Charlie Marsh 659327f24a
Bump version to v0.1.2 (#1439) 2024-02-16 01:17:19 -05:00
Jacob Coffee 33dd5f0f90
chore(docs): update wording and add `alt` tag (#1423)
Small grammar updates for word flow

I believe the "Support for a wide range of advanced..." section could
also be changed to a sub-bullet list if this is more preferred?

Feel free to close :)

---------

Co-authored-by: Zanie Blue <contact@zanie.dev>
2024-02-16 05:22:44 +00:00
CJ 8ef396e849
Update README.md to include venv activate (#1411)
This is just a small readme change to include venv activation.
In case someone just follows the docs as-is, they will end up installing
packages outside of the desired virtual env.

---------

Co-authored-by: Zanie Blue <contact@zanie.dev>
2024-02-15 20:20:25 -06:00
Brett Cannon 515a494f05
Tweak some grammar in the README (#1387) 2024-02-16 00:10:07 +00:00
Charlie Marsh 3559f0e6ab
Re-add license badge to the README (#1333) 2024-02-15 17:22:08 -05:00
Zanie Blue c43a5ba3aa
Replace "novel" in README (#1365)
Per some prior discussion, "novel" can be confusing in this context as
it's not clear what we're referring to.

PDM supports overrides — so I'll just drop this.

If anyone knows of other tools that support overrides and alternative
resolution strategies please let me know I'd love to look at how they've
implemented it :)
2024-02-15 22:09:27 +00:00
Jared Forsyth 12caff3850
grammar nit (#1345) 2024-02-15 21:22:29 +00:00
Zanie Blue 12c19ce506
Drop license badge for now; cached as UNKNOWN on CDNs (#1328)
We don't want to confuse people.

It's MIT / Apache dual licensed.

We'll restore this later once the cache is refreshed.
2024-02-15 13:57:59 -06:00
Zanie Blue 2586f655bb
Rename to `uv` (#1302)
First, replace all usages in files in-place. I used my editor for this.
If someone wants to add a one-liner that'd be fun.

Then, update directory and file names:

```
# Run twice for nested directories
find . -type d -print0 | xargs -0 rename s/puffin/uv/g
find . -type d -print0 | xargs -0 rename s/puffin/uv/g

# Update files
find . -type f -print0 | xargs -0 rename s/puffin/uv/g
```

Then add all the files again

```
# Add all the files again
git add crates
git add python/uv

# This one needs a force-add
git add -f crates/uv-trampoline
```
2024-02-15 11:19:46 -06:00
Charlie Marsh 328b116d5d
Fix README (#1315)
Oversight and typo.
2024-02-15 17:01:54 +00:00
Charlie Marsh 8bc81aaf70
Update README (#1307) 2024-02-15 09:54:29 -05:00
Charlie Marsh ea13d94c57
Fix dependency overrides link in README (#1297) 2024-02-13 17:09:18 +00:00
Zanie Blue 942e353f65
Change ordering of highlights in readme (#1289)
Also, shorten some more items
2024-02-12 18:45:26 -06:00
Zanie Blue 2a3e817d53
Shorten the novel features highlight in README (#1265) 2024-02-12 20:04:50 +00:00
Charlie Marsh 929715f4e2
Swap out Discord icon (#1287) 2024-02-12 19:29:22 +00:00
Zanie Blue ffb19b9a52
Add a error messages highlight to the README (#1264) 2024-02-08 23:12:22 +00:00
Charlie Marsh 0e35041ccd
Add Python version support (#1239)
Closes https://github.com/astral-sh/puffin/issues/1221.
2024-02-04 21:56:00 +00:00
Charlie Marsh fcf848877c
Change 'duplication' to 'deduplication' (#1223) 2024-02-01 14:13:45 +00:00
Charlie Marsh ec816a3322
Update Python discovery documentation (#1194)
Closes https://github.com/astral-sh/puffin/issues/1109.
2024-01-31 15:42:32 +00:00
Charlie Marsh 7ae9d3c631
Remove Windows limitation from README (#1195) 2024-01-30 21:39:15 +00:00
Charlie Marsh d94cf0e763
Remove specific MUSL mention from README (#1171)
See:
https://github.com/astral-sh/puffin/pull/1158#discussion_r1469603073.
2024-01-29 13:50:23 +00:00
Charlie Marsh fe03e74669
Add platform support to the README (#1158)
Closes https://github.com/astral-sh/puffin/issues/1149.
2024-01-28 22:52:25 -05:00
konsti 39021263dd
Windows launchers using posy trampolines (#1092)
## Background

In virtual environments, we want to install python programs as console
commands, e.g. `black .` over `python -m black .`. They may be called
[entrypoints](https://packaging.python.org/en/latest/specifications/entry-points/)
or scripts. For entrypoints, we're given a module name and function to
call in that module.

On Unix, we generate a minimal python script launcher. Text files are
runnable on unix by adding a shebang at their top, e.g.

```python
#!/usr/bin/env python
```

will make the operating system run the file with the current python
interpreter. A venv launcher for black in `/home/ferris/colorize/.venv`
(module name: `black`, function to call: `patched_main`) would look like
this:

```python
#!/home/ferris/colorize/.venv/bin/python
# -*- coding: utf-8 -*-
import re
import sys
from black import patched_main
if __name__ == "__main__":
    sys.argv[0] = re.sub(r"(-script\.pyw|\.exe)?$", "", sys.argv[0])
    sys.exit(patched_main())
```

On windows, this doesn't work, we can only rely on launching `.exe`
files.

## Summary

We use posy's rust implementation of a trampoline, which is based on
distlib's c++ implementation. We pre-build a minimal exe and append the
launcher script as stored zip archive behind it. The exe will look for
the venv python interpreter next to it and use it to execute the
appended script.

The changes in this PR make the `black` entrypoint work:

```powershell
cargo run -- venv .venv
cargo run -q -- pip install black
.\.venv\Scripts\black --version
```

Integration with our existing tests will be done in follow-up PRs.

## Implementation and Details

I've vendored the posy trampoline crate. It is a formatted, renamed and
slightly changed for embedding version of
https://github.com/njsmith/posy/pull/28.

The posy launchers are smaller than the distlib launchers, 16K vs 106K
for black. Currently only `x86_64-pc-windows-msvc` is supported. The
crate requires a nightly compiler for its no-std binary size tricks.

On windows, an application can be launched with a console or without (to
create windows instead), which needs two different launchers. The gui
launcher will subsequently use `pythonw.exe` while the console launcher
uses `python.exe`.
2024-01-26 13:54:11 +00:00
Zanie Blue 73fccdd5c6
Add new features to the highlights in README (#939) 2024-01-16 14:03:44 -05:00
Charlie Marsh 249ca10765
Move Puffin subcommands to a pip namespace (#921)
## Summary

This makes the separation clearer between the legacy `pip` API and the
API we'll add in the future for the package manager itself. It also
enables seamless `puffin pip` aliasing for those that want it.

Closes #918.
2024-01-15 16:36:45 +00:00
Charlie Marsh 05029d219f
Remove `--find-links` limitation from README (#922)
These are now supported.
2024-01-15 03:09:15 +00:00
konsti 673bece595
Allow `pip-compile` without a venv (#494)
The semantics are a bit unintuitive because `--python-version` is a
preference when looking for a python version without a venv, but if we
don't find that exact version we'll take `python3` and patch the
markers. This will make more sense once we start provisioning python
builds.

We can now resolve black with both python 3.8 and 3.12, with or without
that python version being in scope. In the example below,
`PATH=$HOME/.cargo/bin:/usr/bin` removes the pyenv builds and leaves
only `python3`, which is python 3.11.

```console
$ RUST_LOG=puffin::commands=debug cargo run --bin puffin -q -- pip-compile -v scripts/benchmarks/requirements/black.in --python-version py38
    0.004108s DEBUG puffin::commands::pip_compile Using Python 3.8 at /home/konsti/.local/bin/python3.8
Resolved 8 packages in 44ms
# This file was autogenerated by Puffin v0.0.1 via the following command:
#    puffin pip-compile -v scripts/benchmarks/requirements/black.in --python-version py38
black==23.11.0
[...]
platformdirs==4.0.0
    # via black
tomli==2.0.1
    # via black
typing-extensions==4.8.0
    # via black
$ PATH=$HOME/.cargo/bin:/usr/bin RUST_LOG=puffin::commands=debug cargo run --bin puffin -q -- pip-compile -v scripts/benchmarks/requirements/black.in --python-version py38
    0.004315s DEBUG puffin::commands::pip_compile Using Python 3.11 at /usr/bin/python3
Resolved 8 packages in 43ms
# This file was autogenerated by Puffin v0.0.1 via the following command:
#    puffin pip-compile -v scripts/benchmarks/requirements/black.in --python-version py38
black==23.11.0
[...]
platformdirs==4.0.0
    # via black
tomli==2.0.1
    # via black
typing-extensions==4.8.0
    # via black
```

```console
$ RUST_LOG=puffin::commands=debug cargo run --bin puffin -q -- pip-compile -v scripts/benchmarks/requirements/black.in --python-version py312
    0.004216s DEBUG puffin::commands::pip_compile Using Python 3.12 at /home/konsti/.local/bin/python3.12
Resolved 6 packages in 37ms
# This file was autogenerated by Puffin v0.0.1 via the following command:
#    puffin pip-compile -v scripts/benchmarks/requirements/black.in --python-version py312
black==23.11.0
[...]
platformdirs==4.0.0
    # via black
$ PATH=$HOME/.cargo/bin:/usr/bin RUST_LOG=puffin::commands=debug cargo run --bin puffin -q -- pip-compile -v scripts/benchmarks/requirements/black.in --python-version py312
    0.004190s DEBUG puffin::commands::pip_compile Using Python 3.11 at /usr/bin/python3
Resolved 6 packages in 39ms
# This file was autogenerated by Puffin v0.0.1 via the following command:
#    puffin pip-compile -v scripts/benchmarks/requirements/black.in --python-version py312
black==23.11.0
[...]
platformdirs==4.0.0
    # via black
```

Fixes #235.

Co-authored-by: Charlie Marsh <charlie.r.marsh@gmail.com>
2024-01-05 15:01:06 +00:00
Charlie Marsh 76064cdec2
Document Python interpreter discovery in README (#792) 2024-01-05 09:44:06 -05:00
Charlie Marsh 1f79f9e2b8
Tweak the README (#768) 2024-01-04 00:36:33 -05:00
Charlie Marsh 0bdd831a0d
Add an up-to-date README with Puffin documentation (#754) 2024-01-04 02:22:01 +00:00
Charlie Marsh 17228ba04e
Add support for path dependencies (#471)
## Summary

This PR adds support for local path dependencies. The approach mostly
just falls out of our existing approach and infrastructure for Git and
URL dependencies.

Closes https://github.com/astral-sh/puffin/issues/436. (We'll open a
separate issue for editable installs.)

## Test Plan

Added `pip-compile` tests that pre-download a wheel or source
distribution, then install it via local path.
2023-11-21 11:49:42 +00:00
Charlie Marsh 13ba4405aa
Update README and crates manifest (#419) 2023-11-14 01:20:07 +00:00
Charlie Marsh 4eed03d8e7
Update README limitations (#363) 2023-11-08 03:01:33 +00:00
Charlie Marsh e15b99b911
Rename commands to `pip-sync` and `pip-compile` (#123)
To free up the rest of the interface.
2023-10-18 21:15:20 +00:00
Charlie Marsh 239b5893d8
Fix version satisfier for unpinned dependencies (#74) 2023-10-09 11:48:39 -04:00
Charlie Marsh 75cb7a0178
Add benchmark scripts (#69)
Moving these out of the README and into proper scripts.
2023-10-08 23:37:38 +00:00
Charlie Marsh 2a846e76b7
Store unzipped wheels in a cache (#49)
This PR massively speeds up the case in which you need to install wheels
that already exist in the global cache.

The new strategy is as follows:

- Download the wheel into the content-addressed cache.
- Unzip the wheel into the cache, but ignore content-addressing. It
turns out that writing to `cacache` for every file in the zip added a
ton of overhead, and I don't see any actual advantages to doing so.
Instead, we just unzip the contents into a directory at, e.g.,
`~/.cache/puffin/django-4.1.5`.
- (The unzip itself is now parallelized with Rayon.)
- When installing the wheel, we now support unzipping from a directory
instead of a zip archive. This required duplicating and tweaking a few
functions.
- When installing the wheel, we now use reflinks (or copy-on-write
links). These have a few fantastic properties: (1) they're extremely
cheap to create (on macOS, they are allegedly faster than hard links);
(2) they minimize disk space, since we avoid copying files entirely in
the vast majority of cases; and (3) if the user then edits a file
locally, the cache doesn't get polluted. Orogene, Bun, and soon pnpm all
use reflinks.

Puffin is now ~15x faster than `pip` for the common case of installing
cached data into a fresh environment.

Closes https://github.com/astral-sh/puffin/issues/21.

Closes https://github.com/astral-sh/puffin/issues/39.
2023-10-08 04:04:48 +00:00
Charlie Marsh a46887d34b
Add motivation to README (#47) 2023-10-07 23:39:56 +00:00
Charlie Marsh 9be02d1590
Skip already-installed dependencies during `sync` command (#43)
Closes https://github.com/astral-sh/puffin/issues/35.
2023-10-07 19:26:45 +00:00
Charlie Marsh f14b1f0c95
Update benchmark command in README (#40) 2023-10-07 14:32:25 +00:00
Charlie Marsh 162952bf64
Add a content-addressed cache for wheels (#38)
Closes https://github.com/astral-sh/puffin/issues/4.
2023-10-07 14:24:52 +00:00
Charlie Marsh dd26cfa0cc
Migrate to `tokio` (#27)
Closes https://github.com/astral-sh/puffin/issues/26.
2023-10-06 20:31:03 +00:00
Charlie Marsh dab70a661a
Change `install` to `sync` (with sync semantics) (#24)
For better separate at this stage (and following `pip-tools`), it's now
`puffin sync`, and it assumes `--no-deps`.
2023-10-06 19:42:58 +00:00
Charlie Marsh f395c9c98c Update README 2023-10-06 01:03:07 -04:00
Charlie Marsh d226e0a2cd Add README and LICENSE files 2023-10-05 12:45:38 -04:00