pyreduce-astro 0.7a3__cp313-cp313-win_amd64.whl → 0.7a4__cp313-cp313-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,12 +19,12 @@ 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_2d.cp313-win_amd64.pyd,sha256=dA6pIPa7qA0VeX2Dt5xdLe0H5PXyP8_gEjxTTZHUwLA,35328
25
- pyreduce/clib/_slitfunc_bd.cp311-win_amd64.pyd,sha256=bJUsdLDA8-UNx9QeV6rZrj2XZVtkZ1t_xaPq7SyB0UM,25600
26
- pyreduce/clib/_slitfunc_bd.cp312-win_amd64.pyd,sha256=H02ZpIESyOg2Ldh-GSDup8Cygo4Ch-fixBCMeV-5Hvs,25600
27
- pyreduce/clib/_slitfunc_bd.cp313-win_amd64.pyd,sha256=oJweCBrur3FxQ7-fLMvBJu7G5WVaVEBRSWJh7rCWw9w,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_2d.cp313-win_amd64.pyd,sha256=zu6iCAIt6OAOqNgI1KMaSf9rTIADwkhlU-Mkt8-tO5c,35328
25
+ pyreduce/clib/_slitfunc_bd.cp311-win_amd64.pyd,sha256=rMif07DHX2oNN131Q7tqYWiLmpZiTUweBWfFU7wU7s8,25600
26
+ pyreduce/clib/_slitfunc_bd.cp312-win_amd64.pyd,sha256=MRhnTTKWiGhFnLgt2FS_pTbrvzGupK9sZTgTQv7oLiU,25600
27
+ pyreduce/clib/_slitfunc_bd.cp313-win_amd64.pyd,sha256=dqLb2--YnzFtSpMatJgYGBHs0L0WlRKZGbDVWZ22WqA,25600
28
28
  pyreduce/clib/build_extract.py,sha256=WTEpyRZWDR4AUkT1mkxmsWbXuRLG2jrRbJC5M8MKi3M,2020
29
29
  pyreduce/clib/slit_func_2d_xi_zeta_bd.c,sha256=o_R_3hq0tX2ZdaCRxJjY2mXQf4RaYENcVKVn2OZR_Rk,51279
30
30
  pyreduce/clib/slit_func_2d_xi_zeta_bd.h,sha256=ezWP3JXfbviCN5FAbB9AJYB1YnAGFhsO5N3wCt-rbmU,1567
@@ -36,14 +36,14 @@ pyreduce/clib/Release/_slitfunc_2d.cp312-win_amd64.exp,sha256=ap2hnA20RvdJAV-jrp
36
36
  pyreduce/clib/Release/_slitfunc_2d.cp312-win_amd64.lib,sha256=cD10d0NBKuPxsmHfYZ17F9O6tt2X3vwfHv49fx7i7mg,2104
37
37
  pyreduce/clib/Release/_slitfunc_2d.cp313-win_amd64.exp,sha256=xgcXydyjVF48BY3DHEU9l-3BIMHBtYVXENVCXG6mpHg,763
38
38
  pyreduce/clib/Release/_slitfunc_2d.cp313-win_amd64.lib,sha256=HtsGowOnstUvTx3wEiX3JcFgOzCsrie-6B5pdb69EVc,2104
39
- pyreduce/clib/Release/_slitfunc_2d.obj,sha256=IMWNUnmPWiQZVpayfgqOq8OPnYRAVp8qxjrrNNRu1dw,225492
39
+ pyreduce/clib/Release/_slitfunc_2d.obj,sha256=HibN_mMVM9-_lX2oHaZIjmgpL6VCrRNmJ2qZwTexVDI,225492
40
40
  pyreduce/clib/Release/_slitfunc_bd.cp311-win_amd64.exp,sha256=vHZNO5hq4YBqgpgWXOW7wELiB-Pex2QFRvKbLH-vIYY,763
41
41
  pyreduce/clib/Release/_slitfunc_bd.cp311-win_amd64.lib,sha256=hcG-cWafgtz6nNO12lFFtkVLhVAsQyuCpPD78rfPQzs,2104
