o
    ;i	                     @   s8  U d dl Z d dlZd dlZd dlZd dlZd dlZd dlZd dlZd dl	Z	d dl
mZmZ d dlmZmZ d dlmZmZmZmZ d dlmZ d dlZd dlZd dlmZ d dlmZ dd	lmZ dd
lm Z  ddl!m"Z" ddl#m$Z$m%Z%m&Z&m'Z' ddl(m)Z)m*Z*m+Z+ ddl,m-Z- ddl.m/Z/ ddl0m1Z1 ddl2m3Z3 ddl4m4Z4m5Z5 ddl6m7Z7m8Z8 ddl9m:Z: edZ;ee<d< dZ=dddddddZ>e?e@eAe@e@f f e<d< d ZBd!e@fd"d#ZCd$e@d!e@fd%d&ZDG d'd( d(e jEd)ZFd*eGeF d!eGeAeef  fd+d,ZHejIG d-d. d.eFZJejIG d/d0 d0eFZKd1efd2d3ZLd1efd4d5ZMejIG d6d7 d7eFZNG d8d9 d9eOZPG d:d; d;e d<d=ZQe'eQZRd>d? ZSe'eSZTd@dA ZUg dBZVdCefdDdEZWdFZXdGZYdHeX dIZ Z[	J	K	Kd\dLe3dMe@dNe@dOe@dPe@dQe@dRe\dSe\dTe\fdUdVZ]deGe>dWgdJdKfdXeGe@ dYeGe@ fdZd[Z^e'e^Z_dS )]    N)AsyncGenerator	Generator)PathPurePosixPath)CallableOptionalSequenceUnion)Message)api_pb2)__version__   )LoadContext)_Object)Resolver)TaskContextaclosing	async_mapsynchronize_api)FileUploadSpecblob_upload_fileget_file_upload_spec_from_path)Retry)check_object_name)get_module_mount_info)_Client)configlogger)ExecutionErrorInvalidError)FilePatternMatcherz/rootROOT_DIRiX  )20230826z3.10.13)r"   z3.11.5)20240107z3.12.1)20241008z3.13.0)20251205z3.14.2)20251209z3.14.2t)z3.10z3.11z3.12z3.13z3.14z3.14tPYTHON_STANDALONE_VERSIONSzmodal.Mount usage will soon be deprecated.

Use {replacement} instead, which is functionally and performance-wise equivalent.

See https://modal.com/docs/guide/modal-1-0-migration for more details.
returnc                  C   s4   t dt } r| d}ntdtd| S )z2Get the deployed name of the client package mount.z^([\d\.\w]+)r   z/Modal client has improperly formatted version: zmodal-client-mount-)rematchr   groupr   )mversion r.   ?/home/ubuntu/.local/lib/python3.10/site-packages/modal/mount.pyclient_mount_name?   s   
r0   r-   c                 C   s|   d| v r|  d\} }nd}| tvr tjd| dtt |dkr-tjd| t|  \}}d| d| d| S )z;Get the deployed name of the python-build-standalone mount.-gnuz'Unsupported standalone python version: z, supported values are zUnsupported libc identifier: zpython-build-standalone..)splitr'   modal	exceptionr   list)r-   libcreleasefull_versionr.   r.   r/   python_standalone_mount_nameI   s   r;   c                   @   s~   e Zd ZejdefddZejdeje	e
ef  fddZejde	e
e
f fddZejdee	e
ef  fdd	Zd
S )_MountEntryr(   c                 C      d S Nr.   selfr.   r.   r/   description[      z_MountEntry.descriptionc                 C   r=   r>   r.   r?   r.   r.   r/   get_files_to_upload^   rB   z_MountEntry.get_files_to_uploadc                 C   r=   r>   r.   r?   r.   r.   r/   watch_entrya   rB   z_MountEntry.watch_entryc                 C   r=   r>   r.   r?   r.   r.   r/   top_level_pathsd   rB   z_MountEntry.top_level_pathsN)__name__
__module____qualname__abcabstractmethodstrrA   typingIteratortupler   rC   rD   r7   r   rE   r.   r.   r.   r/   r<   Z   s     r<   )	metaclassentriesc                 C   s(   t  }| D ]
}|t | O }qt|S r>   )setrC   r7   )rP   	all_filesentryr.   r.   r/   _select_filesh   s   rT   c                   @   sV   e Zd ZU eed< eed< defddZdd Zdd	 Z	de
eeef  fd
dZdS )
_MountFile
local_fileremote_pathr(   c                 C   s
   t | jS r>   )rK   rV   r?   r.   r.   r/   rA   u   s   
