📦 astral-sh / docs

📄 index.md · 1196 lines
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196# [Environment variables](#environment-variables)

uv defines and respects the following environment variables:

### [`UV_BREAK_SYSTEM_PACKAGES`](#uv_break_system_packages)

added in `0.1.32`

Equivalent to the `--break-system-packages` command-line argument. If set to `true`, uv will allow the installation of packages that conflict with system-installed packages.

WARNING: `UV_BREAK_SYSTEM_PACKAGES=true` is intended for use in continuous integration (CI) or containerized environments and should be used with caution, as modifying the system Python can lead to unexpected behavior.

### [`UV_BUILD_CONSTRAINT`](#uv_build_constraint)

added in `0.2.34`

Equivalent to the `--build-constraints` command-line argument. If set, uv will use this file as constraints for any source distribution builds. Uses space-separated list of files.

### [`UV_CACHE_DIR`](#uv_cache_dir)

added in `0.0.5`

Equivalent to the `--cache-dir` command-line argument. If set, uv will use this directory for caching instead of the default cache directory.

### [`UV_COMPILE_BYTECODE`](#uv_compile_bytecode)

added in `0.3.3`

Equivalent to the `--compile-bytecode` command-line argument. If set, uv will compile Python source files to bytecode after installation.

### [`UV_COMPILE_BYTECODE_TIMEOUT`](#uv_compile_bytecode_timeout)

added in `0.7.22`

Timeout (in seconds) for bytecode compilation.

### [`UV_CONCURRENT_BUILDS`](#uv_concurrent_builds)

added in `0.1.43`

Sets the maximum number of source distributions that uv will build concurrently at any given time.

### [`UV_CONCURRENT_DOWNLOADS`](#uv_concurrent_downloads)

added in `0.1.43`

Sets the maximum number of in-flight concurrent downloads that uv will perform at any given time.

### [`UV_CONCURRENT_INSTALLS`](#uv_concurrent_installs)

added in `0.1.45`

Controls the number of threads used when installing and unzipping packages.

### [`UV_CONFIG_FILE`](#uv_config_file)

added in `0.1.34`

Equivalent to the `--config-file` command-line argument. Expects a path to a local `uv.toml` file to use as the configuration file.

### [`UV_CONSTRAINT`](#uv_constraint)

added in `0.1.36`

Equivalent to the `--constraints` command-line argument. If set, uv will use this file as the constraints file. Uses space-separated list of files.

### [`UV_CREDENTIALS_DIR`](#uv_credentials_dir)

added in `0.8.15`

The directory for storage of credentials when using a plain text backend.

### [`UV_CUSTOM_COMPILE_COMMAND`](#uv_custom_compile_command)

added in `0.1.23`

Equivalent to the `--custom-compile-command` command-line argument.

Used to override uv in the output header of the `requirements.txt` files generated by `uv pip compile`. Intended for use-cases in which `uv pip compile` is called from within a wrapper script, to include the name of the wrapper script in the output file.

### [`UV_DEFAULT_INDEX`](#uv_default_index)

added in `0.4.23`

Equivalent to the `--default-index` command-line argument. If set, uv will use this URL as the default index when searching for packages.

### [`UV_DEV`](#uv_dev)

added in `0.8.7`

Equivalent to the `--dev` command-line argument. If set, uv will include development dependencies.

### [`UV_DOWNLOAD_URL`](#uv_download_url)

added in `0.8.4`

The URL from which to download uv using the standalone installer. By default, installs from uv's GitHub Releases. `INSTALLER_DOWNLOAD_URL` is also supported as an alias, for backwards compatibility.

### [`UV_ENV_FILE`](#uv_env_file)

added in `0.4.30`

`.env` files from which to load environment variables when executing `uv run` commands.

### [`UV_EXCLUDE`](#uv_exclude)

added in `0.9.8`

Equivalent to the `--excludes` command-line argument. If set, uv will use this as the excludes file. Uses space-separated list of files.

### [`UV_EXCLUDE_NEWER`](#uv_exclude_newer)

added in `0.2.12`

Equivalent to the `--exclude-newer` command-line argument. If set, uv will exclude distributions published after the specified date.

### [`UV_EXTRA_INDEX_URL`](#uv_extra_index_url)

added in `0.1.3`

Equivalent to the `--extra-index-url` command-line argument. If set, uv will use this space-separated list of URLs as additional indexes when searching for packages. (Deprecated: use `UV_INDEX` instead.)

### [`UV_FIND_LINKS`](#uv_find_links)

added in `0.4.19`

Equivalent to the `--find-links` command-line argument. If set, uv will use this comma-separated list of additional locations to search for packages.

### [`UV_FORK_STRATEGY`](#uv_fork_strategy)

added in `0.5.9`

Equivalent to the `--fork-strategy` argument. Controls version selection during universal resolution.

