2626
2727
2828# Examples 
29- def  _get_examples_dir () ->  Path :
29+ def  _get_examples_dir (root_path = None ) ->  Path :
3030    """Return the absolute path to the installed examples directory. 
3131
3232    Returns 
@@ -39,7 +39,7 @@ def _get_examples_dir() -> Path:
3939    FileNotFoundError 
4040        If the examples directory cannot be located in the installation. 
4141    """ 
42-     with  get_package_dir () as  pkgdir :
42+     with  get_package_dir (root_path ) as  pkgdir :
4343        pkg  =  Path (pkgdir ).resolve ()
4444        for  c  in  (
4545            pkg  /  "docs"  /  "examples" ,
@@ -72,6 +72,74 @@ def map_pack_to_examples() -> dict[str, List[str]]:
7272    return  examples_by_pack 
7373
7474
75+ def  copy_examples (
76+     examples : str  |  List [str ],
77+     target_dir : Optional [Path ] =  None ,
78+ ) ->  List [Path ]:
79+     """Copy one or more examples to a target directory. 
80+ 
81+     Parameters 
82+     ---------- 
83+     examples : str or list of str 
84+         Example name(s): 'example1' or ['example1', 'example2'] 
85+     target_dir : Path, optional 
86+         Target directory where examples should be copied. 
87+         Defaults to current working directory if not specified. 
88+     overwrite : bool, default False 
89+         If True, overwrite existing directories. If False, raise 
90+         FileExistsError when destination exists. 
91+ 
92+     Returns 
93+     ------- 
94+     list of Path 
95+         List of destination paths created. 
96+ 
97+     Raises 
98+     ------ 
99+     ValueError 
100+         If example name is ambiguous (exists in multiple packs). 
101+     FileNotFoundError 
102+         If example does not exist. 
103+     FileExistsError 
104+         If destination exists and overwrite=False. 
105+     """ 
106+     return 
107+ 
108+ 
109+ def  copy_packs (
110+     packs : str  |  List [str ],
111+     target_dir : Optional [Path ] =  None ,
112+ ) ->  List [Path ]:
113+     """Copy all examples from one or more packs to a target directory. 
114+ 
115+     Parameters 
116+     ---------- 
117+     packs : str or list of str 
118+         Pack name(s). Can be: 
119+         - Single pack name: 'pack1' 
120+         - List of pack names: ['pack1', 'pack2'] 
121+         - Special keyword: 'all' (copies all packs) 
122+     target_dir : Path, optional 
123+         Target directory where examples should be copied. 
124+         Defaults to current working directory if not specified. 
125+ 
126+     Returns 
127+     ------- 
128+     list of Path 
129+         List of destination paths created (all examples from the pack(s)). 
130+ 
131+     Raises 
132+     ------ 
133+     ValueError 
134+         If pack name is invalid. 
135+     FileNotFoundError 
136+         If pack does not exist. 
137+     FileExistsError 
138+         If any destination exists. 
139+     """ 
140+     return 
141+ 
142+ 
75143def  copy_example (pack_example : str ) ->  Path :
76144    """Copy an example into the current working directory. 
77145
0 commit comments