z_MountFile.descriptionc                 c   s<    | j  }| sd| d}t|| j}||fV  d S )Nzlocal file  does not exist)rV   resolveexistsFileNotFoundErrorrW   )r@   rV   msgrel_filenamer.   r.   r/   rC   x   s   
z_MountFile.get_files_to_uploadc                 C   s   | j   }|j|fS r>   )rV   
expanduserabsoluteparent)r@   	safe_pathr.   r.   r/   rD      s   
z_MountFile.watch_entryc                 C      | j | jfgS r>   rV   rW   r?   r.   r.   r/   rE         z_MountFile.top_level_pathsN)rF   rG   rH   r   __annotations__r   rK   rA   rC   rD   r7   rN   rE   r.   r.   r.   r/   rU   p   s   
 	rU   c                   @   s   e Zd ZU eed< eed< eeegef e	j
jf ed< eed< dd Zdedeed	d	f fd
dZdedeed	d	f fddZdd Zdd Zdeeeef  fddZd	S )	_MountDir	local_dirrW   ignore	recursivec                 C   s   t | j  S r>   )rK   rg   r^   r_   r?   r.   r.   r/   rA         z_MountDir.descriptiontop_dirr(   Nc                 #   sX    t jddD ]!\ }} fdd|D |dd< |D ]
}t j |V  qqdS )z5Walk directories and prune ignored directories early.T)topdownc              	      s.   g | ]} ttj |s|qS r.   )rh   r   ospathjoinrelative_to).0drootr@   rk   r.   r/   
<listcomp>   s   . z-_MountDir._walk_and_prune.<locals>.<listcomp>Nrm   walkrn   ro   )r@   rk   dirsfilesfiler.   rs   r/   _walk_and_prune   s   z_MountDir._walk_and_prunec                 c   s6    t |D ]\}}}|D ]
}t j||V  qqdS )zWWalk all directories without early pruning - safe for complex/inverted ignore patterns.Nrv   )r@   rk   rt   _ry   rz   r.   r.   r/   	_walk_all   s   z_MountDir._walk_allc                 c   s    | j   }| sd| d}t|| s$d| d}t|| jr@t| j	t
jjr:| j	 r:| |}n| |}n
dd t|D }|D ]}t|}||}| 	|sj| j|  }| |fV  qLd S )Nz
local dir rX   z is not a directoryc                 s   s    | ]
}|  r|jV  qd S r>   )is_filern   )rq   	dir_entryr.   r.   r/   	<genexpr>   s    z0_MountDir.get_files_to_upload.<locals>.<genexpr>)rg   r^   r_   rZ   r[   is_dirNotADirectoryErrorri   
isinstancerh   r5   file_pattern_matcher_AbstractPatternMatchercan_prune_directoriesr{   r}   rm   scandirr   rp   rW   as_posixrY   )r@   rg   r\   genlocal_filename
local_pathrel_local_path
mount_pathr.   r.   r/   rC      s0   

