Skip to content

Commit

Permalink
Merge pull request #36 from sdss/albireox-1.0
Browse files Browse the repository at this point in the history
Version 1.0
  • Loading branch information
albireox authored Nov 24, 2023
2 parents 5935811 + 8a27932 commit db55c3a
Show file tree
Hide file tree
Showing 83 changed files with 3,180 additions and 5,011 deletions.
19 changes: 0 additions & 19 deletions .flake8

This file was deleted.

49 changes: 25 additions & 24 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,47 +1,48 @@
on:
push:
# Sequence of patterns matched against refs/tags
tags:
- '[0-9]+.[0-9]+.[0-9]+' # Exclude pre-releases
- '*'

name: Create Release

jobs:
build:
name: Build wheels
runs-on: ubuntu-latest

strategy:
matrix:
python-version: ['3.12']

permissions:
contents: write
id-token: write

steps:
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create release
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ github.ref }}
release_name: lvmnps ${{ github.ref }}
body: ''
draft: false
prerelease: false
name: lvmnps ${{ github.ref_name }}

- name: Set up Python
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: 3.9
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pep517
python -m pip install --upgrade pip setuptools wheel build
- name: Build package
- name: Build wheels
run: |
python -m pep517.build --source --binary --out-dir dist/ .
pyproject-build -w
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@master
with:
user: __token__
password: ${{ secrets.pypi_password }}
- name: Build source
run: |
pyproject-build -s
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
41 changes: 12 additions & 29 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ name: Test

on:
push:
branches: [main]
paths-ignore:
- 'docs/**'
pull_request:
Expand All @@ -19,52 +18,36 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ['3.8', '3.9', '3.10', '3.11']
python-version: ['3.10', '3.11', '3.12']

steps:
- uses: actions/checkout@v3

- name: Cache Setup
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Install poetry
run: |
curl -sSL https://install.python-poetry.org | python3 -
cache: 'pip'

- name: Install dependencies
run: |
poetry env use python
poetry run pip install -U pip setuptools wheel
poetry --no-ansi install --without helpers
pip install --upgrade wheel pip setuptools
pip install .
- name: Lint with flake8
- name: Lint with ruff
run: |
# stop the build if there are Python syntax errors or undefined names
poetry run pip install flake8
poetry run flake8 . --count --show-source --statistics
pip install ruff
ruff check src/ tests/
- name: Lint with black
run: |
poetry run pip install black
poetry run black --check .
- name: Lint with isort
run: |
poetry run pip install isort
poetry run isort -c . -vvv
pip install black
black --check src/lvmnps
- name: Test with pytest
run: |
poetry --no-ansi install --only test
poetry run pytest
pip install pytest pytest-mock pytest-asyncio pytest-cov pytest-httpx
pytest
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
Expand Down
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
# Changelog

## 1.0.0

### 🔥 Breaking changes

