Skip to content

Commit

Permalink
Merge pull request #23 from ZLLentz/bld_pypi
Browse files Browse the repository at this point in the history
BLD/TST: Get the pypi builds running on gha
  • Loading branch information
ZLLentz authored Apr 12, 2023
2 parents 6d49987 + 7b84f35 commit 385bad8
Show file tree
Hide file tree
Showing 7 changed files with 83 additions and 127 deletions.
88 changes: 0 additions & 88 deletions .travis.yml

This file was deleted.

46 changes: 30 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,42 +1,56 @@
# pmpsdb_client

## Overview
Client-side application for the PMPS database

This is a cli/gui application and library for managing the deployment and
inspection of PMPS database files on production PLCs at LCLS.
This is a gui and cli application for managing the deployment and inspection of
PMPS database files on production PLCs at LCLS.
It provides tools to make deployment and verification of deployment seamless and easy.


## Usage
Once installed, this application can be invoked via `pmpsdb`. For example, here is
the current output of `pmpsdb --help`:

```
usage: pmpsdb [-h] [--version] [--verbose] {gui,plc} ...
usage: pmpsdb [-h] [--version] [--verbose] [--export-dir EXPORT_DIR] {gui,list-files,upload-to,download-from,compare,reload} ...
PMPS database deployment helpers
positional arguments:
{gui,plc}
gui Open the pmpsdb gui.
plc Read db from or write db to the plc harddrives.
{gui,list-files,upload-to,download-from,compare,reload}
gui Open the pmpsdb gui.
list-files Show all files uploaded to a PLC.
upload-to Upload a database export file to a PLC.
download-from Download a database file previously exported to a PLC.
compare Compare files beteween the local exports and the PLC.
reload Force the PLC to re-read the database export while running.
optional arguments:
-h, --help show this help message and exit
--version Show version information and exit
--verbose, -v Show tracebacks and debug statements
-h, --help show this help message and exit
--version Show version information and exit
--verbose, -v Show tracebacks and debug statements
--export-dir EXPORT_DIR, -e EXPORT_DIR
The directory that contains database file exports.
```

From a git clone, you can invoke the same script without needing to install the
package. This is done from the root directory here by calling
`python -m pmpsdb --help`, for example.

This application will not work unless you have access to the LCLS controls networks.
It is designed to run on an endstation's operator consoles.

The most common usage will be to open the gui from an operator console as simply `pmpsdb gui`.


## Installation
This package can be installed using recent versions of `pip` that support
the `pyproject.toml` format. To install, you can either clone this repo and run
the following from the root directory: `pip install .`, or you can install
directly from github via:
`pip install 'pmpsdb_client @ git+https://github.com/pcdshub/[email protected]'`
for example, to install version v1.0.0.
the `pyproject.toml` format.

To install, you can choose one of the following:
- `pip install pmpsdb_client` to install from pypi
- clone this repo, check out the desired tag, and run the following from the root directory: `pip install .`
- install directly from github via: `pip install 'pmpsdb_client @ git+https://github.com/pcdshub/[email protected]'` for example, to install version v1.1.2.


## PLC Configuration
The PLC must have the following configuration:
Expand Down
1 change: 1 addition & 0 deletions dev-requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pytest
2 changes: 1 addition & 1 deletion pmpsdb_client/pmpsdb_lfe.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
plc-lfe-motion: "PLC:LFE:MOTION"
plc-lfe-optics: "PLC:LFE:OPTICS"
plc-xrt-homs: "PLC:XRT:HOMS"
plc-xrt-homs: "PLC:XRT:OPTICS"
13 changes: 13 additions & 0 deletions pmpsdb_client/tests/test_cli.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
from pmpsdb_client import __version__
from pmpsdb_client.cli import main
from pmpsdb_client.cli.parser import create_parser


def test_version(capsys):
"""
Minimal test that we can parse input and do something
"""
parser = create_parser()
assert main(parser.parse_args(["--version"])) == 0
captured = capsys.readouterr()
assert str(__version__) in captured.out
5 changes: 5 additions & 0 deletions pmpsdb_client/tests/test_gui.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
def test_gui_imports():
"""
Minimal test that we can import the items needed to run the gui
"""
import pmpsdb_client.cli.run_gui # noqa: F401
55 changes: 33 additions & 22 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,34 +1,45 @@
[build-system]
requires = ["setuptools", "setuptools-scm"]
build-backend = "setuptools.build_meta"
requires = [ "setuptools>=45", "setuptools_scm[toml]>=6.2",]

[project]
name = "pmpsdb_client"
classifiers = [ "Development Status :: 4 - Beta", "Natural Language :: English", "Programming Language :: Python :: 3",]
description = "Client application for interfacing with the PMPS database and the deployed PLC files."
readme = "README.md"
requires-python = ">=3.9"
dynamic = [ "version", "readme", "dependencies", "optional-dependencies",]
keywords = ["pmps", "pmpsdb", "lcls"]
license = {text = "BSD 3-Clause License"}
classifiers = [
"Programming Language :: Python :: 3",
]
dependencies = [
"ophyd",
"pcdscalc",
"pcdsutils",
"prettytable",
"qtpy",
]
dynamic = ["version"]
name = "pmpsdb_client"
requires-python = ">=3.9"

[tool.setuptools_scm]
write_to = "pmpsdb_client/_version.py"
[[project.authors]]
name = "SLAC National Accelerator Laboratory"

[options]
zip_safe = false
include_package_data = true

[project.optional-dependencies]
gui = ["PyQt5"]
[project.license]
file = "LICENSE.md"

[project.scripts]
pmpsdb = "pmpsdb_client:cli.entrypoint"

# ... other project metadata fields as specified in:
# https://packaging.python.org/en/latest/specifications/declaring-project-metadata/
[tool.setuptools_scm]
write_to = "pmpsdb_client/_version.py"

[tool.setuptools.packages.find]
where = [ ".",]
include = [ "pmpsdb_client*",]
namespaces = false

[tool.setuptools.dynamic.readme]
file = "README.md"
content-type = "text/markdown"

[tool.setuptools.dynamic.dependencies]
file = [ "requirements.txt",]

[tool.setuptools.dynamic.optional-dependencies.test]
file = "dev-requirements.txt"

#[tool.setuptools.dynamic.optional-dependencies.docs]
#file = "docs-requirements.txt"

0 comments on commit 385bad8

Please sign in to comment.