### [`UV_FROZEN`](#uv_frozen)

added in `0.4.25`

Equivalent to the `--frozen` command-line argument. If set, uv will run without updating the `uv.lock` file.

### [`UV_GCS_ENDPOINT_URL`](#uv_gcs_endpoint_url)

added in `0.9.26`

The URL to treat as a GCS-compatible storage endpoint. Requests to this endpoint will be signed using Google Cloud authentication based on the `GOOGLE_APPLICATION_CREDENTIALS` environment variable or Application Default Credentials.

### [`UV_GITHUB_TOKEN`](#uv_github_token)

added in `0.4.10`

Equivalent to the `--token` argument for self update. A GitHub token for authentication.

### [`UV_GIT_LFS`](#uv_git_lfs)

added in `0.5.19`

Enables fetching files stored in Git LFS when installing a package from a Git repository.

### [`UV_HIDE_BUILD_OUTPUT`](#uv_hide_build_output)

added in `0.9.15`

Suppress output from the build backend when building source distributions, even in the event of build failures.

### [`UV_HTTP_RETRIES`](#uv_http_retries)

added in `0.7.21`

The number of retries for HTTP requests. (default: 3)

### [`UV_HTTP_TIMEOUT`](#uv_http_timeout)

added in `0.1.7`

Timeout (in seconds) for HTTP requests. (default: 30 s)

### [`UV_INDEX`](#uv_index)

added in `0.4.23`

Equivalent to the `--index` command-line argument. If set, uv will use this space-separated list of URLs as additional indexes when searching for packages.

### [`UV_INDEX_STRATEGY`](#uv_index_strategy)

added in `0.1.29`

Equivalent to the `--index-strategy` command-line argument.

For example, if set to `unsafe-best-match`, uv will consider versions of a given package available across all index URLs, rather than limiting its search to the first index URL that contains the package.

### [`UV_INDEX_URL`](#uv_index_url)

added in `0.0.5`

Equivalent to the `--index-url` command-line argument. If set, uv will use this URL as the default index when searching for packages. (Deprecated: use `UV_DEFAULT_INDEX` instead.)

### [`UV_INDEX_{name}_PASSWORD`](#uv_index_name_password)

added in `0.4.23`

Provides the HTTP Basic authentication password for a named index.

The `name` parameter is the name of the index. For example, given an index named `foo`, the environment variable key would be `UV_INDEX_FOO_PASSWORD`.

### [`UV_INDEX_{name}_USERNAME`](#uv_index_name_username)

added in `0.4.23`

Provides the HTTP Basic authentication username for a named index.

The `name` parameter is the name of the index. For example, given an index named `foo`, the environment variable key would be `UV_INDEX_FOO_USERNAME`.

### [`UV_INIT_BUILD_BACKEND`](#uv_init_build_backend)

added in `0.8.2`

Equivalent to the `--build-backend` argument for `uv init`. Determines the default backend to use when creating a new project.

### [`UV_INSECURE_HOST`](#uv_insecure_host)

added in `0.3.5`

Equivalent to the `--allow-insecure-host` argument.

### [`UV_INSECURE_NO_ZIP_VALIDATION`](#uv_insecure_no_zip_validation)

added in `0.8.6`

Disable ZIP validation for streamed wheels and ZIP-based source distributions.

WARNING: Disabling ZIP validation can expose your system to security risks by bypassing integrity checks and allowing uv to install potentially malicious ZIP files. If uv rejects a ZIP file due to failing validation, it is likely that the file is malformed; consider filing an issue with the package maintainer.

### [`UV_INSTALLER_GHE_BASE_URL`](#uv_installer_ghe_base_url)

added in `0.5.0`

The URL from which to download uv using the standalone installer and `self update` feature, in lieu of the default GitHub Enterprise URL.

### [`UV_INSTALLER_GITHUB_BASE_URL`](#uv_installer_github_base_url)

added in `0.5.0`

The URL from which to download uv using the standalone installer and `self update` feature, in lieu of the default GitHub URL.

### [`UV_INSTALL_DIR`](#uv_install_dir)

added in `0.5.0`

The directory in which to install uv using the standalone installer and `self update` feature. Defaults to `~/.local/bin`.

### [`UV_ISOLATED`](#uv_isolated)

added in `0.8.14`

Equivalent to the `--isolated` command-line argument. If set, uv will avoid discovering a `pyproject.toml` or `uv.toml` file.

### [`UV_KEYRING_PROVIDER`](#uv_keyring_provider)

added in `0.1.19`

Equivalent to the `--keyring-provider` command-line argument. If set, uv will use this value as the keyring provider.

### [`UV_LIBC`](#uv_libc)

added in `0.7.22`

Overrides the environment-determined libc on linux systems when filling in the current platform within Python version requests. Options are: `gnu`, `gnueabi`, `gnueabihf`, `musl`, and `none`.