z_MountDir.get_files_to_uploadc                 C   s   | j   d fS r>   )rg   rY   r^   r?   r.   r.   r/   rD      rj   z_MountDir.watch_entryc                 C   rb   r>   )rg   rW   r?   r.   r.   r/   rE      rd   z_MountDir.top_level_paths)rF   rG   rH   r   re   r   r	   r   boolr5   r   r   rA   r   rK   r{   r}   rC   rD   r7   rN   rE   r.   r.   r.   r/   rf      s   
 	rf   module_basec                    s"   d ddt f fdd}|S )NTfc                    sn   t | } r|jdkrdS |kr5||jkr5 r|jdkrdS r)|jdr)dS |j}|kr5||jksdS )Nz.pycF__pycache__r3   T)r   suffixr`   name
startswith)r   rn   SKIP_BYTECODESKIP_DOT_PREFIXEDr   r.   r/   	condition   s   	z)module_mount_condition.<locals>.conditionrK   )r   r   r.   r   r/   module_mount_condition   s   r   c                    s    fddS )Nc                    s   t  t|  S r>   )r   rK   )r   r   r.   r/   <lambda>   s    z/module_mount_ignore_condition.<locals>.<lambda>r.   r   r.   r   r/   module_mount_ignore_condition      r   c                   @   s   e Zd ZU eed< e Zee	ef ed< dZ
eeegef  ed< defddZdee fdd	Zdejeeef  fd
dZdeeef fddZdeeee	f  fddZdS )_MountedPythonModulemodule_name
remote_dirNrh   r(   c                 C   s   d| j  S )NzPythonPackage:)r   r?   r.   r.   r/   rA      r   z _MountedPythonModule.descriptionc           	   	   C   s   t | j}g }|D ]I}|\}}|r/t| jg| jdR  }|t||| jp)t|dd q	| jdd d }t| jg|t	|j
R  }|tt	||d q	|S )Nr3   T)rW   rh   ri   rc   )r   r   r   r   r4   appendrf   rh   r   r   r   rU   )	r@   mount_infosrP   
mount_info
is_package	base_pathr   path_segmentsrW   r.   r.   r/   _proxy_entries   s.   
	z#_MountedPythonModule._proxy_entriesc                 c   s"    |   D ]	}| E d H  qd S r>   )r   rC   r@   rS   r.   r.   r/   rC     s   z(_MountedPythonModule.get_files_to_uploadc                 C   s   |   D ]}|   S d S r>   )r   rD   r   r.   r.   r/   rD     s   z _MountedPythonModule.watch_entryc                 C   s$   g }|   D ]	}||  q|S r>   )r   extendrE   )r@   pathssubr.   r.   r/   rE     s   z$_MountedPythonModule.top_level_paths)rF   rG   rH   rK   re   r!   r   r   r	   r   rh   r   r   r   r   rA   r7   r<   r   rL   rM   rN   rC   rD   rE   r.   r.   r.   r/   r      s   
 r   c                   @   s   e Zd ZdS )NonLocalMountErrorN)rF   rG   rH   r.   r.   r.   r/   r     s    r   c                   @   s.  e Zd ZU dZdZeee  ed< dZ	ee
 ed< dZee ed< dZeed< dZee
 ed< eg fd	ee d
d fddZded
d fddZedd Zdee fddZd
eeeef  fddZd
efddZeejjfdededeegef fddZ ddddde!e
ef de!e
edf d eee
gef  d!ed
d f
d"d#Z"eddddde!e
ef de!e
edf d eee
gef  d!ed
d f
d$d%Z#	dFde!e
ef de!e
edf d
d fd&d'Z$edFde!e
ef de!e
edf d
d fd(d)Z%ed	ee d
e
fd*d+Z&ed	ee d
e'e(df fd,d-Z)d.d d/e*d0e+d1ee
 fd2d3Z,ee-. ddd4d5e
d6e!e
ef d eee
gef  dee!e/e
 eegef f  d
d f
d7d8Z0ee1j2ddd9d:e
d;ee
 d<ee3 d
d fd=d>Z4de1j2fdddd?d.d d@ee
 d;ee
 dAed<ee3 d
