pyreduce-astro 0.7a3__cp312-cp312-win_amd64.whl → 0.7a4__cp312-cp312-win_amd64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
pyreduce/__main__.py CHANGED
@@ -161,20 +161,25 @@ def download(instrument):
161
161
  "--list", "-l", "list_examples", is_flag=True, help="List available examples"
162
162
  )
163
163
  @click.option("--all", "-a", "download_all", is_flag=True, help="Download all examples")
164
+ @click.option("--run", "-r", is_flag=True, help="Run the example after downloading")
164
165
  @click.option("--output", "-o", default=".", help="Output directory")
165
- def examples(filename, list_examples, download_all, output):
166
- """List or download example scripts from GitHub.
166
+ def examples(filename, list_examples, download_all, run, output):
167
+ """List, download, or run example scripts from GitHub.
167
168
 
168
169
  Downloads examples matching your installed PyReduce version.
169
170
 
170
171
  \b
171
172
  Examples:
172
- reduce examples # List available examples
173
- reduce examples uves_example.py # Download to current dir
174
- reduce examples --all -o ~/scripts # Download all to ~/scripts
173
+ reduce examples # List available examples
174
+ reduce examples uves_example.py # Download to current dir
175
+ reduce examples -r uves_example.py # Download and run
176
+ reduce examples --all -o ~/scripts # Download all to ~/scripts
175
177
  """
176
178
  import json
177
179
  import os
180
+ import subprocess
181
+ import sys
182
+ import tempfile
178
183
  import urllib.request
179
184
  from urllib.error import HTTPError
180
185
 
@@ -212,6 +217,32 @@ def examples(filename, list_examples, download_all, output):
212
217
  click.echo(f" {name}")
213
218
  return
214
219
 
220
+ if run and download_all:
221
+ raise click.ClickException("Cannot use --run with --all")
222
+
223
+ # Run mode: download to temp and execute
224
+ if run:
225
+ if filename not in example_files:
226
+ raise click.ClickException(
227
+ f"Unknown example '{filename}'. Use 'reduce examples --list' to see available."
228
+ )
229
+ url = f"{github_raw}/{filename}"
230
+ with tempfile.NamedTemporaryFile(mode="w", suffix=".py", delete=False) as f:
231
+ try:
232
+ with urllib.request.urlopen(url) as resp:
233
+ f.write(resp.read().decode())
234
+ temp_path = f.name
235
+ except HTTPError as e:
236
+ raise click.ClickException(
237
+ f"Failed to download {filename}: {e}"
238
+ ) from None
239
+ try:
240
+ click.echo(f"Running {filename}...")
241
+ result = subprocess.run([sys.executable, temp_path], check=False)
242
+ sys.exit(result.returncode)
243
+ finally:
244
+ os.unlink(temp_path)
245
+
215
246
  # Ensure output directory exists
216
247
  os.makedirs(output, exist_ok=True)
217
248
 
Binary file
Binary file
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pyreduce-astro
3
- Version: 0.7a3
3
+ Version: 0.7a4
4
4
  Summary: A data reduction package for echelle spectrographs
5
5
  Project-URL: Homepage, https://github.com/ivh/PyReduce
6
6
  Project-URL: Documentation, https://pyreduce-astro.readthedocs.io
@@ -1,5 +1,5 @@
1
1
  pyreduce/__init__.py,sha256=e_576KbKh0jALuzvpI-VLeILhtQYJAPTDD0XMb189gM,1797
2
- pyreduce/__main__.py,sha256=Vn0dZBuFwNF-DISyt1lvs0R41PSUgZeAdXzdVnnc25E,8602
2
+ pyreduce/__main__.py,sha256=KV5z5kqydHKMtTQ_LNEdQs8xtBmyFcOqY5cpOwtVrEg,9885
3
3
  pyreduce/cli.py,sha256=w8k5OticZ8rzh5JshYv3MBp_Sx0PtECiSOdR3VboNB0,10937
4
4
  pyreduce/clipnflip.py,sha256=S-9CaTfRwPHWJUq92Iv2K1T-4Oe6MmROJQpzv2cMaOI,5704
5
5
  pyreduce/combine_frames.py,sha256=VnvLXexXisunuZ05whbhzSemoahQ6pd7cOoz8Uz_fWU,30407
@@ -19,10 +19,10 @@ pyreduce/trace.py,sha256=VAl6sgjmfYmfNLsddzwx_f4x-oT3KsGiUfhHMoHNGxM,33667
19
19
  pyreduce/util.py,sha256=MpyEpjOzvINBx1ixMWaF7huYZ7GylDOXMdR0Va6ljUI,40870
20
20
  pyreduce/wavelength_calibration.py,sha256=1BT6KfAd7sIabQEb2D0n3511p3IY03G5pvGiB3j9e1E,70592
21
21
  pyreduce/clib/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
22
- pyreduce/clib/_slitfunc_2d.cp311-win_amd64.pyd,sha256=SIsaqblhKZp4XDpgrM3JmqJiu8SeMggLRkk1h8GTZBA,35328
23
- pyreduce/clib/_slitfunc_2d.cp312-win_amd64.pyd,sha256=QuTBupPQD0xL1dL_ENQly4rUBzW56YJmZk_GgskNdEs,35328
24
- pyreduce/clib/_slitfunc_bd.cp311-win_amd64.pyd,sha256=bJUsdLDA8-UNx9QeV6rZrj2XZVtkZ1t_xaPq7SyB0UM,25600
25
- pyreduce/clib/_slitfunc_bd.cp312-win_amd64.pyd,sha256=H02ZpIESyOg2Ldh-GSDup8Cygo4Ch-fixBCMeV-5Hvs,25600
22
+ pyreduce/clib/_slitfunc_2d.cp311-win_amd64.pyd,sha256=_7iPNwZZMAdA2UWggpT8tEK19y8nbeLIvXu43mEX3h4,35328
23
+ pyreduce/clib/_slitfunc_2d.cp312-win_amd64.pyd,sha256=NP-C2mXnABORwotN58gu6vN_c1QmH1v3GgWsXrd-x8I,35328
24
+ pyreduce/clib/_slitfunc_bd.cp311-win_amd64.pyd,sha256=rMif07DHX2oNN131Q7tqYWiLmpZiTUweBWfFU7wU7s8,25600
25
+ pyreduce/clib/_slitfunc_bd.cp312-win_amd64.pyd,sha256=MRhnTTKWiGhFnLgt2FS_pTbrvzGupK9sZTgTQv7oLiU,25600
26
26
  pyreduce/clib/build_extract.py,sha256=WTEpyRZWDR4AUkT1mkxmsWbXuRLG2jrRbJC5M8MKi3M,2020
27
27
  pyreduce/clib/slit_func_2d_xi_zeta_bd.c,sha256=o_R_3hq0tX2ZdaCRxJjY2mXQf4RaYENcVKVn2OZR_Rk,51279
28
28
  pyreduce/clib/slit_func_2d_xi_zeta_bd.h,sha256=ezWP3JXfbviCN5FAbB9AJYB1YnAGFhsO5N3wCt-rbmU,1567
@@ -32,12 +32,12 @@ pyreduce/clib/Release/_slitfunc_2d.cp311-win_amd64.exp,sha256=q8wjTJVR5JcAWPIRRh
32
32
  pyreduce/clib/Release/_slitfunc_2d.cp311-win_amd64.lib,sha256=lGF5nklzUbwgdVg81n0_uCx_2gk3kIRkerTCFga1etM,2104
33
33
  pyreduce/clib/Release/_slitfunc_2d.cp312-win_amd64.exp,sha256=ap2hnA20RvdJAV-jrpe9t77IQBREBSdNnmYz3r5s_hw,763
34
34
  pyreduce/clib/Release/_slitfunc_2d.cp312-win_amd64.lib,sha256=cD10d0NBKuPxsmHfYZ17F9O6tt2X3vwfHv49fx7i7mg,2104
35
- pyreduce/clib/Release/_slitfunc_2d.obj,sha256=9efIgrWH9rC3rdDtsaeCgpw4Ay8TIx62-B6PGtZiYvw,230047
35
+ pyreduce/clib/Release/_slitfunc_2d.obj,sha256=QKz7YbA5gW3uuDoT5udN_wPicLYYqC8BHuWpuNGahfg,230047
36
36
  pyreduce/clib/Release/_slitfunc_bd.cp311-win_amd64.exp,sha256=vHZNO5hq4YBqgpgWXOW7wELiB-Pex2QFRvKbLH-vIYY,763
37
37
  pyreduce/clib/Release/_slitfunc_bd.cp311-win_amd64.lib,sha256=hcG-cWafgtz6nNO12lFFtkVLhVAsQyuCpPD78rfPQzs,2104
38
38
  pyreduce/clib/Release/_slitfunc_bd.cp312-win_amd64.exp,sha256=BWCVspYP1T2q5yNWlVpCfK6JWR44RuNiFhWW3H6kNLc,763
39
39
  pyreduce/clib/Release/_slitfunc_bd.cp312-win_amd64.lib,sha256=tJ-lz6MJn-UOdBfx7yFQqrNw4NEmKinrbm8vx2PSkzE,2104
40
- pyreduce/clib/Release/_slitfunc_bd.obj,sha256=35V_GMtjZmnRL0bqarMRRGe88nGTo3ZV16pEWM4OAVw,180394
40
+ pyreduce/clib/Release/_slitfunc_bd.obj,sha256=nvgr5tOZbcNezWqqBquMEZ8ytKXfEOPHMMONF_4Itzw,180394
41
41
  pyreduce/instruments/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
42
42
  pyreduce/instruments/aj.py,sha256=QSKo2IUvBugBRJF0Qr6T9GueBzeDrA4yGu-qAe7TZwg,155
43
43
  pyreduce/instruments/aj.yaml,sha256=peeQ2ZqvqemHWpNZoiXEscU6ZIzAImbhN_8D0XTeeME,904
@@ -163,8 +163,8 @@ pyreduce/wavecal/xshooter_nir.npz,sha256=0Fu5wxWutc8072n8Hk2AZAWSlyT4WdhJuhh0OzU
163
163
  pyreduce/wavecal/atlas/thar.fits,sha256=nPPNStZ281iPUNsOXu3YJfHNlnHBd1CWMLwTuZL8vvo,1529218
164
164
  pyreduce/wavecal/atlas/thar_list.txt,sha256=saK3YW1slxlXGeulZDdILWf952XOWToJcUULVSHMe6k,63515
165
165
  pyreduce/wavecal/atlas/une.fits,sha256=egHlchdM4AN9MSksEI5MlHkmB3g1G1VhEdzhUG3XU8I,2949057
166
- pyreduce_astro-0.7a3.dist-info/METADATA,sha256=nqkw5qkGzEPJNV3SS0_9aJWbBmZZy6yn_Kq6cXgA9ro,3488
167
- pyreduce_astro-0.7a3.dist-info/WHEEL,sha256=4wDLoDnOdOlNWH83WHOgXQrFhqZwdpD9rGaw2zeoj9o,97
168
- pyreduce_astro-0.7a3.dist-info/entry_points.txt,sha256=n045jK9XZFfdmasTNhriefYyJoY77JKm-RpRD1zgHZo,50
169
- pyreduce_astro-0.7a3.dist-info/licenses/LICENSE,sha256=IwGE9guuL-ryRPEKi6wFPI_zOhg7zDZbTYuHbSt_SAk,35823
170
- pyreduce_astro-0.7a3.dist-info/RECORD,,
166
+ pyreduce_astro-0.7a4.dist-info/METADATA,sha256=m5uMEQvbv9ra-r9T136x5VpNUTfJ0pDjfz0oGCoriTY,3488
167
+ pyreduce_astro-0.7a4.dist-info/WHEEL,sha256=4wDLoDnOdOlNWH83WHOgXQrFhqZwdpD9rGaw2zeoj9o,97
168
+ pyreduce_astro-0.7a4.dist-info/entry_points.txt,sha256=n045jK9XZFfdmasTNhriefYyJoY77JKm-RpRD1zgHZo,50
169
+ pyreduce_astro-0.7a4.dist-info/licenses/LICENSE,sha256=IwGE9guuL-ryRPEKi6wFPI_zOhg7zDZbTYuHbSt_SAk,35823
170
+ pyreduce_astro-0.7a4.dist-info/RECORD,,