### [`UV_LINK_MODE`](#uv_link_mode)

added in `0.1.40`

Equivalent to the `--link-mode` command-line argument. If set, uv will use this as a link mode.

### [`UV_LOCKED`](#uv_locked)

added in `0.4.25`

Equivalent to the `--locked` command-line argument. If set, uv will assert that the `uv.lock` remains unchanged.

### [`UV_LOCK_TIMEOUT`](#uv_lock_timeout)

added in `0.9.4`

The time in seconds uv waits for a file lock to become available.

Defaults to 300s (5 min).

### [`UV_LOG_CONTEXT`](#uv_log_context)

added in `0.6.4`

Add additional context and structure to log messages.

If logging is not enabled, e.g., with `RUST_LOG` or `-v`, this has no effect.

### [`UV_MANAGED_PYTHON`](#uv_managed_python)

added in `0.6.8`

Require use of uv-managed Python versions.

### [`UV_NATIVE_TLS`](#uv_native_tls)

added in `0.1.19`

Equivalent to the `--native-tls` command-line argument. If set to `true`, uv will use the system's trust store instead of the bundled `webpki-roots` crate.

### [`UV_NO_BINARY`](#uv_no_binary)

added in `0.5.30`

Equivalent to the `--no-binary` command-line argument. If set, uv will install all packages from source. The resolver will still use pre-built wheels to extract package metadata, if available.

### [`UV_NO_BINARY_PACKAGE`](#uv_no_binary_package)

added in `0.5.30`

Equivalent to the `--no-binary-package` command line argument. If set, uv will not use pre-built wheels for the given space-delimited list of packages.

### [`UV_NO_BUILD`](#uv_no_build)

added in `0.1.40`

Equivalent to the `--no-build` command-line argument. If set, uv will not build source distributions.

### [`UV_NO_BUILD_ISOLATION`](#uv_no_build_isolation)

added in `0.1.40`

Equivalent to the `--no-build-isolation` command-line argument. If set, uv will skip isolation when building source distributions.

### [`UV_NO_BUILD_PACKAGE`](#uv_no_build_package)

added in `0.6.5`

Equivalent to the `--no-build-package` command line argument. If set, uv will not build source distributions for the given space-delimited list of packages.

### [`UV_NO_CACHE`](#uv_no_cache)

added in `0.1.2`

Equivalent to the `--no-cache` command-line argument. If set, uv will not use the cache for any operations.

### [`UV_NO_CONFIG`](#uv_no_config)

added in `0.2.30`

Equivalent to the `--no-config` command-line argument. If set, uv will not read any configuration files from the current directory, parent directories, or user configuration directories.

### [`UV_NO_DEFAULT_GROUPS`](#uv_no_default_groups)

added in `0.9.9`

Equivalent to the `--no-default-groups` command-line argument. If set, uv will not select the default dependency groups defined in `tool.uv.default-groups`.

### [`UV_NO_DEV`](#uv_no_dev)

added in `0.8.7`

Equivalent to the `--no-dev` command-line argument. If set, uv will exclude development dependencies.

### [`UV_NO_EDITABLE`](#uv_no_editable)

added in `0.6.15`

Equivalent to the `--no-editable` command-line argument. If set, uv installs or exports any editable dependencies, including the project and any workspace members, as non-editable.

### [`UV_NO_ENV_FILE`](#uv_no_env_file)

added in `0.4.30`

Ignore `.env` files when executing `uv run` commands.

### [`UV_NO_GITHUB_FAST_PATH`](#uv_no_github_fast_path)

added in `0.7.13`

Disable GitHub-specific requests that allow uv to skip `git fetch` in some circumstances.

### [`UV_NO_GROUP`](#uv_no_group)

added in `0.9.8`

Equivalent to the `--no-group` command-line argument. If set, uv will disable the specified dependency groups for the given space-delimited list of packages.

### [`UV_NO_HF_TOKEN`](#uv_no_hf_token)

added in `0.8.1`

Disable Hugging Face authentication, even if `HF_TOKEN` is set.

### [`UV_NO_INSTALLER_METADATA`](#uv_no_installer_metadata)

added in `0.5.7`

Skip writing `uv` installer metadata files (e.g., `INSTALLER`, `REQUESTED`, and `direct_url.json`) to site-packages `.dist-info` directories.

### [`UV_NO_MANAGED_PYTHON`](#uv_no_managed_python)

added in `0.6.8`

Disable use of uv-managed Python versions.

### [`UV_NO_MODIFY_PATH`](#uv_no_modify_path)

added in `0.8.4`

Avoid modifying the `PATH` environment variable when installing uv using the standalone installer and `self update` feature. `INSTALLER_NO_MODIFY_PATH` is also supported as an alias, for backwards compatibility.

### [`UV_NO_PROGRESS`](#uv_no_progress)

