o
    oi                     @   s   d dl Z d dlZd dlmZmZ d dlmZ d dlm	Z	 d dl
mZmZ d dlmZ dZejedZejed	Zejed
Zejdd dv Zdedede	fddZedejedddZdeeef fddZdeeef fddZdS )    N)module_from_specspec_from_file_locationPath)
ModuleType)AnyDict)find_namespace_packages.src	lightningrequirementsFREEZE_REQUIREMENTS0)1truenamelocationreturnc                 C   sT   t | |}|sJ d|  d| t|}|js"J d|  d| |j| |S )NzFailed to load module z from zModuleSpec.loader is None for )r   r   loaderexec_module)r   r   specpy r   G/home/ubuntu/.local/lib/python3.10/site-packages/lightning/__setup__.py_load_py_module   s   
r   	assistantz.actionszassistant.py)r   r   c                     sL  dd t  tjtddD } dtrdndi  fdd	| D }|d
 |d  |d< |d |d  |d< |d |d  |d  |d< |d |d  |d< t|D ]}d|ddd  }||g ||  ||< qQt|	 D ]#}|d}t
|dkr|d |d ksqrt|| ||d < ||= qrdd	 | D }td| |S )Nc                 S   s   g | ]}t |qS r   r   .0pr   r   r   
<listcomp>"   s    z#_prepare_extras.<locals>.<listcomp>*z*.txtunfreezenonemajorc                    sP   i | ]$}|j d vr|jj ds|jj  d|j tjd|j |jd qS ))zdocs.txtzbase.txt_-)	file_namepath_dirr   )r   parent
startswithstem
_ASSISTANTload_requirementsr   common_argsr   r   
<dictcomp>%   s
    *z#_prepare_extras.<locals>.<dictcomp>zfabric-strategieszfabric-examplesz
fabric-allzfabric-testz
fabric-devzpytorch-extrazpytorch-strategieszpytorch-exampleszpytorch-allzpytorch-testzpytorch-devr&         r   c                 S   s   i | ]\}}|t t|qS r   )sortedset)r   r   reqsr   r   r   r0   =   s    zThe extras are: )globospathjoin_PATH_REQUIREMENTS_FREEZE_REQUIREMENTSlistsplitgetkeyslenitemsprint)	req_filesextrasextrar   kkkr   r.   r   _prepare_extras   s*    


rH   c                  C   s  t dtjtd} t dtjtd}tjt| j|j	d}tj
ttr%dndd}|d	g7 }i d
dd|j	d| jd| jd| jd| jddd| jdtdddgddddid|ddddddd g d!d"d#d$d%d&d'gig |t d(d)dd*g d+d,S )-Naboutz__about__.pyversionz__version__.py)homepagerJ   r#   r$   )r"   zpytorch-lightningr   r   descriptionauthorauthor_emailurldownload_urlz)https://github.com/Lightning-AI/lightninglicensepackagesr   zlightning.*)whereincludepackage_dir long_descriptionlong_description_content_typeztext/markdowninclude_package_dataTzip_safeFkeywords)zdeep learningpytorchAIpython_requiresz>=3.9entry_pointsconsole_scriptsz#fabric = lightning.fabric.cli:_mainz-lightning = lightning.fabric.cli:_legacy_mainz0https://github.com/Lightning-AI/lightning/issuesz#https://lightning.ai/lightning-docs)zBug TrackerDocumentationzSource Code)zEnvironment :: ConsolezNatural Language :: EnglishzDevelopment Status :: 4 - BetazIntended Audience :: Developersz:Topic :: Scientific/Engineering :: Artificial Intelligencez7Topic :: Scientific/Engineering :: Information Analysisz2License :: OSI Approved :: Apache Software Licensez"Operating System :: OS Independentz#Programming Language :: Python :: 3z%Programming Language :: Python :: 3.9z&Programming Language :: Python :: 3.10z&Programming Language :: Python :: 3.11z&Programming Language :: Python :: 3.12)setup_requiresinstall_requiresextras_requireproject_urlsclassifiers)r   r7   r8   r9   _PACKAGE_ROOTr,   load_readme_description_PROJECT_ROOT__homepage__rJ   r-   r:   r;   __docs__
__author____author_email____license__r	   rH   )rI   rJ   rW   rc   r   r   r   _setup_argsB   st   

	
ro   )r6   os.pathr7   importlib.utilr   r   pathlibr   typesr   typingr   r   
setuptoolsr	   ri   r8   r9   _SOURCE_ROOTrg   r:   environr>   lowerr;   strr   r,   rH   ro   r   r   r   r   <module>   s     	%