dfdBdCZ5d
e1j6fdDdEZ7dS )G_Mounta  
    **Deprecated**: Mounts should not be used explicitly anymore, use `Image.add_local_*` commands instead.

    Create a mount for a local directory or file that can be attached
    to one or more Modal functions.

    **Usage**

    ```python notest
    import modal
    import os
    app = modal.App()

    @app.function(mounts=[modal.Mount.from_local_dir("~/foo", remote_path="/root/foo")])
    def f():
        # `/root/foo` has the contents of `~/foo`.
        print(os.listdir("/root/foo/"))
    ```

    Modal syncs the contents of the local directory every time the app runs, but uses the hash of
    the file's contents to skip uploading files that have been uploaded before.
    N_entries_deployment_name
_namespaceF_allow_overwrite_content_checksum_sha256_hexrP   r(   c                    s@   d  d} fdd}t jt j||t d} |_d|_|S )NzMount()c                     sD   zt  d t I d H } W n
 ty   Y d S w tjdt| fS )Nlocal)asyncioget_event_looprun_in_executorrT   r   r   _type_prefix	frozenset)included_filesrP   r.   r/   mount_content_deduplication_keyF  s   z4_Mount._new.<locals>.mount_content_deduplication_key)deduplication_keyload_context_overridesT)r   _from_loader_load_mountr   emptyr   	_is_local)rP   repr   objr.   r   r/   _newB  s   z_Mount._newrS   c                 C   s   t | j|g S r>   )r   r   r   r   r.   r.   r/   _extendW  rj   z_Mount._extendc                 C   s   | j du rt | j S )mdmd:hiddenN)r   r   r?   r.   r.   r/   rP   Z  s   