added in `0.2.28`

Equivalent to the `--no-progress` command-line argument. Disables all progress output. For example, spinners and progress bars.

### [`UV_NO_SOURCES`](#uv_no_sources)

added in `0.9.8`

Equivalent to the `--no-sources` command-line argument. If set, uv will ignore `[tool.uv.sources]` annotations when resolving dependencies.

### [`UV_NO_SOURCES_PACKAGE`](#uv_no_sources_package)

added in `0.9.26`

Equivalent to the `--no-sources-package` command line argument. If set, uv will ignore the `tool.uv.sources` table for the given space-delimited list of packages.

### [`UV_NO_SYNC`](#uv_no_sync)

added in `0.4.18`

Equivalent to the `--no-sync` command-line argument. If set, uv will skip updating the environment.

### [`UV_NO_VERIFY_HASHES`](#uv_no_verify_hashes)

added in `0.5.3`

Equivalent to the `--no-verify-hashes` argument. Disables hash verification for `requirements.txt` files.

### [`UV_NO_WRAP`](#uv_no_wrap)

added in `0.0.5`

Use to disable line wrapping for diagnostics.

### [`UV_OFFLINE`](#uv_offline)

added in `0.5.9`

Equivalent to the `--offline` command-line argument. If set, uv will disable network access.

### [`UV_OVERRIDE`](#uv_override)

added in `0.2.22`

Equivalent to the `--overrides` command-line argument. If set, uv will use this file as the overrides file. Uses space-separated list of files.

### [`UV_PRERELEASE`](#uv_prerelease)

added in `0.1.16`

Equivalent to the `--prerelease` command-line argument. For example, if set to `allow`, uv will allow pre-release versions for all dependencies.

### [`UV_PREVIEW`](#uv_preview)

added in `0.1.37`

Equivalent to the `--preview` argument. Enables preview mode.

### [`UV_PREVIEW_FEATURES`](#uv_preview_features)

added in `0.8.4`

Equivalent to the `--preview-features` argument. Enables specific preview features.

### [`UV_PROJECT`](#uv_project)

added in `0.4.4`

Equivalent to the `--project` command-line argument.

### [`UV_PROJECT_ENVIRONMENT`](#uv_project_environment)

added in `0.4.4`

Specifies the path to the directory to use for a project virtual environment.

