Zanie Blue
5cd3af8ab4
Use uv tool run
for release
script ( #3764 )
...
Dogfooding!
2024-05-22 16:31:13 -05:00
Zanie Blue
a6043553c8
Improve error message when default Python is not found ( #3770 )
2024-05-22 16:28:52 -05:00
Zanie Blue
87b73ef7a9
Do not treat interpereters discovered via CONDA_PREFIX
as system interpreters ( #3771 )
...
Closes https://github.com/astral-sh/uv/issues/3769
2024-05-22 16:27:33 -05:00
Charlie Marsh
74c494d7dd
Report yanks for cached and resolved packages ( #3772 )
...
## Summary
We now show yanks as part of the resolution diagnostics, so they now
appear for `sync`, `install`, `compile`, and any other operations.
Further, they'll also appear for cached packages (but not packages that
are _already_ installed).
Closes https://github.com/astral-sh/uv/issues/3768 .
Closes #3766 .
2024-05-22 21:21:37 +00:00
Charlie Marsh
1fc71ea736
Bump version to v0.2.1 ( #3763 )
2024-05-22 20:05:17 +00:00
Charlie Marsh
dc4f63d2e5
Revert "ci: drop native manylinux wheel for dual-tagged one ( #3685 )" ( #3762 )
...
## Summary
Reverts https://github.com/astral-sh/uv/pull/3685 . We need to figure out
how to update the installer to handle this correctly.
2024-05-22 15:53:17 -04:00
Zanie Blue
d66d326954
Allow users to specify a custom source package to uv tool run
( #3677 )
...
We usually infer the package the tool is pulled from to be the same name
as the tool itself, but that's not always the case. This allows users to
provide a custom package.
2024-05-22 14:48:54 -05:00
Charlie Marsh
0efc5d0cab
Reuse reporting operation in venv
( #3755 )
2024-05-22 15:43:20 -04:00
Charlie Marsh
3a75b50d5b
Use pip "operations" API in project commands ( #3759 )
...
## Summary
This PR removes most of the code in `project/mod.rs` in favor of the
routines exposed in `pip/operations.rs`.
I think we can do a lot more to add more abstraction here and reduce the
verbosity, but for now it deduplicates a _ton_ of logic. The remaining
logic is just instantiating settings etc.
2024-05-22 15:43:12 -04:00
Zanie Blue
0e26a84c68
Add changelog entry for #3753 ( #3756 )
2024-05-22 14:16:51 -05:00
Charlie Marsh
fe28b2c278
Remove unused methods from Resolution
( #3754 )
2024-05-22 18:48:44 +00:00
Nyakku Shigure
0a87391d5d
Capture clang and msvc missing header error ( #3753 )
...
## Summary
Fixes #3732
The full log for MSVC and clang is as follows:
Clang (on macOS):
```
pip install pygraphviz
Collecting pygraphviz
Downloading pygraphviz-1.13.tar.gz (104 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 104.6/104.6 kB 964.1 kB/s eta 0:00:00
Installing build dependencies ... done
Getting requirements to build wheel ... done
Installing backend dependencies ... done
Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: pygraphviz
Building wheel for pygraphviz (pyproject.toml) ... error
error: subprocess-exited-with-error
× Building wheel for pygraphviz (pyproject.toml) did not run successfully.
│ exit code: 1
╰─> [63 lines of output]
running bdist_wheel
running build
running build_py
creating build
creating build/lib.macosx-14.0-arm64-cpython-311
creating build/lib.macosx-14.0-arm64-cpython-311/pygraphviz
copying pygraphviz/scraper.py -> build/lib.macosx-14.0-arm64-cpython-311/pygraphviz
copying pygraphviz/graphviz.py -> build/lib.macosx-14.0-arm64-cpython-311/pygraphviz
copying pygraphviz/__init__.py -> build/lib.macosx-14.0-arm64-cpython-311/pygraphviz
copying pygraphviz/agraph.py -> build/lib.macosx-14.0-arm64-cpython-311/pygraphviz
copying pygraphviz/testing.py -> build/lib.macosx-14.0-arm64-cpython-311/pygraphviz
creating build/lib.macosx-14.0-arm64-cpython-311/pygraphviz/tests
copying pygraphviz/tests/test_unicode.py -> build/lib.macosx-14.0-arm64-cpython-311/pygraphviz/tests
copying pygraphviz/tests/test_scraper.py -> build/lib.macosx-14.0-arm64-cpython-311/pygraphviz/tests
copying pygraphviz/tests/test_readwrite.py -> build/lib.macosx-14.0-arm64-cpython-311/pygraphviz/tests
copying pygraphviz/tests/test_string.py -> build/lib.macosx-14.0-arm64-cpython-311/pygraphviz/tests
copying pygraphviz/tests/__init__.py -> build/lib.macosx-14.0-arm64-cpython-311/pygraphviz/tests
copying pygraphviz/tests/test_html.py -> build/lib.macosx-14.0-arm64-cpython-311/pygraphviz/tests
copying pygraphviz/tests/test_node_attributes.py -> build/lib.macosx-14.0-arm64-cpython-311/pygraphviz/tests
copying pygraphviz/tests/test_drawing.py -> build/lib.macosx-14.0-arm64-cpython-311/pygraphviz/tests
copying pygraphviz/tests/test_repr_mimebundle.py -> build/lib.macosx-14.0-arm64-cpython-311/pygraphviz/tests
copying pygraphviz/tests/test_subgraph.py -> build/lib.macosx-14.0-arm64-cpython-311/pygraphviz/tests
copying pygraphviz/tests/test_close.py -> build/lib.macosx-14.0-arm64-cpython-311/pygraphviz/tests
copying pygraphviz/tests/test_edge_attributes.py -> build/lib.macosx-14.0-arm64-cpython-311/pygraphviz/tests
copying pygraphviz/tests/test_clear.py -> build/lib.macosx-14.0-arm64-cpython-311/pygraphviz/tests
copying pygraphviz/tests/test_layout.py -> build/lib.macosx-14.0-arm64-cpython-311/pygraphviz/tests
copying pygraphviz/tests/test_attribute_defaults.py -> build/lib.macosx-14.0-arm64-cpython-311/pygraphviz/tests
copying pygraphviz/tests/test_graph.py -> build/lib.macosx-14.0-arm64-cpython-311/pygraphviz/tests
running egg_info
writing pygraphviz.egg-info/PKG-INFO
writing dependency_links to pygraphviz.egg-info/dependency_links.txt
writing top-level names to pygraphviz.egg-info/top_level.txt
reading manifest file 'pygraphviz.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no files found matching '*.swg'
warning: no files found matching '*.png' under directory 'doc'
warning: no files found matching '*.html' under directory 'doc'
warning: no files found matching '*.txt' under directory 'doc'
warning: no files found matching '*.css' under directory 'doc'
warning: no previously-included files matching '*~' found anywhere in distribution
warning: no previously-included files matching '*.pyc' found anywhere in distribution
warning: no previously-included files matching '.svn' found anywhere in distribution
no previously-included directories found matching 'doc/build'
adding license file 'LICENSE'
writing manifest file 'pygraphviz.egg-info/SOURCES.txt'
copying pygraphviz/graphviz.i -> build/lib.macosx-14.0-arm64-cpython-311/pygraphviz
copying pygraphviz/graphviz_wrap.c -> build/lib.macosx-14.0-arm64-cpython-311/pygraphviz
running build_ext
building 'pygraphviz._graphviz' extension
creating build/temp.macosx-14.0-arm64-cpython-311
creating build/temp.macosx-14.0-arm64-cpython-311/pygraphviz
clang -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk -I/opt/homebrew/opt/openssl@3.0/include -DSWIG_PYTHON_STRICT_BYTE_CHAR -I/Users/nyakku/Projects/yutto/.venv/include -I/opt/homebrew/opt/python@3.11/Frameworks/Python.framework/Versions/3.11/include/python3.11 -c pygraphviz/graphviz_wrap.c -o build/temp.macosx-14.0-arm64-cpython-311/pygraphviz/graphviz_wrap.o
pygraphviz/graphviz_wrap.c:9:9: warning: 'SWIG_PYTHON_STRICT_BYTE_CHAR' macro redefined [-Wmacro-redefined]
9 | #define SWIG_PYTHON_STRICT_BYTE_CHAR
| ^
<command line>:2:9: note: previous definition is here
2 | #define SWIG_PYTHON_STRICT_BYTE_CHAR 1
| ^
pygraphviz/graphviz_wrap.c:3023:10: fatal error: 'graphviz/cgraph.h' file not found
3023 | #include "graphviz/cgraph.h"
| ^~~~~~~~~~~~~~~~~~~
1 warning and 1 error generated.
error: command '/opt/homebrew/opt/llvm/bin/clang' failed with exit code 1
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for pygraphviz
Failed to build pygraphviz
ERROR: Could not build wheels for pygraphviz, which is required to install pyproject.toml-based projects
[notice] A new release of pip is available: 23.3.1 -> 24.0
[notice] To update, run: pip install --upgrade pip
```
MSVC (on Windows):
```
pip install pygraphviz
Collecting pygraphviz
Downloading pygraphviz-1.13.tar.gz (104 kB)
|████████████████████████████████| 104 kB 595 kB/s
Installing build dependencies ... done
Getting requirements to build wheel ... done
Installing backend dependencies ... done
Preparing wheel metadata ... done
Building wheels for collected packages: pygraphviz
Building wheel for pygraphviz (PEP 517) ... error
ERROR: Command errored out with exit status 1:
command: 'C:\Python310\python.exe' 'C:\Python310\lib\site-packages\pip\_vendor\pep517\in_process\_in_process.py' build_wheel 'C:\Users\PADDLE~2\AppData\Local\Temp\tmpbl6h1qvd'
cwd: C:\Users\paddle_dev2\AppData\Local\Temp\pip-install-2e4v3xju\pygraphviz_034fe74e775e43e3935b6a88e2cd4761
Complete output (58 lines):
running bdist_wheel
running build
running build_py
creating build
creating build\lib.win-amd64-cpython-310
creating build\lib.win-amd64-cpython-310\pygraphviz
copying pygraphviz\agraph.py -> build\lib.win-amd64-cpython-310\pygraphviz
copying pygraphviz\graphviz.py -> build\lib.win-amd64-cpython-310\pygraphviz
copying pygraphviz\scraper.py -> build\lib.win-amd64-cpython-310\pygraphviz
copying pygraphviz\testing.py -> build\lib.win-amd64-cpython-310\pygraphviz
copying pygraphviz\__init__.py -> build\lib.win-amd64-cpython-310\pygraphviz
creating build\lib.win-amd64-cpython-310\pygraphviz\tests
copying pygraphviz\tests\test_attribute_defaults.py -> build\lib.win-amd64-cpython-310\pygraphviz\tests
copying pygraphviz\tests\test_clear.py -> build\lib.win-amd64-cpython-310\pygraphviz\tests
copying pygraphviz\tests\test_close.py -> build\lib.win-amd64-cpython-310\pygraphviz\tests
copying pygraphviz\tests\test_drawing.py -> build\lib.win-amd64-cpython-310\pygraphviz\tests
copying pygraphviz\tests\test_edge_attributes.py -> build\lib.win-amd64-cpython-310\pygraphviz\tests
copying pygraphviz\tests\test_graph.py -> build\lib.win-amd64-cpython-310\pygraphviz\tests
copying pygraphviz\tests\test_html.py -> build\lib.win-amd64-cpython-310\pygraphviz\tests
copying pygraphviz\tests\test_layout.py -> build\lib.win-amd64-cpython-310\pygraphviz\tests
copying pygraphviz\tests\test_node_attributes.py -> build\lib.win-amd64-cpython-310\pygraphviz\tests
copying pygraphviz\tests\test_readwrite.py -> build\lib.win-amd64-cpython-310\pygraphviz\tests
copying pygraphviz\tests\test_repr_mimebundle.py -> build\lib.win-amd64-cpython-310\pygraphviz\tests
copying pygraphviz\tests\test_scraper.py -> build\lib.win-amd64-cpython-310\pygraphviz\tests
copying pygraphviz\tests\test_string.py -> build\lib.win-amd64-cpython-310\pygraphviz\tests
copying pygraphviz\tests\test_subgraph.py -> build\lib.win-amd64-cpython-310\pygraphviz\tests
copying pygraphviz\tests\test_unicode.py -> build\lib.win-amd64-cpython-310\pygraphviz\tests
copying pygraphviz\tests\__init__.py -> build\lib.win-amd64-cpython-310\pygraphviz\tests
running egg_info
writing pygraphviz.egg-info\PKG-INFO
writing dependency_links to pygraphviz.egg-info\dependency_links.txt
writing top-level names to pygraphviz.egg-info\top_level.txt
reading manifest file 'pygraphviz.egg-info\SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no files found matching '*.swg'
warning: no files found matching '*.png' under directory 'doc'
warning: no files found matching '*.html' under directory 'doc'
warning: no files found matching '*.txt' under directory 'doc'
warning: no files found matching '*.css' under directory 'doc'
warning: no previously-included files matching '*~' found anywhere in distribution
warning: no previously-included files matching '*.pyc' found anywhere in distribution
warning: no previously-included files matching '.svn' found anywhere in distribution
no previously-included directories found matching 'doc\build'
adding license file 'LICENSE'
writing manifest file 'pygraphviz.egg-info\SOURCES.txt'
copying pygraphviz\graphviz.i -> build\lib.win-amd64-cpython-310\pygraphviz
copying pygraphviz\graphviz_wrap.c -> build\lib.win-amd64-cpython-310\pygraphviz
running build_ext
building 'pygraphviz._graphviz' extension
creating build\temp.win-amd64-cpython-310
creating build\temp.win-amd64-cpython-310\Release
creating build\temp.win-amd64-cpython-310\Release\pygraphviz
"C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\HostX86\x64\cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD -DSWIG_PYTHON_STRICT_BYTE_CHAR -DGVDLL -IC:\Python310\include -IC:\Python310\Include "-IC:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\ATLMFC\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\cppwinrt" "-IC:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\ATLMFC\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\include" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\include\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\cppwinrt" /Tcpygraphviz/graphviz_wrap.c /Fobuild\temp.win-amd64-cpython-310\Release\pygraphviz/graphviz_wrap.obj
graphviz_wrap.c
pygraphviz/graphviz_wrap.c(9): warning C4005: 'SWIG_PYTHON_STRICT_BYTE_CHAR': macro redefinition
pygraphviz/graphviz_wrap.c: note: see previous definition of 'SWIG_PYTHON_STRICT_BYTE_CHAR'
pygraphviz/graphviz_wrap.c(3023): fatal error C1083: Cannot open include file: 'graphviz/cgraph.h': No such file or directory
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Community\\VC\\Tools\\MSVC\\14.16.27023\\bin\\HostX86\\x64\\cl.exe' failed with exit code 2
----------------------------------------
ERROR: Failed building wheel for pygraphviz
Failed to build pygraphviz
ERROR: Could not build wheels for pygraphviz which use PEP 517 and cannot be installed directly
WARNING: You are using pip version 21.2.3; however, version 24.0 is available.
You should consider upgrading via the 'C:\Python310\python.exe -m pip install --upgrade pip' command.
```
## Test Plan
Running `cargo run -- pip install pygraphviz` and expecting to get
`Caused by: This error likely indicates that you need to install a
library that provides "graphviz/cgraph.h" for pygraphviz==1.13`
2024-05-22 14:40:49 -04:00
Charlie Marsh
e6cdf36cff
Move modification reporting into a helper method ( #3752 )
2024-05-22 18:40:07 +00:00
Zanie Blue
1dd6b89be8
Bump version to 0.2.0 ( #3745 )
2024-05-22 13:39:34 -05:00
Zanie Blue
0e75eb8d78
Improve display of selected interpreter sources ( #3748 )
...
e.g. this error message is not great
```
❯ uv venv --python 3.12.2
× No interpreter found for Python 3.12.2 in provided path, search path, managed toolchains, or parent interpreter
```
2024-05-22 13:39:22 -05:00
Zanie Blue
6962147831
Add display of interpreter request ( #3751 )
...
e.g.
```
❯ echo "anyio" | cargo run -q -- pip compile - --python 3.9 -v
DEBUG Searching for interpreter that fulfills Python @ 3.9
DEBUG Found a virtual environment at: /Users/zb/workspace/uv/.venv
DEBUG Using Python 3.9.18 interpreter at bin/cpython-3.9.18-macos-aarch64-none/install/bin/python3 for builds
```
2024-05-22 18:26:35 +00:00
Zanie Blue
d5ac2f53d3
Improve display of interpreter implementation names ( #3749 )
...
e.g. instead of
```
❯ uv venv --python pypy@3.10
× No interpreter found for pypy 3.10 in search path
```
we say
```
❯ uv venv --python pypy@3.10
× No interpreter found for PyPy 3.10 in search path
```
2024-05-22 18:22:09 +00:00
Zanie Blue
845d788c91
Drop Python patch test flag from default features ( #3746 )
2024-05-22 17:19:25 +00:00
Charlie Marsh
7585250107
Report yanked distributions in --dry-run
( #3740 )
...
## Summary
Closes #3703 .
2024-05-22 16:37:11 +00:00
Zanie Blue
5fe891082d
Discover and prefer the parent interpreter when invoked with python -m uv
( #3736 )
...
Closes #2222
Closes https://github.com/astral-sh/uv/issues/2058
Replaces https://github.com/astral-sh/uv/pull/2338
See also https://github.com/astral-sh/uv/issues/2649
We use an environment variable (`UV_INTERNAL__PARENT_INTERPRETER`) to
track the invoking interpreter when `python -m uv` is used. The parent
interpreter is preferred over all other sources (though it will be
skipped if it does not meet a `--python` request or if `--system` is
used and it belongs to a virtual environment). We warn if `--system` is
not provided and this interpreter would mutate system packages, but
allow it.
2024-05-22 11:34:24 -05:00
Charlie Marsh
b92321bd2d
Allow --constraint
files in pip sync
( #3741 )
...
## Summary
Trivial now that this follows the same strategy and internals as `pip
install`.
Closes https://github.com/astral-sh/uv/issues/3438 .
2024-05-22 16:30:54 +00:00
Zanie Blue
7afc3f6eb0
Filter discovered Python interpreters by system preference ( #3739 )
...
Previously, we enforced `SystemPython` outside of the interpreter
discovery exclusively with source selection. Now, we perform additional
filtering of interpreters depending on if they are a virtual
environment. This should not change any existing behavior, but will make
it much easier to have consistent behavior in ambiguous cases like
https://github.com/astral-sh/uv/pull/3736#discussion_r1610072262 where a
source could provide either a system interpreter or virtual environment
interpreter.
2024-05-22 11:22:09 -05:00
Charlie Marsh
0313e7d78b
Use common routines for pip install
and pip sync
( #3737 )
...
## Summary
This PR takes the functions used in `pip install`, moves them into a
common module, and then replaces all the `pip sync` logic with calls
into those functions. The net effect is that `pip install` and `pip
sync` share far more code and demonstrate much more consistent behavior.
Closes https://github.com/astral-sh/uv/issues/3555 .
2024-05-22 12:15:17 -04:00
Zanie Blue
b8ef436c42
Do not display "py launcher" source in error messages on Unix ( #3738 )
2024-05-22 15:22:15 +00:00
Charlie Marsh
2a01cbed65
Document --only-binary
compatibility ( #3735 )
...
## Summary
Closes https://github.com/astral-sh/uv/issues/2620 .
2024-05-22 10:46:28 -04:00
Charlie Marsh
ac05a13e81
Add --prefix
link to compatibility guide ( #3734 )
2024-05-22 13:45:51 +00:00
Charlie Marsh
e398444f2f
Track editable requirements in lockfile ( #3725 )
...
## Summary
This PR adds editables using a new source type (`editable+...`), and
then extracts the editables from the lockfile in `uv sync`.
Closes https://github.com/astral-sh/uv/issues/3695 .
2024-05-22 09:06:18 -04:00
Charlie Marsh
472ab144d5
Remove maturin_editable
test ( #3718 )
...
## Summary
I personally think this isn't worth continuing to maintain.
2024-05-22 11:10:04 +02:00
Charlie Marsh
d912c37539
Add instructions for building and updating uv-trampolines ( #3731 )
2024-05-21 22:49:14 -04:00
Ofek Lev
82820d0f4c
Allow relative Python executable paths in Windows trampoline ( #3717 )
...
## Summary
This is a prerequisite for https://github.com/astral-sh/uv/issues/3669
## Test Plan
Download one of the standalone distributions on Windows then use its
Python to run the following script and then run the scripts it creates
(only pip):
```python
from __future__ import annotations
import sys
import sysconfig
from contextlib import closing
from importlib.metadata import entry_points
from io import BytesIO
from os.path import relpath
from pathlib import Path
from tempfile import TemporaryDirectory
from zipfile import ZIP_DEFLATED, ZipFile, ZipInfo
# Change this line to your real path
LAUNCHERS_DIR = Path('C:\\Users\\ofek\\Desktop\\code\\uv\\crates\\uv-trampoline\\target\\x86_64-pc-windows-msvc\\release')
SCRIPT_TEMPLATE = """\
#!{executable}
# -*- coding: utf-8 -*-
import re
import sys
from {module} import {import_name}
if __name__ == "__main__":
sys.argv[0] = re.sub(r"(-script\\.pyw|\\.exe)?$", "", sys.argv[0])
sys.exit({function}())
"""
def select_entry_points(ep, group):
return ep.select(group=group) if sys.version_info[:2] >= (3, 10) else ep.get(group, [])
def main():
interpreters_dir = Path(sys.executable).parent
scripts_dir = Path(sysconfig.get_path('scripts'))
ep = entry_points()
for group, interpreter_name, launcher_name in (
('console_scripts', 'python.exe', 'uv-trampoline-console.exe'),
('gui_scripts', 'pythonw.exe', 'uv-trampoline-gui.exe'),
):
interpreter = interpreters_dir / interpreter_name
relative_interpreter_path = relpath(interpreter, scripts_dir)
launcher_data = (LAUNCHERS_DIR / launcher_name).read_bytes()
for script in select_entry_points(ep, group):
# https://github.com/astral-sh/uv/tree/main/crates/uv-trampoline#how-do-you-use-it
with closing(BytesIO()) as buf:
# Launcher
buf.write(launcher_data)
# Zipped script
with TemporaryDirectory() as td:
zip_path = Path(td) / 'script.zip'
with ZipFile(zip_path, 'w') as zf:
# Ensure reproducibility
zip_info = ZipInfo('__main__.py', (2020, 2, 2, 0, 0, 0))
zip_info.external_attr = (0o644 & 0xFFFF) << 16
module, _, attrs = script.value.partition(':')
contents = SCRIPT_TEMPLATE.format(
executable=relative_interpreter_path,
module=module,
import_name=attrs.split('.')[0],
function=attrs
)
zf.writestr(zip_info, contents, compress_type=ZIP_DEFLATED)
buf.write(zip_path.read_bytes())
# Interpreter path
interpreter_path = relative_interpreter_path.encode('utf-8')
buf.write(interpreter_path)
# Interpreter path length
interpreter_path_length = len(interpreter_path).to_bytes(4, 'little')
buf.write(interpreter_path_length)
# Magic number
buf.write(b'UVUV')
script_data = buf.getvalue()
script_path = scripts_dir / f'{script.name}.exe'
script_path.write_bytes(script_data)
if __name__ == '__main__':
main()
```
2024-05-21 21:53:15 -04:00
Zanie Blue
becdc64d3e
Do not discover virtual environment interpreters in uv venv --python ...
( #3728 )
...
Otherwise `uv venv --python 3.12` can prefer `.venv/bin/python` over the
system Python (which is always used if you don't provide a `--python`
flag). I would find this confusing as a user.
2024-05-21 20:00:21 -05:00
Charlie Marsh
e71ce53983
Allow --config-file
to be passed before or after command name ( #3730 )
2024-05-22 00:12:10 +00:00
Charlie Marsh
d33577fc16
Make --offline
a global argument ( #3729 )
2024-05-22 00:09:05 +00:00
Charlie Marsh
285adaed64
Remove some dependencies on EditableRequirement
( #3727 )
...
## Summary
Use `LocalEditable` instead throughout the `ResolvedEditable` pipeline.
2024-05-21 23:36:53 +00:00
Zanie Blue
1379fb7dcd
Add support for requesting pypy
interpreters by implementation name ( #3706 )
...
Updates our executable name searches to support implementation names
i.e. `cpython` and `pypy` and adds support for PyPy.
We might want to _not_ support searching for `cpython` because that's
non-standard?
2024-05-21 16:48:43 -05:00
Zanie Blue
84afca2696
Add offline support to uv tool run
and uv run
( #3676 )
...
Adds `--offline` support to `uv tool run` and `uv run` because I needed
it on the airplane today.
I think we should move `--offline` to the global settings like
`--native-tls`.
2024-05-21 15:58:15 -05:00
Charlie Marsh
e0b639828d
Revert "Support editables in uv sync
( #3692 )" ( #3696 ) ( #3722 )
...
## Summary
This is just a re-apply of #3696 , which @konstin accidentally reverted
in #3585 .
Co-authored-by: konsti <konstin@mailbox.org>
2024-05-21 16:41:15 -04:00
Zanie Blue
92c70134d1
Fix uv tool run
interpreter lookup ( #3721 )
2024-05-21 16:33:39 -04:00
Charlie Marsh
558f628ef1
Propagate URL errors in verbatim parsing ( #3720 )
...
## Summary
Closes https://github.com/astral-sh/uv/issues/3715 .
## Test Plan
```
❯ echo "/../test" | cargo run pip compile -
error: Couldn't parse requirement in `-` at position 0
Caused by: path could not be normalized: /../test
/../test
^^^^^^^^
❯ echo "-e /../test" | cargo run pip compile -
error: Invalid URL in `-`: `/../test`
Caused by: path could not be normalized: /../test
Caused by: cannot normalize a relative path beyond the base directory
```
2024-05-21 19:58:59 +00:00
Zanie Blue
19df1a4372
Rename all instances of Cpython
to CPython
( #3702 )
2024-05-21 14:52:31 -05:00
Zanie Blue
d313d9b1fa
Add initial implementation of uv tool run
( #3657 )
...
This is mostly a shorter version of `uv run` that infers a requirement
name from the command. The main goal here is to do the smallest amount
of work necessary to get #3560 started.
Closes #3613
e.g.
```shell
$ uv tool run -- ruff check
warning: `uv tool run` is experimental and may change without warning.
Resolved 1 package in 34ms
Installed 1 package in 2ms
+ ruff==0.4.4
error: Failed to parse example.py:1:5: Expected an expression
example.py:1:5: E999 SyntaxError: Expected an expression
Found 1 error.
```
2024-05-21 19:51:30 +00:00
Zanie Blue
d540d0f28b
Rewrite Python interpreter discovery ( #3266 )
...
Updates our Python interpreter discovery to conform to the rules
described in #2386 , please see that issue for a full description of the
behavior. Briefly, we now will search for interpreters that satisfy a
requested version without stopping at the first Python executable.
Additionally, if retrieving information about an interpreter fails we
will continue to search for a working interpreter. We also add the
plumbing necessary to request Python implementations other than CPython,
though we do not add support for other implementations at this time.
A major internal goal of this work is to prepare for user-facing managed
toolchains i.e. fetching a requested version during `uv run`. These APIs
are not introduced, but there is some managed toolchain handling as
required for our test suite.
Some noteworthy implementation changes:
- The `uv_interpreter::find_python` module has been removed in favor of
a `uv_interpreter::discovery` module.
- There are new types to help structure interpreter requests and track
sources
- Executable discovery is implemented as a big lazy iterator and is a
central authority for source precedence
- `uv_interpreter::Error` variants were split into scoped types in each
module
- There's much more unit test coverage, but not for Windows yet
Remaining work:
- [x] Write new test cases
- [x] Determine correct behavior around executables in the current
directory
- _Future_: Combine `PythonVersion` and `VersionRequest`
- _Future_: Consider splitting `ManagedToolchain` into local and remote
variants
- _Future_: Add Windows unit test coverage
- _Future_: Explore behavior around implementation precedence (i.e.
CPython over PyPy)
Refactors split into:
- #3329
- #3330
- #3331
- #3332
Closes #2386
2024-05-21 14:37:23 -05:00
Zanie Blue
c14a7dbef3
Improve display of root package in range errors ( #3711 )
...
Instead of saying
> we can conclude that you require==0a0.dev0 and
pandas-stubs==2.0.3.230814 are incompatible.
we'll say
> we can conclude that your requirements and pandas-stubs==2.0.3.230814
are incompatible.
Closes #3710
I'm not sure how to get unit test coverage for this, might look into
that. Ideally we'd skip this branch entirely?
2024-05-21 19:28:23 +00:00
Zanie Blue
dfd6ccf0f9
Move maturin test coverage into CI ( #3714 )
...
This test can take over 60s to run, which is too much for a unit test.
We'll run it in a separate CI job to retain coverage.
2024-05-21 19:17:48 +00:00
Charlie Marsh
cf997080b0
Rename DistInfoMetadata
to CoreMetadata
( #3699 )
...
## Summary
This reflects the change codified in PEP 714.
2024-05-21 18:26:59 +00:00
Charlie Marsh
fee344db6f
Add PEP 714 support for HTML API client ( #3697 )
...
## Summary
If `data-core-metadata` is set, we need to respect that over
`data-dist-info-metadata` in the HTML client.
See: https://github.com/astral-sh/uv/issues/3689
2024-05-21 18:05:40 +00:00
konsti
e6a5da7424
Fix clippy on main by boxing large error variant ( #3707 )
...
I don't really understand why this only happens on windows clippy and
not on linux too, but as usual, boxing the error variant fixes it.
Fixup for #3585
2024-05-21 17:55:43 +00:00
konsti
2ffd453003
Discover workspaces without using them in resolution ( #3585 )
...
Add minimal support for workspace discovery, only used for determining
paths in the bluejay commands.
We can now discover the workspace structure, namely that the
`pyproject.toml` of a package belongs to a workspace `pyproject.toml`
with members and exclusion. The globbing logic is inspired by cargo. We
don't resolve `workspace = true` metadata declarations yet.
2024-05-21 17:17:26 +00:00
Charlie Marsh
5205165d42
Add PEP 714 support for JSON API client ( #3698 )
...
## Summary
Closes https://github.com/astral-sh/uv/issues/3689 .
## Test Plan
Manually verified we pick up `core-metadata` from PyPI if I remove the
aliases.
2024-05-21 15:52:37 +00:00
konsti
95af1db0bb
Let RequirementSource::Path.editable
be bool
, not Option<bool>
( #3693 )
...
Small refactoring of the internal representation. This does not change
`tool.uv.sources`.
2024-05-21 14:34:43 +00:00