z_Mount.entrieshandle_metadatac                 C   s   t |tjsJ |j| _d S r>   )r   r   MountHandleMetadatacontent_checksum_sha256_hexr   )r@   r   r.   r.   r/   _hydrate_metadataa  s   z_Mount._hydrate_metadatac                 C   s"   g }| j D ]	}||  q|S r>   )rP   r   rE   )r@   resrS   r.   r.   r/   _top_level_pathse  s   
z_Mount._top_level_pathsc                 C   s   t | ddS )r   r   F)getattrr?   r.   r.   r/   is_localm  s   z_Mount.is_localr   rW   rh   c                 C   s   t  t| ||ddS )NT)rg   rW   rh   ri   )r   r   r   rf   )r   rW   rh   r.   r.   r/   _add_local_dirs  s   z_Mount._add_local_dirTrW   r   ri   r   ri   c                   s`   t |}|du r|j}td|} du rdd }| dt dtf fdd}| t||||d	S )
z>
        Add a local directory to the `Mount` object.
        N/c                 S   s   dS )NTr.   rn   r.   r.   r/   include_all  rB   z)_Mount.add_local_dir.<locals>.include_allrn   r(   c                        t |  S r>   r   r   r   r.   r/   converted_condition  rd   z1_Mount.add_local_dir.<locals>.converted_condition)rg   rh   rW   ri   )r   r   r   r   r   rf   )r@   r   rW   r   ri   r   r   r.   r   r/   add_local_dir  s    
z_Mount.add_local_dirc                C   s   t  j| |||dS )Nr   )r   r   r   )r   rW   r   ri   r.   r.   r/   _from_local_dir  s   z_Mount._from_local_dirc                 C   s6   t |}|du r|j}td|}| t|t|dS )z9
        Add a local file to the `Mount` object.
        Nr   rc   )r   r   r   r   rU   )r@   r   rW   r.   r.   r/   add_local_file  s   
z_Mount.add_local_filec                 C   s   t  j| |dS )NrW   )r   r   r   )r   rW   r.   r.   r/   _from_local_file  s   z_Mount._from_local_filec                 C   s   dd | D }d |S )Nc                 S   s   g | ]}|  qS r.   )rA   )rq   er.   r.   r/   ru     s    z'_Mount._description.<locals>.<listcomp>z, )ro   )rP   local_contentsr.   r.   r/   _description  s   
z_Mount._descriptionc                 C  s   t  }tj ^}||t| I d H }tdt	| d|j
 d |D ]9\}}ztd| d|  ||t||I d H }|V  W q& ty_ } ztd|  W Y d }~q&d }~ww W d    d S 1 skw   Y  d S )NzComputing checksums for z files using z worker threadsz	Mounting  as zIgnoring file not found: )r   r   
concurrentfuturesThreadPoolExecutorr   rT   r   debuglen_max_workersr   r[   info)rP   loopexerR   r   remote_filename	file_specexcr.   r.   r/   
_get_files  s$   

"z_Mount._get_filesr@   resolverload_contextexisting_object_idc                    s  t  }d\d\	t  ddlm} t| jt	d|
 }| dtdtjf 	f
dd}d	}g }	ttt| j||d
4 I d H }
|
2 z3 d H W }|	| qV6 W d   I d H  n1 I d H ssw   Y  |	std d d dt|	 d | jr| jrtjntj}tj| j| jj||	d}njd urtjtj|	jd}n
tjtj |	jd}j!j"j#|t$dddI d H }%d  t&d	 d dt  |  d | '|j(j!|j) d S )N)r   r   r   )OutputManager   r   r(   c              	      s  d7  d d d d | j}tj|| j| jd}| j v r,d7 |S tddkra| jrat	
| jj}|jkra| j d	}tdd
krUtj|tddkrat| tj| jd} | j jjj|tdddI d H }|jrd7 |S 	d7 	| j7 | jrtd| j d| j d 4 I d H . |  }t|jj| j| j dI d H }W d    n1 sw   Y  W d   I d H  n1 I d H sw   Y  td| j d|  tj|| jd}	n,td| j d| d| j d | j!d u rt"#| j$I d H }
n| j!}
tj|
| jd}	t%& }t%& | t'k rOjjj|	tdddI d H }|jrFd7 |S t%& | t'k s-tj(d| j d)Nr   Creating mount z: Uploaded r    files)filename
sha256_hexmodebuild_validationrh   z# was modified during build process.errorwarn)r   
base_delayretryzCreating blob file for z (z bytes))r   md5_hexzUploading blob file r   )data_blob_idr   zUploading file z to )datar   zMounting of z
 timed out))messagemount_filenamer   	MountFiler   r   r   getsource_is_pathrm   statsource_descriptionst_mtimebuild_startr5   r6   r   warningsr   MountPutFileRequestaddclientstubMountPutFiler   rZ   sizeuse_blobr   r   sourcer   r  contentr   	to_threadread_contenttime	monotonicMOUNT_PUT_FILE_CLIENT_TIMEOUTMountUploadTimeoutError)r   r   
mount_filemtimer\   requestresponsefpblob_idrequest2r  
start_time
accounted_hashesblob_upload_concurrencyr   message_label
n_finishedn_seenr   
status_rowtotal_bytestotal_uploadsr.   r/   	_put_file  sl   




(z%_Mount._load_mount.<locals>._put_file@   )concurrencyz
Mount of 'z' is empty.r   z: Finalizing index of r   )deployment_name	namespaceenvironment_nameobject_creation_typery   )r4  ry   app_id)r4  ry   r3  r   r   r   zCreated mount z	Uploaded z new files and z
 bytes in s)*r  r  rQ   modal.outputr   r   r   r   r   	Semaphorer  add_status_rowr   r   r  r   r   r   r   r   warningr  r   r   r   &OBJECT_CREATION_TYPE_CREATE_IF_MISSING*OBJECT_CREATION_TYPE_CREATE_FAIL_IF_EXISTSMountGetOrCreateRequestr   r3  r5  +OBJECT_CREATION_TYPE_ANONYMOUS_OWNED_BY_APPOBJECT_CREATION_TYPE_EPHEMERALr  r  MountGetOrCreater   finishr   _hydratemount_idr   )r@   r   r   r   t0r   
output_mgrr.  n_concurrent_uploadsry   streamrz   creation_typereqrespr.   r%  r/   r     sf   
*C(
&z_Mount._load_mount)r   r   rh   module_namesr   c                    sn    d ur|d urt ddtdtf fdd}|}n	t|tr#t| }t }|D ]}|t	|| |}q)|S )Nz,Cannot specify both `ignore` and `condition`rn   r(   c                    r   r>   r   r   r   r.   r/   r   y  rd   z?_Mount._from_local_python_packages.<locals>.converted_condition)
r   r   r   r   r7   r    r   r   r   r   )r   r   rh   rK  r   mountr   r.   r   r/   _from_local_python_packagesl  s   	
z"_Mount._from_local_python_packages)r2  r3  r  r   r3  r  c                   s:   dt dtdtt f fdd}t j|ddt||dd	S )
r   providerr   r   c                    s@   t j |jd}|jj|I d H }| |j|j|j d S )N)r1  r2  r3  )	r   r=  r3  r  r  r@  rB  rC  r   )rN  r   r   r   rI  r   r   r2  r.   r/   _load  s   z_Mount.from_name.<locals>._loadzMount()T)r3  r  )hydrate_lazilyr   )r   r   r   rK   r   r   )r   r2  r3  r  rP  r.   rO  r/   	from_name  s    
	
z_Mount.from_namer3  allow_overwriter  r1  rT  c          	   	      s   t |d || _|| _|| _t }t 4 I d H }t|||d}|| |I d H  W d   I d H  d S 1 I d H s;w   Y  d S )NMount)r  r3  task_context)r   r   r   r   r   r   r   load)	r@   r1  r2  r3  rT  r  r   tcr   r.   r.   r/   _deploy  s   
	.z_Mount._deployc                 C   s    | j d u r	tdtj| j dS )Nz-Trying to access checksum of unhydrated mount)r   )r   
ValueErrorr   r   r?   r.   r.   r/   _get_metadata  s   
z_Mount._get_metadatar>   )8rF   rG   rH   __doc__r   r   r7   r<   re   r   rK   r   intr   r   r   staticmethodr   r   propertyrP   r
   r   rN   r   r   r   r   r5   r   _NOTHINGr   r   r	   r   r   r   r   r   r   r   r   r   r   r   r!   r   r   rM  r   DEPLOYMENT_NAMESPACE_WORKSPACEr   rR  rY  r   r[  r.   r.   r.   r/   r   #  s   
 



&
	


, 
 

r   mo)type_prefixc                  C   s   dd l } dd l}tj|jd \}}t }tD ]}t	|| }|j
|d| t|dd}qt	| jd }|j
|dt|dd}|S )Nr   z/pkg/Tr   z/pkg/synchronicity)synchronicityr5   rm   rn   r4   __path__r   r   MODAL_PACKAGESr   r   r   )rd  r5   modal_parent_dirr|   client_mountpkg_namepackage_base_pathsynchronicity_base_pathr.   r.   r/   _create_client_mount  s(   rl  c                   C   s    t d rt S tjt tjdS )Nsync_entrypointr2  )r   rl  r   rR  r0   r   DEPLOYMENT_NAMESPACE_GLOBALr.   r.   r.   r/   _get_client_mount  s   rp  )r5   modal_protomodal_versionrW   c                    sP   | j d d }ddg}|D ] | fddtD v p| d k}|r% dS qdS )	N   )r   rt   )r   pkgc                    s   g | ]} |f qS r.   r.   )rq   modbaser.   r/   ru     s    z"_is_modal_path.<locals>.<listcomp>)rd  TF)partsrf  )rW   path_prefixremote_python_pathsis_modal_pathr.   rv  r/   _is_modal_path  s   "r|  z/__modal/depsz/pkg/sitecustomize.pyz
# This file is automatically generated by Modal.
# It ensures that Modal's python dependencies are available in the Python PATH,
# while prioritizing user-installed packages.
import sys; sys.path.append('z')
TFr  builder_versionpython_versionarchplatformuv_python_platformcheck_if_existsrT  dry_runc	                    s  dd l }	td}
d|dd }| d| d| d| }|rGztj|tjdj	| I d H  t
d| d	 W d S  tjjyF   Y nw |	jd
d}t
d| d tjtjtd| d}dddddddd|dd|d|d|g}tj|tjjtjjdI d H }| I d H  |jr| I d H \}}t
|d t
|d td|j t
d| d| d tj|td }|	 b}| t!"d |#  |j$|j%t&d }|sz|j'j	|tj|
|| d!I d H  t
d"| d# W n) tjj(y } zt
d$t)|j* d%|  W Y d }~nd }~ww t
d&|  W d    n1 s-w   Y  W d    d S W d    d S 1 sFw   Y  d S )'Nr   environmentcpr3    r1   rn  u   ➖ Found existing mount z in global namespace.T)ignore_cleanup_errorsu   📦 Building zbuilder/z.txt uvpipinstallz--strictz	--no-depsz
--no-cachez-rz--compile-bytecodez--targetz--python-platformz--python)stdoutstderrzutf-8zSubprocess failed with u   🌐 Downloaded and unpacked z packages to r   rS  u   ✅ Deployed mount z to global namespace.u"   ⚠️ Mount creation failed with z: z'Dry run - skipping deployment of mount )+tempfiler   r  replacerU  rR  r   ro  hydrateaioprintr5   r6   NotFoundErrorTemporaryDirectoryrm   rn   ro   dirname__file__r   create_subprocess_shell
subprocessPIPEwait
returncodecommunicatedecodeRuntimeErrorr   REMOTE_PACKAGES_PATHNamedTemporaryFilewriteSITECUSTOMIZE_CONTENTencodeflushr   r   REMOTE_SITECUSTOMIZE_PATHrY  ErrortyperF   )r  r}  r~  r  r  r  r  rT  r  r  profile_environmentabi_tag
mount_nametmpdrequirementscmdprocr  r  python_mountsitecustomizer   r.   r.   r/   &_create_single_client_dependency_mount  s   

& &$r  z2025.06python_versionsbuilder_versionsc                    s   d}d| dfd| dfg}g }|D ]$}|D ]}	|D ]\}
}| t| |	|||
||o/|	dk|	dk|d	 qqqtj| I d H  d S )Nx86_64manylinux_2_17z-manylinux_2_17musllinux_1_2z-unknown-linux-muslPREVIEW)r  rT  r  )r   r  r   gather)r  r  r  r  r  r  platform_tagscorosr~  r}  r  r  r.   r.   r/    _create_client_dependency_mountsX  s2   
r  )TFF)`rI   r   concurrent.futuresr   dataclassesrm   r)   r  rL   r  collections.abcr   r   pathlibr   r   r   r   r   r	   google.protobuf.messager
   modal.exceptionr5   modal.file_pattern_matcherrq  r   rr  r   _load_contextr   _objectr   	_resolverr   _utils.async_utilsr   r   r   r   _utils.blob_utilsr   r   r   _utils.grpc_utilsr   _utils.name_utilsr   _utils.package_utilsr   r  r   r   r   r6   r   r   r   r    r!   re   r  r'   dictrK   rN   !MOUNT_DEPRECATION_MESSAGE_PATTERNr0   r;   ABCMetar<   r7   rT   	dataclassrU   rf   r   r   r   	Exceptionr   r   rU  rl  create_client_mountrp  rf  r|  r  r  stripr  r   r  r  create_client_dependency_mountsr.   r.   r.   r/   <module>   s   
	
">6   	
[
#