See the [project documentation](../../concepts/projects/config/#project-environment-path) for more details.

### [`UV_PUBLISH_CHECK_URL`](#uv_publish_check_url)

added in `0.4.30`

Don't upload a file if it already exists on the index. The value is the URL of the index.

### [`UV_PUBLISH_INDEX`](#uv_publish_index)

added in `0.5.8`

Equivalent to the `--index` command-line argument in `uv publish`. If set, uv the index with this name in the configuration for publishing.

### [`UV_PUBLISH_NO_ATTESTATIONS`](#uv_publish_no_attestations)

added in `0.9.12`

Equivalent to the `--no-attestations` command-line argument in `uv publish`. If set, uv will skip uploading any collected attestations for the published distributions.

### [`UV_PUBLISH_PASSWORD`](#uv_publish_password)

added in `0.4.16`

Equivalent to the `--password` command-line argument in `uv publish`. If set, uv will use this password for publishing.

### [`UV_PUBLISH_TOKEN`](#uv_publish_token)

added in `0.4.16`

Equivalent to the `--token` command-line argument in `uv publish`. If set, uv will use this token (with the username `__token__`) for publishing.

### [`UV_PUBLISH_URL`](#uv_publish_url)

added in `0.4.16`

Equivalent to the `--publish-url` command-line argument. The URL of the upload endpoint of the index to use with `uv publish`.

### [`UV_PUBLISH_USERNAME`](#uv_publish_username)

added in `0.4.16`

Equivalent to the `--username` command-line argument in `uv publish`. If set, uv will use this username for publishing.

### [`UV_PYPY_INSTALL_MIRROR`](#uv_pypy_install_mirror)

added in `0.2.35`

Managed PyPy installations are downloaded from [python.org](https://downloads.python.org/).

This variable can be set to a mirror URL to use a different source for PyPy installations. The provided URL will replace `https://downloads.python.org/pypy` in, e.g., `https://downloads.python.org/pypy/pypy3.8-v7.3.7-osx64.tar.bz2`. Distributions can be read from a local directory by using the `file://` URL scheme.

### [`UV_PYTHON`](#uv_python)

added in `0.1.40`

Equivalent to the `--python` command-line argument. If set to a path, uv will use this Python interpreter for all operations.

### [`UV_PYTHON_BIN_DIR`](#uv_python_bin_dir)

added in `0.4.29`

Specifies the directory to place links to installed, managed Python executables.

### [`UV_PYTHON_CACHE_DIR`](#uv_python_cache_dir)

added in `0.7.0`

Specifies the directory for caching the archives of managed Python installations before installation.

### [`UV_PYTHON_CPYTHON_BUILD`](#uv_python_cpython_build)

added in `0.8.14`

Pin managed CPython versions to a specific build version.

For CPython, this should be the build date (e.g., "20250814").

### [`UV_PYTHON_DOWNLOADS`](#uv_python_downloads)

added in `0.3.2`

Equivalent to the [`python-downloads`](../settings/#python-downloads) setting and, when disabled, the `--no-python-downloads` option. Whether uv should allow Python downloads.

### [`UV_PYTHON_DOWNLOADS_JSON_URL`](#uv_python_downloads_json_url)

added in `0.6.13`

Managed Python installations information is hardcoded in the `uv` binary.

This variable can be set to a local path or URL pointing to a JSON list of Python installations to override the hardcoded list.

This allows customizing the URLs for downloads or using slightly older or newer versions of Python than the ones hardcoded into this build of `uv`.

### [`UV_PYTHON_GRAALPY_BUILD`](#uv_python_graalpy_build)

added in `0.8.14`

Pin managed GraalPy versions to a specific build version.

For GraalPy, this should be the GraalPy version (e.g., "24.2.2").

### [`UV_PYTHON_INSTALL_BIN`](#uv_python_install_bin)

added in `0.8.0`

Whether to install the Python executable into the `UV_PYTHON_BIN_DIR` directory.

### [`UV_PYTHON_INSTALL_DIR`](#uv_python_install_dir)

added in `0.2.22`

Specifies the directory for storing managed Python installations.

### [`UV_PYTHON_INSTALL_MIRROR`](#uv_python_install_mirror)

added in `0.2.35`

Managed Python installations are downloaded from the Astral [`python-build-standalone`](https://github.com/astral-sh/python-build-standalone) project.

This variable can be set to a mirror URL to use a different source for Python installations. The provided URL will replace `https://github.com/astral-sh/python-build-standalone/releases/download` in, e.g., `https://github.com/astral-sh/python-build-standalone/releases/download/20240713/cpython-3.12.4%2B20240713-aarch64-apple-darwin-install_only.tar.gz`. Distributions can be read from a local directory by using the `file://` URL scheme.

### [`UV_PYTHON_INSTALL_REGISTRY`](#uv_python_install_registry)

added in `0.8.0`

Whether to install the Python executable into the Windows registry.

### [`UV_PYTHON_PREFERENCE`](#uv_python_preference)

added in `0.3.2`

Whether uv should prefer system or managed Python versions.

### [`UV_PYTHON_PYODIDE_BUILD`](#uv_python_pyodide_build)

added in `0.8.14`

Pin managed Pyodide versions to a specific build version.

For Pyodide, this should be the Pyodide version (e.g., "0.28.1").

### [`UV_PYTHON_PYPY_BUILD`](#uv_python_pypy_build)

added in `0.8.14`

Pin managed PyPy versions to a specific build version.

For PyPy, this should be the PyPy version (e.g., "7.3.20").

### [`UV_REQUEST_TIMEOUT`](#uv_request_timeout)

added in `0.1.6`

Timeout (in seconds) for HTTP requests. Equivalent to `UV_HTTP_TIMEOUT`.

### [`UV_REQUIRE_HASHES`](#uv_require_hashes)

added in `0.1.34`

Equivalent to the `--require-hashes` command-line argument. If set to `true`, uv will require that all dependencies have a hash specified in the requirements file.

### [`UV_RESOLUTION`](#uv_resolution)

added in `0.1.27`

Equivalent to the `--resolution` command-line argument. For example, if set to `lowest-direct`, uv will install the lowest compatible versions of all direct dependencies.

### [`UV_S3_ENDPOINT_URL`](#uv_s3_endpoint_url)

added in `0.8.21`

The URL to treat as an S3-compatible storage endpoint. Requests to this endpoint will be signed using AWS Signature Version 4 based on the `AWS_ACCESS_KEY_ID`, `AWS_SECRET_ACCESS_KEY`, `AWS_PROFILE`, and `AWS_CONFIG_FILE` environment variables.

### [`UV_SKIP_WHEEL_FILENAME_CHECK`](#uv_skip_wheel_filename_check)

added in `0.8.23`

Avoid verifying that wheel filenames match their contents when installing wheels. This is not recommended, as wheels with inconsistent filenames should be considered invalid and corrected by the relevant package maintainers; however, this option can be used to work around invalid artifacts in rare cases.

### [`UV_STACK_SIZE`](#uv_stack_size)

added in `0.0.5`

Use to set the stack size used by uv.

The value is in bytes, and if both `UV_STACK_SIZE` are `RUST_MIN_STACK` unset, uv uses a 4MB (4194304) stack. `UV_STACK_SIZE` takes precedence over `RUST_MIN_STACK`.

Unlike the normal `RUST_MIN_STACK` semantics, this can affect main thread stack size, because we actually spawn our own main2 thread to work around the fact that Windows' real main thread is only 1MB. That thread has size `max(UV_STACK_SIZE, 1MB)`.

### [`UV_SYSTEM_PYTHON`](#uv_system_python)

added in `0.1.18`

Equivalent to the `--system` command-line argument. If set to `true`, uv will use the first Python interpreter found in the system `PATH`.

WARNING: `UV_SYSTEM_PYTHON=true` is intended for use in continuous integration (CI) or containerized environments and should be used with caution, as modifying the system Python can lead to unexpected behavior.

### [`UV_TEST_NO_HTTP_RETRY_DELAY`](#uv_test_no_http_retry_delay)

added in `0.7.21`

Used to disable delay for HTTP retries in tests.

### [`UV_TOOL_BIN_DIR`](#uv_tool_bin_dir)

added in `0.3.0`

Specifies the "bin" directory for installing tool executables.

### [`UV_TOOL_DIR`](#uv_tool_dir)

added in `0.2.16`

Specifies the directory where uv stores managed tools.

### [`UV_TORCH_BACKEND`](#uv_torch_backend)

added in `0.6.9`

Equivalent to the `--torch-backend` command-line argument (e.g., `cpu`, `cu126`, or `auto`).

### [`UV_UNMANAGED_INSTALL`](#uv_unmanaged_install)

added in `0.5.0`

Used ephemeral environments like CI to install uv to a specific path while preventing the installer from modifying shell profiles or environment variables.

### [`UV_UPLOAD_HTTP_TIMEOUT`](#uv_upload_http_timeout)

added in `0.9.1`

Timeout (in seconds) for only upload HTTP requests. (default: 900 s)

### [`UV_VENV_CLEAR`](#uv_venv_clear)

added in `0.8.0`

Equivalent to the `--clear` command-line argument. If set, uv will remove any existing files or directories at the target path.

### [`UV_VENV_SEED`](#uv_venv_seed)

added in `0.5.21`

Install seed packages (one or more of: `pip`, `setuptools`, and `wheel`) into the virtual environment created by `uv venv`.

Note that `setuptools` and `wheel` are not included in Python 3.12+ environments.

### [`UV_WORKING_DIR`](#uv_working_dir)

added in `next version`

Equivalent to the `--directory` command-line argument. `UV_WORKING_DIRECTORY` (added in v0.9.1) is also supported for backwards compatibility.

## [Externally defined variables](#externally-defined-variables)

uv also reads the following externally defined environment variables:

### [`ALL_PROXY`](#all_proxy)

added in `0.1.38`

General proxy for all network requests.

### [`ANDROID_API_LEVEL`](#android_api_level)

added in `0.8.16`

Used with `--python-platform aarch64-linux-android` and related variants to set the Android API level. (i.e., the minimum supported Android API level).

Defaults to `24`.

### [`APPDATA`](#appdata)

added in `0.1.42`

Path to user-level configuration directory on Windows systems.

### [`AWS_ACCESS_KEY_ID`](#aws_access_key_id)

added in `0.8.21`

The AWS access key ID to use when signing S3 requests.

### [`AWS_CONFIG_FILE`](#aws_config_file)

added in `0.8.21`

The AWS config file to use when signing S3 requests.

### [`AWS_DEFAULT_REGION`](#aws_default_region)

added in `0.8.21`

The default AWS region to use when signing S3 requests, if `AWS_REGION` is not set.

### [`AWS_PROFILE`](#aws_profile)

added in `0.8.21`

The AWS profile to use when signing S3 requests.

### [`AWS_REGION`](#aws_region)

added in `0.8.21`

The AWS region to use when signing S3 requests.

### [`AWS_SECRET_ACCESS_KEY`](#aws_secret_access_key)

added in `0.8.21`

The AWS secret access key to use when signing S3 requests.

### [`AWS_SESSION_TOKEN`](#aws_session_token)

added in `0.8.21`

The AWS session token to use when signing S3 requests.

### [`AWS_SHARED_CREDENTIALS_FILE`](#aws_shared_credentials_file)

added in `0.8.21`

The AWS shared credentials file to use when signing S3 requests.

### [`BASH_VERSION`](#bash_version)

added in `0.1.28`

Used to detect Bash shell usage.

### [`CLICOLOR_FORCE`](#clicolor_force)

added in `0.1.32`

Use to control color via `anstyle`.

### [`COLUMNS`](#columns)

added in `0.6.2`

Overrides terminal width used for wrapping. This variable is not read by uv directly.

This is a quasi-standard variable, described, e.g., in `ncurses(3x)`.

### [`CONDA_DEFAULT_ENV`](#conda_default_env)

added in `0.5.0`

Used to determine the name of the active Conda environment.

### [`CONDA_PREFIX`](#conda_prefix)

added in `0.0.5`

Used to detect the path of an active Conda environment.

### [`DEPENDABOT`](#dependabot)

added in `0.9.11`

Used to determine if we're running in Dependabot.

### [`FISH_VERSION`](#fish_version)

added in `0.1.28`

Used to detect Fish shell usage.

### [`FORCE_COLOR`](#force_color)

added in `0.2.7`

Forces colored output regardless of terminal support.

See [force-color.org](https://force-color.org).

### [`GITHUB_ACTIONS`](#github_actions)

added in `0.4.16`

Indicates that the current process is running in GitHub Actions.

`uv publish` may attempt trusted publishing flows when set to `true`.

### [`GITLAB_CI`](#gitlab_ci)

added in `0.8.18`

Indicates that the current process is running in GitLab CI.

`uv publish` may attempt trusted publishing flows when set to `true`.

### [`HF_TOKEN`](#hf_token)

added in `0.8.1`

Authentication token for Hugging Face requests. When set, uv will use this token when making requests to `https://huggingface.co/` and any subdomains.

### [`HOME`](#home)

added in `0.0.5`

The standard `HOME` env var.

### [`HTTPS_PROXY`](#https_proxy)

added in `0.1.38`

Proxy for HTTPS requests.

### [`HTTP_PROXY`](#http_proxy)

added in `0.1.38`

Proxy for HTTP requests.

### [`HTTP_TIMEOUT`](#http_timeout)

added in `0.1.7`

Timeout (in seconds) for HTTP requests. Equivalent to `UV_HTTP_TIMEOUT`.

### [`IPHONEOS_DEPLOYMENT_TARGET`](#iphoneos_deployment_target)

added in `0.8.16`

Used with `--python-platform arm64-apple-ios` and related variants to set the deployment target (i.e., the minimum supported iOS version).

Defaults to `13.0`.

### [`JPY_SESSION_NAME`](#jpy_session_name)

added in `0.2.6`

Used to detect when running inside a Jupyter notebook.

### [`KSH_VERSION`](#ksh_version)

added in `0.2.33`

Used to detect Ksh shell usage.

### [`LOCALAPPDATA`](#localappdata)

added in `0.3.3`

Used to look for Microsoft Store Pythons installations.

### [`MACOSX_DEPLOYMENT_TARGET`](#macosx_deployment_target)

added in `0.1.42`

Used with `--python-platform macos` and related variants to set the deployment target (i.e., the minimum supported macOS version).

Defaults to `13.0`, the least-recent non-EOL macOS version at time of writing.

### [`NETRC`](#netrc)

added in `0.1.16`

Use to set the .netrc file location.

### [`NO_COLOR`](#no_color)

added in `0.2.7`

Disables colored output (takes precedence over `FORCE_COLOR`).

See [no-color.org](https://no-color.org).

### [`NO_PROXY`](#no_proxy)

added in `0.1.38`

Comma-separated list of hostnames (e.g., `example.com`) and/or patterns (e.g., `192.168.1.0/24`) that should bypass the proxy.

### [`NU_VERSION`](#nu_version)

added in `0.1.16`

Used to detect `NuShell` usage.

### [`PAGER`](#pager)

added in `0.4.18`

The standard `PAGER` posix env var. Used by `uv` to configure the appropriate pager.

### [`PATH`](#path)

added in `0.0.5`

The standard `PATH` env var.

### [`PROMPT`](#prompt)

added in `0.1.16`

Used to detect the use of the Windows Command Prompt (as opposed to PowerShell).

### [`PWD`](#pwd)

added in `0.0.5`

The standard `PWD` posix env var.

### [`PYC_INVALIDATION_MODE`](#pyc_invalidation_mode)

added in `0.1.7`

The validation modes to use when run with `--compile`.

See [`PycInvalidationMode`](https://docs.python.org/3/library/py_compile.html#py_compile.PycInvalidationMode).

### [`PYTHONPATH`](#pythonpath)

added in `0.1.22`

Adds directories to Python module search path (e.g., `PYTHONPATH=/path/to/modules`).

### [`PYX_API_KEY`](#pyx_api_key)

added in `0.8.15`

The pyx API key (e.g., `sk-pyx-...`).

### [`PYX_API_URL`](#pyx_api_url)

added in `0.8.15`

The URL of the pyx Simple API server.

### [`PYX_AUTH_TOKEN`](#pyx_auth_token)

added in `0.8.15`

The pyx authentication token (e.g., `eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9...`), as output by `uv auth token`.

### [`PYX_CDN_DOMAIN`](#pyx_cdn_domain)

added in `0.8.15`

The domain of the pyx CDN.

### [`PYX_CREDENTIALS_DIR`](#pyx_credentials_dir)

added in `0.8.15`

Specifies the directory where uv stores pyx credentials.

### [`RUST_BACKTRACE`](#rust_backtrace)

added in `0.7.22`

If set, it can be used to display more stack trace details when a panic occurs. This is used by uv particularly on windows to show more details during a platform exception.

For example:

- `RUST_BACKTRACE=1` will print a short backtrace.
- `RUST_BACKTRACE=full` will print a full backtrace.

See the [Rust backtrace documentation](https://doc.rust-lang.org/std/backtrace/index.html) for more.

### [`RUST_LOG`](#rust_log)

added in `0.0.5`

If set, uv will use this value as the log level for its `--verbose` output. Accepts any filter compatible with the `tracing_subscriber` crate.

For example:

- `RUST_LOG=uv=debug` is the equivalent of adding `--verbose` to the command line
- `RUST_LOG=trace` will enable trace-level logging.

See the [tracing documentation](https://docs.rs/tracing-subscriber/latest/tracing_subscriber/filter/struct.EnvFilter.html#example-syntax) for more.

### [`RUST_MIN_STACK`](#rust_min_stack)

added in `0.5.19`

Use to set the stack size used by uv.

The value is in bytes, and if both `UV_STACK_SIZE` are `RUST_MIN_STACK` unset, uv uses a 4MB (4194304) stack. `UV_STACK_SIZE` takes precedence over `RUST_MIN_STACK`.

Prefer setting `UV_STACK_SIZE`, since `RUST_MIN_STACK` also affects subprocesses, such as build backends that use Rust code.

Unlike the normal `RUST_MIN_STACK` semantics, this can affect main thread stack size, because we actually spawn our own main2 thread to work around the fact that Windows' real main thread is only 1MB. That thread has size `max(RUST_MIN_STACK, 1MB)`.

### [`SHELL`](#shell)

added in `0.1.16`

The standard `SHELL` posix env var.

### [`SSL_CERT_DIR`](#ssl_cert_dir)

added in `0.9.10`

Custom path for certificate bundles for SSL connections. Multiple entries are supported separated using a platform-specific delimiter (`:` on Unix, `;` on Windows).

Takes precedence over `UV_NATIVE_TLS` when set.

### [`SSL_CERT_FILE`](#ssl_cert_file)

added in `0.1.14`

Custom certificate bundle file path for SSL connections.

Takes precedence over `UV_NATIVE_TLS` when set.

### [`SSL_CLIENT_CERT`](#ssl_client_cert)

added in `0.2.11`

If set, uv will use this file for mTLS authentication. This should be a single file containing both the certificate and the private key in PEM format.

### [`SYSTEMDRIVE`](#systemdrive)

added in `0.4.26`

Path to system-level configuration directory on Windows systems.

### [`TRACING_DURATIONS_FILE`](#tracing_durations_file)

added in `0.0.5`

Use to create the tracing durations file via the `tracing-durations-export` feature.

### [`USERPROFILE`](#userprofile)

added in `0.0.5`

Path to root directory of user's profile on Windows systems.

### [`UV`](#uv)

added in `0.6.0`

The path to the binary that was used to invoke uv.

This is propagated to all subprocesses spawned by uv.

If the executable was invoked through a symbolic link, some platforms will return the path of the symbolic link and other platforms will return the path of the symbolic link’s target.

See <https://doc.rust-lang.org/std/env/fn.current_exe.html#security> for security considerations.

### [`VIRTUAL_ENV`](#virtual_env)

added in `0.0.5`

Used to detect an activated virtual environment.

### [`VIRTUAL_ENV_DISABLE_PROMPT`](#virtual_env_disable_prompt)

added in `0.0.5`

If set to `1` before a virtual environment is activated, then the virtual environment name will not be prepended to the terminal prompt.

### [`XDG_BIN_HOME`](#xdg_bin_home)

added in `0.2.16`

Path to directory where executables are installed.

### [`XDG_CACHE_HOME`](#xdg_cache_home)

added in `0.1.17`

Path to cache directory on Unix systems.

### [`XDG_CONFIG_DIRS`](#xdg_config_dirs)

added in `0.4.26`

Path to system-level configuration directory on Unix systems.

### [`XDG_CONFIG_HOME`](#xdg_config_home)

added in `0.1.34`

Path to user-level configuration directory on Unix systems.

### [`XDG_DATA_HOME`](#xdg_data_home)

added in `0.2.16`

Path to directory for storing managed Python installations and tools.

### [`ZDOTDIR`](#zdotdir)

added in `0.2.25`

Used to determine which `.zshenv` to use when Zsh is being used.

### [`ZSH_VERSION`](#zsh_version)

added in `0.1.28`

Used to detect Zsh shell usage.

### [`_CONDA_ROOT`](#_conda_root)

added in `0.8.18`

Used to determine the root install path of Conda.