* [#36](https://github.com/sdss/lvmnps/pull/36) Complete rewrite, mostly to simplify the code and to take advantage of some additional features in the DLI REST API and to support calling DLI user scripts.
* The main difference in this version is that the code has been significantly simplified by requiring that one instance of the `lvmnps` actor can only control one NPS. This means that all the `switch` flags and parameters have been deprecated.
* The code has been simplified. It still follows the approach of a core, abstract `NPSClient` class with multiple implementations for different switches, but some options that were not used have been removed.
* It's now possible to switch multiple outlets at the same time. This takes advantage of the DLI and NetIO implementations to turn on several outlets as quickly as possible without risking an in-rush overcurrent.
* The DLI client now allows to command user functions (scripts).


## 0.4.0 - July 10, 2023

### 🚀 New
Expand Down
4 changes: 2 additions & 2 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
coverage:
range: 80...95
range: 90...100
round: up
precision: 1
status:
project:
default:
target: 85%
target: 90%
if_not_found: success
if_ci_failed: error
informational: false
Expand Down
8 changes: 0 additions & 8 deletions docs/sphinx/actor-schema.rst

This file was deleted.

9 changes: 0 additions & 9 deletions docs/sphinx/actor.rst

This file was deleted.

45 changes: 45 additions & 0 deletions docs/sphinx/api.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
.. _lvmnps-api:

API
===

Base client
-----------

.. autoclass:: lvmnps.nps.core.NPSClient
:members:
:show-inheritance:

.. autopydantic_model:: lvmnps.nps.core.OutletModel
:model-show-json: false
:exclude-members: model_post_init


Implementations
---------------

Digital Loggers Inc
^^^^^^^^^^^^^^^^^^^

.. autoclass:: lvmnps.nps.implementations.dli.DLIClient

.. autopydantic_model:: lvmnps.nps.implementations.dli.DLIOutletModel
:model-show-json: false
:exclude-members: model_post_init

NetIO
^^^^^

.. autoclass:: lvmnps.nps.implementations.netio.NetIOClient


Actor
-----

.. autoclass:: lvmnps.actor.NPSActor


Tools
-----

.. automodule:: lvmnps.tools
2 changes: 1 addition & 1 deletion docs/sphinx/commands.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ Commands

The ``lvmnps`` actor replies to the follwing commands.

.. click:: lvmnps.actor.commands:parser
.. click:: lvmnps.actor.commands:lvmnps_command_parser
:prog: lvmnps
:show-nested:
45 changes: 23 additions & 22 deletions docs/sphinx/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,7 @@

from pkg_resources import parse_version


try:
from lvmnps import __version__
except ModuleNotFoundError:
from sdsstools import get_package_version

__version__ = get_package_version(__file__, "sdss-lvmnps") or "dev"
from lvmnps import __version__


# Are we building in RTD?
Expand Down Expand Up @@ -51,20 +45,25 @@
"sphinx.ext.autodoc",
"sphinx.ext.napoleon",
"sphinx.ext.autosummary",
"sphinx_autodoc_typehints",
"sphinx.ext.todo",
"sphinx.ext.viewcode",
"sphinx.ext.mathjax",
"sphinx.ext.intersphinx",
"sphinx.ext.inheritance_diagram",
"myst_parser",
"sphinx_copybutton",
"sphinx_click",
"sphinx_click.ext",
"sphinx-jsonschema",
"sphinxcontrib.autodoc_pydantic",
]

# Add any paths that contain templates here, relative to this directory.
templates_path = ["_templates"]

pygments_style = "lovelace"
pygments_dark_style = "one-dark"

# The suffix(es) of source filenames.
# You can specify multiple suffix as a list of string:
#
Expand All @@ -80,8 +79,8 @@

# General information about the project.
project = "lvmnps"
copyright = "{0}, {1}".format("2021", "SDSS LVMI softwareteam in Kyung Hee university")
author = "Mingyeong Yang"
copyright = "{0}, {1}".format("2021-", "Sloan Digital Sky Survey")
author = "Mingyeong Yang and others"

# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
Expand All @@ -97,7 +96,7 @@
#
# This is also used if you do content translation via gettext catalogs.
# Usually you set "language" from the command line for these cases.
language = None
language = "en"

# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
Expand Down Expand Up @@ -133,27 +132,24 @@

# Intersphinx mappings
intersphinx_mapping = {
"python": ("https://docs.python.org/3.6", None),
"astropy": ("http://docs.astropy.org/en/latest", None),
"numpy": ("http://docs.scipy.org/doc/numpy/", None),
"click": ("https://click.palletsprojects.com/en/7.x/", None),
"aio_pika": ("https://aio-pika.readthedocs.io/en/latest/", None),
"python": ("https://docs.python.org/3.12", None),
}

autodoc_mock_imports = ["_tkinter", "asynctest", "numpy", "pymodbus"]
autodoc_member_order = "groupwise"
autodoc_default_options = {"members": None, "show-inheritance": None}
autodoc_typehints = "description"
# autodoc_typehints = "description"

napoleon_use_rtype = False
napoleon_use_ivar = True
# napoleon_use_rtype = False
# napoleon_use_ivar = True

simplify_optional_unions = True
typehints_use_signature_return = True

copybutton_prompt_text = r">>> |\$ "
copybutton_prompt_is_regexp = True

rst_epilog = f"""
.. |numpy_array| replace:: Numpy array
.. |HDUList| replace:: :class:`~astropy.io.fits.HDUList`
.. |npsactor_version| replace:: {__version__}
"""

Expand All @@ -166,8 +162,13 @@

html_theme = "furo"
html_logo = "_static/sdssv_logo.png"
html_title = "lvmnps"
html_title = "lvmnps documentation"
html_favicon = "./_static/favicon.ico"
html_theme_options = {
"source_repository": "https://github.com/sdss/lvmnps/",
"source_branch": "main",
"source_directory": "docs/sphinx",
}

# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
Expand Down
Loading

0 comments on commit db55c3a

Please sign in to comment.