Skip to content

Commit

Permalink
Timeout for scan and hatchling/relprep (#27)
Browse files Browse the repository at this point in the history
* Timeout for scan and hatchling/relprep

* publish action update

* fix build

* pip install instead of flit install in test workflow

* add test deps
  • Loading branch information
ksunden authored Jun 25, 2023
1 parent 19b2fc8 commit 5146d16
Show file tree
Hide file tree
Showing 7 changed files with 47 additions and 34 deletions.
12 changes: 7 additions & 5 deletions .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# This workflows will upload a Python Package using flit when a release is created
# This workflows will upload a Python Package when a release is created
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries

name: Upload Python Package
Expand All @@ -21,10 +21,12 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip!=22.1.*
pip install flit
pip install build twine
- name: Build and publish
env:
FLIT_USERNAME: ${{ secrets.PYPI_USERNAME }}
FLIT_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: flit publish
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
python -m build .
twine upload dist/*
3 changes: 1 addition & 2 deletions .github/workflows/python-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip!=20.3.4,!=21.0
python -m pip install --upgrade flit
flit install
python -m pip install .[tests]
- name: Test with pytest
run: |
pytest --color=yes
Expand Down
9 changes: 8 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,15 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/).

## [Unreleased]

## [2023.6.0]

### Changed
- Upgraded appdirs to platformdirs
- Warn for unexpected characters in daemon names
- Switch to hatchling

### Added
- Timeout for scan, including handling of scanning non-yaq ports

### [2022.4.0]

Expand Down Expand Up @@ -92,7 +98,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/).
### Added
- initial release

[Unreleased]: https://gitlab.com/yaq/yaqd-control/-/compare/v2022.4.0...main
[Unreleased]: https://gitlab.com/yaq/yaqd-control/-/compare/v2023.6.0...main
[2023.6.0]: https://gitlab.com/yaq/yaqd-control/-/compare/v2022.4.0...v2023.6.0
[2022.4.0]: https://gitlab.com/yaq/yaqd-control/-/compare/v2021.10.0...v2022.4.0
[2021.10.0]: https://gitlab.com/yaq/yaqd-control/-/compare/v2021.5.0...v2021.10.0
[2021.5.0]: https://gitlab.com/yaq/yaqd-control/-/compare/v2020.10.0...v2021.5.0
Expand Down
47 changes: 27 additions & 20 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,38 +1,45 @@
[build-system]
requires = ["flit_core >=2,<4"]
build-backend = "flit_core.buildapi"
requires = ["hatchling"]
build-backend = "hatchling.build"

[tool.flit.metadata]
module = "yaqd_control"
dist-name = "yaqd-control"
author = "yaq developers"
home-page = "https://yaq.fyi"
[project]
name = "yaqd-control"
authors = [{name="yaq developers"}]
requires-python = ">=3.7"
requires = ["platformdirs", "toml>=0.10.2", "click", "prettytable!=1.0.0", "rich", "yaqc"]
description-file="README.md"
dependencies = ["platformdirs", "toml>=0.10.2", "click", "prettytable!=1.0.0", "rich", "yaqc>=2023.6.0"]
license = "LGPL-3.0-only"
dynamic = ["version"]
readme="README.md"
classifiers=[
"Development Status :: 4 - Beta",
"Intended Audience :: Science/Research",
"License :: OSI Approved :: GNU Lesser General Public License v3 (LGPLv3)",
"Natural Language :: English",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Topic :: Scientific/Engineering",
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Science/Research",
"License :: OSI Approved :: GNU Lesser General Public License v3 (LGPLv3)",
"Natural Language :: English",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Topic :: Scientific/Engineering",
]

[tool.flit.metadata.urls]
[project.urls]
"Home page" = "https://yaq.fyi"
Source = "https://github.com/yaq-project/yaqd-control"
Documentation = "https://control.yaq.fyi"
Issues = "https://github.com/yaq-project/yaqd-control/issues"

[tool.flit.metadata.requires-extra]
[project.optional-dependencies]
dev = ["black", "pre-commit"]
tests = ["pytest", "pytest-subprocess", "types-toml", "types-click"]

[tool.flit.scripts]
[project.scripts]
yaqd = "yaqd_control.__main__:main"

[tool.hatch.version]
path = "yaqd_control/__version__.py"

[tool.black]
line-length = 99
target-version = ['py37', 'py38']
Expand Down
2 changes: 0 additions & 2 deletions yaqd_control/VERSION

This file was deleted.

4 changes: 1 addition & 3 deletions yaqd_control/__version__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@
__all__ = ["__version__", "__branch__"]


# read from VERSION file
with open(str(here / "VERSION")) as f:
__version__ = f.read().strip()
__version__ = "2023.6.0"

try:
__branch__ = (
Expand Down
4 changes: 3 additions & 1 deletion yaqd_control/_scan.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def scan(host="127.0.0.1", start=36000, stop=39999):
for i in range(start, stop + 1):
kwargs = dict()
try:
c = yaqc.Client(host=host, port=i)
c = yaqc.Client(host=host, port=i, timeout=0.1)
kwargs["host"] = host
kwargs["port"] = i
kwargs["kind"] = c.id()["kind"]
Expand All @@ -33,6 +33,8 @@ def scan(host="127.0.0.1", start=36000, stop=39999):
kwargs["model"] = c.id()["model"]
kwargs["serial"] = c.id()["serial"]
except Exception as e:
if isinstance(e, socket.timeout):
print(f"...port {i} is open but does not appear to be a yaq daemon")
if i in old_ports.keys():
kind = old_ports[i].kind
name = old_ports[i].name
Expand Down

0 comments on commit 5146d16

Please sign in to comment.