42
42
  pyreduce/clib/Release/_slitfunc_bd.cp312-win_amd64.exp,sha256=BWCVspYP1T2q5yNWlVpCfK6JWR44RuNiFhWW3H6kNLc,763
43
43
  pyreduce/clib/Release/_slitfunc_bd.cp312-win_amd64.lib,sha256=tJ-lz6MJn-UOdBfx7yFQqrNw4NEmKinrbm8vx2PSkzE,2104
44
44
  pyreduce/clib/Release/_slitfunc_bd.cp313-win_amd64.exp,sha256=v6YBEY_vzeHqhCMqQ7-ISyMP3m07qeSL4yA-Lq27vP8,763
45
45
  pyreduce/clib/Release/_slitfunc_bd.cp313-win_amd64.lib,sha256=R3sT-Vy8AWGitwFDqYI3ipcc86PVkyMgACcDMXMkA1U,2104
46
- pyreduce/clib/Release/_slitfunc_bd.obj,sha256=UOgxyxn2gASiSCyYeTy19yYpmMMDsjcuW1rmn5l91Wk,175839
46
+ pyreduce/clib/Release/_slitfunc_bd.obj,sha256=kAcPgomQLBVkwA0S__Vbhk7LUk0QH9vf1vKTxDGpmOk,175839
47
47
  pyreduce/instruments/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
48
48
  pyreduce/instruments/aj.py,sha256=QSKo2IUvBugBRJF0Qr6T9GueBzeDrA4yGu-qAe7TZwg,155
49
49
  pyreduce/instruments/aj.yaml,sha256=peeQ2ZqvqemHWpNZoiXEscU6ZIzAImbhN_8D0XTeeME,904
@@ -169,8 +169,8 @@ pyreduce/wavecal/xshooter_nir.npz,sha256=0Fu5wxWutc8072n8Hk2AZAWSlyT4WdhJuhh0OzU
169
169
  pyreduce/wavecal/atlas/thar.fits,sha256=nPPNStZ281iPUNsOXu3YJfHNlnHBd1CWMLwTuZL8vvo,1529218
170
170
  pyreduce/wavecal/atlas/thar_list.txt,sha256=saK3YW1slxlXGeulZDdILWf952XOWToJcUULVSHMe6k,63515
171
171
  pyreduce/wavecal/atlas/une.fits,sha256=egHlchdM4AN9MSksEI5MlHkmB3g1G1VhEdzhUG3XU8I,2949057
172
- pyreduce_astro-0.7a3.dist-info/METADATA,sha256=nqkw5qkGzEPJNV3SS0_9aJWbBmZZy6yn_Kq6cXgA9ro,3488
173
- pyreduce_astro-0.7a3.dist-info/WHEEL,sha256=PCIhMO61Z-RaGBFeYB07NemkwSKK2UsOquwuNeClEpE,97
174
- pyreduce_astro-0.7a3.dist-info/entry_points.txt,sha256=n045jK9XZFfdmasTNhriefYyJoY77JKm-RpRD1zgHZo,50
175
- pyreduce_astro-0.7a3.dist-info/licenses/LICENSE,sha256=IwGE9guuL-ryRPEKi6wFPI_zOhg7zDZbTYuHbSt_SAk,35823
176
- pyreduce_astro-0.7a3.dist-info/RECORD,,
172
+ pyreduce_astro-0.7a4.dist-info/METADATA,sha256=m5uMEQvbv9ra-r9T136x5VpNUTfJ0pDjfz0oGCoriTY,3488
173
+ pyreduce_astro-0.7a4.dist-info/WHEEL,sha256=PCIhMO61Z-RaGBFeYB07NemkwSKK2UsOquwuNeClEpE,97
174
+ pyreduce_astro-0.7a4.dist-info/entry_points.txt,sha256=n045jK9XZFfdmasTNhriefYyJoY77JKm-RpRD1zgHZo,50
175
+ pyreduce_astro-0.7a4.dist-info/licenses/LICENSE,sha256=IwGE9guuL-ryRPEKi6wFPI_zOhg7zDZbTYuHbSt_SAk,35823
176
+ pyreduce_astro-0.7a4.dist-info/RECORD,,