skycalc-cli 1.4__tar.gz → 1.5__tar.gz

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.
@@ -0,0 +1,40 @@
1
+ Metadata-Version: 2.1
2
+ Name: skycalc_cli
3
+ Version: 1.5
4
+ Summary: ESO SkyCalc Command Line Interface
5
+ Home-page: http://www.eso.org/observing/etc/bin/gen/form?INS.MODE=swspectr+INS.NAME=SKYCALC
6
+ Author: European Southern Observatory
7
+ Author-email: usd-help@eso.org
8
+ License: MIT
9
+ Keywords: sky model observatory telescope astronomy ephemeris sun moon
10
+ Classifier: Development Status :: 5 - Production/Stable
11
+ Classifier: License :: OSI Approved :: MIT License
12
+ Classifier: Programming Language :: Python :: 3
13
+ Classifier: Programming Language :: Python :: 3 :: Only
14
+ Classifier: Topic :: Scientific/Engineering :: Astronomy
15
+ Requires-Python: >=3.8
16
+ License-File: LICENSE.txt
17
+ Requires-Dist: requests
18
+
19
+ ######################################
20
+ SkyCalc Command Line Interface (CLI)
21
+ ######################################
22
+
23
+ ============
24
+ Installation
25
+ ============
26
+
27
+ The SkyCalc CLI requires Python 3.8 or later (Python 2 users: pip installs
28
+ the last compatible release, 1.4). Install the SkyCalc CLI
29
+ on your computer using the command: ::
30
+
31
+ pip install --user skycalc_cli
32
+
33
+ This will also install skycalc_cli's dependency, i.e. the requests package for
34
+ making HTTP calls.
35
+
36
+ =============
37
+ Documentation
38
+ =============
39
+
40
+ Documentation can be found on the `ESO SkyCalc Web Page <https://www.eso.org/observing/etc/doc/skycalc/helpskycalccli.html>`_.
@@ -6,7 +6,8 @@
6
6
  Installation
7
7
  ============
8
8
 
9
- The SkyCalc CLI works in Python 2.7 or Python3. Install the SkyCalc CLI
9
+ The SkyCalc CLI requires Python 3.8 or later (Python 2 users: pip installs
10
+ the last compatible release, 1.4). Install the SkyCalc CLI
10
11
  on your computer using the command: ::
11
12
 
12
13
  pip install --user skycalc_cli
@@ -8,18 +8,14 @@ def readme():
8
8
 
9
9
 
