Skip to content

Commit

Permalink
v2.0.1-rc1 Keep same socket across requests, update documentation and…
Browse files Browse the repository at this point in the history
… control files for this release.
  • Loading branch information
BobDenny committed Jul 17, 2022
1 parent 64a35ca commit f087f8f
Show file tree
Hide file tree
Showing 7 changed files with 41 additions and 20 deletions.
14 changes: 14 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
Version 2.0.1-rc1 (2022-07-17)
==============================

- Release candidate.

Changes since 2.0.0-dev2
------------------------

- Improve speed via re-use of sockets (<code>Connection: keep-alive</code>) for device HTTP.
- <code>ObservingConditions.SensorDescription()</code> has been fixed to accept the sensor name
- Parameters for <code>ObservingConditions.TimeSinceLastUpdate()</code> and
<code>ObservingConditions.SensorDescription()</code> have been corrected to <code>SensorName</code>.
- Correct <code>ObservingConditions.AveragePeriod</code> to remove capital P from URI

9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# alpyca (2.0.0-dev2)
# alpyca (2.0.1rc1)

## Python 3.7+ API library for all [ASCOM Alpaca](https://ascom-standards.org/Developer/Alpaca.htm) universal interfaces

<img align="right" width="210" height="166" hspace="20" vspace="20" src="https://ascom-standards.org/alpyca/readme-assets/AlpacaLogo210.png">

Produced by the [ASCOM Initiative](https://ascom-standards.org/), and derived from Ethan Chappel's
Alpyca 1.0.0. Ethan kindly released the name **Alpyca** to the ASCOM Initiative, hence this expanded
package starts life as Version 2.0.0-dev2.
package starts life as Version 2.0.

## Requirements

Expand Down Expand Up @@ -35,10 +35,11 @@ The dependencies listed above are automatically installed with alpyca.

## Current Status & Documentation

This version 2.0.0-dev2 is a developmental/alpha release. The documentation is
This version 2.0.1rc1 is the first release candidate for 2.0.1. The documentation is
extensive and available
online as **[Alpyca: API Library for Alpaca](https://ascom-standards.org/alpyca/)** as well as a
**[PDF Document here](https://ascom-standards.org/alpyca/alpyca.pdf)**.
**[PDF Document here](https://ascom-standards.org/alpyca/alpyca.pdf)**. See CHANGES.rst for
change log.

## Feedback and Discussion

Expand Down
2 changes: 1 addition & 1 deletion alpaca/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
"""This is under development"""

9 changes: 6 additions & 3 deletions alpaca/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
# 02-May-22 (rbd) Initial Edit
# 03-May-22 (rbd) Fix DriverException wording to final agreed text.
# 13-May-22 (rbd) 2.0.0-dev1 Project now called "Alpyca" - no logic changes
# 17-Jul-22 (rbd) 2.0.1rc1 Speed up by re-using ports via requests.Session().
# -----------------------------------------------------------------------------

from threading import Lock
Expand Down Expand Up @@ -85,6 +86,8 @@ def __init__(
self.device_type,
self.device_number
)
self.rqs = requests.Session()

# ------------------------------------------------
# CLASS VARIABLES - SHARED ACROSS DEVICE INSTANCES
# ------------------------------------------------
Expand Down Expand Up @@ -376,7 +379,7 @@ def _get(self, attribute: str, tmo=5.0, **data) -> str:
# TODO - Catch and handle connect failures nicely
try:
Device._ctid_lock.acquire()
response = requests.get("%s/%s" % (self.base_url, attribute),
response = self.rqs.get("%s/%s" % (self.base_url, attribute),
params=pdata, timeout=tmo, headers=hdrs)
Device._client_trans_id += 1
finally:
Expand Down Expand Up @@ -406,15 +409,15 @@ def _put(self, attribute: str, tmo=5.0, **data) -> str:
# TODO - Catch and handle connect failures nicely
try:
Device._ctid_lock.acquire()
response = requests.put("%s/%s" % (self.base_url, attribute),
response = self.rqs.put("%s/%s" % (self.base_url, attribute),
data=pdata, timeout=tmo, headers=hdrs)
Device._client_trans_id += 1
finally:
Device._ctid_lock.release()
self.__check_error(response)
return response.json() # TODO Is this right? json()?

def __check_error(self, response: requests.Response) -> None:
def __check_error(self, response) -> None:
"""Alpaca exception handler (ASCOM exception types)
Args:
Expand Down
2 changes: 1 addition & 1 deletion docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@
rinoh_documents = [dict(doc='index', # top-level file (index.rst)
target='alpyca', # output file (alpyca.pdf)
title='Alpyca Library',
subtitle='Release 2.0.0-dev2',
subtitle='Release 2.0.1rc1',
author='Robert B. Denny <[email protected]>',
logo='alpaca1000.png',
template='alpyca.rtt')]
23 changes: 13 additions & 10 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,23 @@
:width: 128px
:align: right

=================
Welcome to Alpyca
=================
=====================
Welcome to Alpyca 2.0
=====================

.. only:: rinoh or rst

=================
Welcome to Alpyca
=================
=====================
Welcome to Alpyca 2.0
=====================

This document describes the Alpyca package, a Python API Library for ASCOM Alpaca.
The package provides all of the ASCOM Standard
universal interfaces to astronomical devices using the Alpaca network protocol. As an application developer, your
usage of the various devices is simplified and universal, independent of the particular make/model of device.
This document describes the Alpyca package, a Python API client library for ASCOM Alpaca, produced by the
ASCOM Initiative, and derived from Ethan Chappel's Alpyca 1.0.0. Ethan kindly released the name
**Alpyca** to the ASCOM Initiative, hence this expanded package starts life as Version 2.0.

The package provides all of the ASCOM Standard universal interfaces to astronomical devices using the
Alpaca network protocol. As an application developer, your usage of the various devices is simplified
and universal, independent of the particular make/model of device.

.. only:: html

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "alpyca"
version = "2.0.0-dev2"
version = "2.0.1-pre.1" # Becomes 2.0.1rc1
description = "API library for all ASCOM Alpaca devices, management, and discovery"
authors = ["Robert B. Denny <[email protected]>"]
license = "LICENSE"
Expand Down

0 comments on commit f087f8f

Please sign in to comment.