10
10
  setup(name='skycalc_cli',
11
- version='1.4',
11
+ version='1.5',
12
12
  description='ESO SkyCalc Command Line Interface',
13
13
  long_description=readme(),
14
14
  classifiers=[
15
15
  'Development Status :: 5 - Production/Stable',
16
16
  'License :: OSI Approved :: MIT License',
17
- 'Programming Language :: Python :: 2',
18
- 'Programming Language :: Python :: 2.7',
19
17
  'Programming Language :: Python :: 3',
20
- 'Programming Language :: Python :: 3.4',
21
- 'Programming Language :: Python :: 3.5',
22
- 'Programming Language :: Python :: 3.6',
18
+ 'Programming Language :: Python :: 3 :: Only',
23
19
  'Topic :: Scientific/Engineering :: Astronomy',
24
20
  ],
25
21
  keywords='sky model observatory telescope astronomy ephemeris sun moon',
@@ -29,10 +25,9 @@ setup(name='skycalc_cli',
29
25
  author_email='usd-help@eso.org',
30
26
  license='MIT',
31
27
  packages=['skycalc_cli'],
32
- python_requires='>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, <4',
28
+ python_requires='>=3.8',
33
29
  install_requires=[
34
30
  'requests',
35
- 'setuptools'
36
31
  ],
37
32
  entry_points={
38
33
  'console_scripts': ['skycalc_cli=skycalc_cli.skycalc_cli:main'],
@@ -2,20 +2,35 @@
2
2
  """skycalc Module"""
3
3
 
4
4
  from __future__ import print_function
5
+ import os
5
6
  import sys
6
7
  import json
7
8
  from datetime import datetime
8
9
  import requests
9
10
 
11
+ # Base URL of the SkyCalc service (an ETC web installation). The CLI uses its
12
+ # CGI scripts under bin/script and the result directory tmp. This is the only
13
+ # place a server name appears; the backend is planned to move to a stable
14
+ # name under etc.eso.org, at which point only this constant changes.
15
+ # Override with the environment variable SKYCALC_CLI_BASE_URL or the base_url
16
+ # argument of SkyModel and AlmanacQuery, e.g.
17
+ # 'http://localhost:8080/observing/etc' for a local etc1 container.
18
+ DEFAULT_BASE_URL = 'https://etimecalret-002.eso.org/observing/etc'
19
+
20
+
21
+ def get_base_url(base_url=None):
22
+ """Return the base URL to use, without a trailing slash."""
23
+ url = base_url or os.environ.get('SKYCALC_CLI_BASE_URL') or DEFAULT_BASE_URL
24
+ return url.rstrip('/')
25
+
10
26
 
11
27
  class AlmanacQuery:
12
28
  """AlmanacQuery for Querying the SkyCalc Almanac"""
13
29
 
14
- def __init__(self, indic):
30
+ def __init__(self, indic, base_url=None):
15
31
 
16
32
  self.almdata = None
17
- self.almserver = 'https://etimecalret-002.eso.org'
18
- self.almurl = '/observing/etc/api/skycalc_almanac'
33
+ self.almurl = get_base_url(base_url) + '/bin/script/skycalc_almanac.py'
19
34
 
20
35
  # Left: users keyword (skycalc_cli),
21
36
  # Right: skycalc Almanac output keywords
@@ -100,11 +115,9 @@ class AlmanacQuery:
100
115
 
101
116
  def query(self):
102
117
 
103
- url = self.almserver + self.almurl
104
-
105
118
  rawdata = None
106
119
  try:
107
- response = requests.post(url, json.dumps(self.almindic))
120
+ response = requests.post(self.almurl, data=json.dumps(self.almindic))
108
121
  rawdata = response.text
109
122
  except requests.exceptions.RequestException as e:
110
123
  print('Error: Almanac query failed.')
@@ -152,16 +165,14 @@ class bcolors:
152
165
 
153
166
  class SkyModel:
154
167
  """SkyModel for querying the Advanced SkyModel"""
155
- """Note: skycalc_cli v.1.4 output wavelength unit is nm (it is μm in v.1.3)"""
156
168
 
157
- def __init__(self):
169
+ def __init__(self, base_url=None):
158
170
 
159
- print("Note: skycalc_cli v.1.4 output wavelength unit is nm (it is μm in v.1.3)")
160
171
  self.stop_on_errors_and_exceptions = True
161
172
  self.data = None
162
- self.server = 'https://etimecalret-002.eso.org'
163
- self.url = self.server + '/observing/etc/api/skycalc'
164
- self.deleter_script_url = self.server + '/observing/etc/api/rmtmp'
173
+ self.base_url = get_base_url(base_url)
174
+ self.url = self.base_url + '/bin/script/skycalc_api.py'
175
+ self.deleter_script_url = self.base_url + '/bin/script/rmtmp.py'
165
176
  self.bugreport_text = ''
166
177
  self.tmpdir = ''
167
178
  self.params = {
@@ -322,8 +333,7 @@ class SkyModel:
322
333
  self.handle_exception(
323
334
  e, 'Exception raised trying to decode server response ')
324
335
 
325
- tmpurl = self.server + '/observing/etc/tmp/' + \
326
- tmpdir + '/skytable.fits'
336
+ tmpurl = self.base_url + '/tmp/' + tmpdir + '/skytable.fits'
327
337
 
328
338
  if(status == 'success'):
329
339
  try:
@@ -6,7 +6,6 @@
6
6
  # please contact usd-help@eso.org
7
7
 
8
8
  from __future__ import print_function
9
- import pkg_resources
10
9
  import sys
11
10
  import json
12
11
  import getopt
@@ -100,9 +99,9 @@ def main():
100
99
  if opt in ("-h", "--help"):
101
100
  usage()
102
101
  sys.exit()
103
- elif opt in ("--version"):
104
- version = pkg_resources.require("skycalc_cli")[0].version
105
- print('skycalc_cli version ' + version)
102
+ elif opt == "--version":
103
+ from importlib.metadata import version as pkg_version
104
+ print('skycalc_cli version ' + pkg_version('skycalc_cli'))
106
105
  sys.exit(0)
107
106
  elif opt in ("-v", "--verbose"):
108
107
  isVerbose = True
@@ -0,0 +1,40 @@
1
+ Metadata-Version: 2.1
2
+ Name: skycalc_cli
3
+ Version: 1.5
4
+ Summary: ESO SkyCalc Command Line Interface
5
+ Home-page: http://www.eso.org/observing/etc/bin/gen/form?INS.MODE=swspectr+INS.NAME=SKYCALC
6
+ Author: European Southern Observatory
7
+ Author-email: usd-help@eso.org
8
+ License: MIT
9
+ Keywords: sky model observatory telescope astronomy ephemeris sun moon
10
+ Classifier: Development Status :: 5 - Production/Stable
11
+ Classifier: License :: OSI Approved :: MIT License
12
+ Classifier: Programming Language :: Python :: 3
13
+ Classifier: Programming Language :: Python :: 3 :: Only
14
+ Classifier: Topic :: Scientific/Engineering :: Astronomy
15
+ Requires-Python: >=3.8
16
+ License-File: LICENSE.txt
17
+ Requires-Dist: requests
18
+
19
+ ######################################
20
+ SkyCalc Command Line Interface (CLI)
21
+ ######################################
22
+
23
+ ============
24
+ Installation
25
+ ============
26
+
27
+ The SkyCalc CLI requires Python 3.8 or later (Python 2 users: pip installs
28
+ the last compatible release, 1.4). Install the SkyCalc CLI
29
+ on your computer using the command: ::
30
+
31
+ pip install --user skycalc_cli
32
+
33
+ This will also install skycalc_cli's dependency, i.e. the requests package for
34
+ making HTTP calls.
35
+
36
+ =============
37
+ Documentation
38
+ =============
39
+
40
+ Documentation can be found on the `ESO SkyCalc Web Page <https://www.eso.org/observing/etc/doc/skycalc/helpskycalccli.html>`_.
@@ -1,3 +1,2 @@
1
1
  [console_scripts]
2
2
  skycalc_cli = skycalc_cli.skycalc_cli:main
3
-
@@ -0,0 +1 @@
1
+ requests
skycalc_cli-1.4/PKG-INFO DELETED
@@ -1,42 +0,0 @@
1
- Metadata-Version: 1.2
2
- Name: skycalc_cli
3
- Version: 1.4
4
- Summary: ESO SkyCalc Command Line Interface
5
- Home-page: http://www.eso.org/observing/etc/bin/gen/form?INS.MODE=swspectr+INS.NAME=SKYCALC
6
- Author: European Southern Observatory
7
- Author-email: usd-help@eso.org
8
- License: MIT
9
- Description: ######################################
10
- SkyCalc Command Line Interface (CLI)
11
- ######################################
12
-
13
- ============
14
- Installation
15
- ============
16
-
17
- The SkyCalc CLI works in Python 2.7 or Python3. Install the SkyCalc CLI
18
- on your computer using the command: ::
19
-
20
- pip install --user skycalc_cli
21
-
22
- This will also install skycalc_cli's dependency, i.e. the requests package for
23
- making HTTP calls.
24
-
25
- =============
26
- Documentation
27
- =============
28
-
29
- Documentation can be found on the `ESO SkyCalc Web Page <https://www.eso.org/observing/etc/doc/skycalc/helpskycalccli.html>`_.
30
-
31
- Keywords: sky model observatory telescope astronomy ephemeris sun moon
32
- Platform: UNKNOWN
33
- Classifier: Development Status :: 5 - Production/Stable
34
- Classifier: License :: OSI Approved :: MIT License
35
- Classifier: Programming Language :: Python :: 2
36
- Classifier: Programming Language :: Python :: 2.7
37
- Classifier: Programming Language :: Python :: 3
38
- Classifier: Programming Language :: Python :: 3.4
39
- Classifier: Programming Language :: Python :: 3.5
40
- Classifier: Programming Language :: Python :: 3.6
41
- Classifier: Topic :: Scientific/Engineering :: Astronomy
42
- Requires-Python: >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, <4
@@ -1,42 +0,0 @@
1
- Metadata-Version: 1.2
2
- Name: skycalc-cli
3
- Version: 1.4
4
- Summary: ESO SkyCalc Command Line Interface
5
- Home-page: http://www.eso.org/observing/etc/bin/gen/form?INS.MODE=swspectr+INS.NAME=SKYCALC
6
- Author: European Southern Observatory
7
- Author-email: usd-help@eso.org
8
- License: MIT
9
- Description: ######################################
10
- SkyCalc Command Line Interface (CLI)
11
- ######################################
12
-
13
- ============
14
- Installation
15
- ============
16
-
17
- The SkyCalc CLI works in Python 2.7 or Python3. Install the SkyCalc CLI
18
- on your computer using the command: ::
19
-
20
- pip install --user skycalc_cli
21
-
22
- This will also install skycalc_cli's dependency, i.e. the requests package for
23
- making HTTP calls.
24
-
25
- =============
26
- Documentation
27
- =============
28
-
29
- Documentation can be found on the `ESO SkyCalc Web Page <https://www.eso.org/observing/etc/doc/skycalc/helpskycalccli.html>`_.
30
-
31
- Keywords: sky model observatory telescope astronomy ephemeris sun moon
32
- Platform: UNKNOWN
33
- Classifier: Development Status :: 5 - Production/Stable
34
- Classifier: License :: OSI Approved :: MIT License
35
- Classifier: Programming Language :: Python :: 2
36
- Classifier: Programming Language :: Python :: 2.7
37
- Classifier: Programming Language :: Python :: 3
38
- Classifier: Programming Language :: Python :: 3.4
39
- Classifier: Programming Language :: Python :: 3.5
40
- Classifier: Programming Language :: Python :: 3.6
41
- Classifier: Topic :: Scientific/Engineering :: Astronomy
42
- Requires-Python: >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, <4
@@ -1,2 +0,0 @@
1
- requests
2
- setuptools
File without changes
File without changes
File without changes