From 4c7adf25a801143c88f8522b2f04a80acdcfd00a Mon Sep 17 00:00:00 2001 From: Dmitri Gavrilov Date: Wed, 19 Aug 2026 10:08:14 -0400 Subject: [PATCH 1/2] TST: parameterize host name and port in _wait_for_http_server_ready --- src/bluesky_httpserver/tests/conftest.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/bluesky_httpserver/tests/conftest.py b/src/bluesky_httpserver/tests/conftest.py index 5f5bf76..5dbe740 100644 --- a/src/bluesky_httpserver/tests/conftest.py +++ b/src/bluesky_httpserver/tests/conftest.py @@ -29,10 +29,10 @@ _user_group = "primary" -def _wait_for_http_server_ready(*, timeout=10, request_prefix="/api"): +def _wait_for_http_server_ready(*, http_server_host, http_server_port, timeout=10, request_prefix="/api"): """Wait until HTTP server accepts connections and responds to /status.""" t_stop = ttime.time() + timeout - url = f"http://{SERVER_ADDRESS}:{SERVER_PORT}{request_prefix}/status" + url = f"http://{http_server_host}:{http_server_port}{request_prefix}/status" while ttime.time() < t_stop: try: response = requests.get(url, timeout=0.5) @@ -57,7 +57,7 @@ class Starter(ProcessStarter): # args = f"start-bluesky-httpserver --host={SERVER_ADDRESS} --port {SERVER_PORT}".split() xprocess.ensure("fastapi_server", Starter) - _wait_for_http_server_ready() + _wait_for_http_server_ready(http_server_host=SERVER_ADDRESS, http_server_port=SERVER_PORT) yield @@ -84,7 +84,7 @@ class Starter(ProcessStarter): args = f"uvicorn --host={http_server_host} --port {http_server_port} {bqss.__name__}:app".split() xprocess.ensure("fastapi_server", Starter) - _wait_for_http_server_ready() + _wait_for_http_server_ready(http_server_host=http_server_host, http_server_port=http_server_port) yield start From dd7671732a58db8ae1776a46f0f58309f33cc9a8 Mon Sep 17 00:00:00 2001 From: Dmitri Gavrilov Date: Wed, 19 Aug 2026 10:12:26 -0400 Subject: [PATCH 2/2] CI: update python-publish GitHub action --- .github/workflows/python-publish.yml | 73 ++++++++++++++++++---------- 1 file changed, 48 insertions(+), 25 deletions(-) diff --git a/.github/workflows/python-publish.yml b/.github/workflows/python-publish.yml index 65e4e0a..29f9363 100644 --- a/.github/workflows/python-publish.yml +++ b/.github/workflows/python-publish.yml @@ -1,35 +1,58 @@ -# This workflows will upload a Python Package using flit 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 +name: Publish the release to PyPI on: release: types: [created] - branches: - - master jobs: - deploy: + build: + + name: Upload to PyPI + + permissions: + id-token: write + if: github.repository_owner == 'bluesky' runs-on: ubuntu-latest + env: + python_env: py313 + + strategy: + fail-fast: false + steps: - - uses: actions/checkout@v2 - - name: Set up Python - uses: actions/setup-python@v2 - with: - python-version: '3.x' - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install wheel twine setuptools - - name: Build and publish - env: - TWINE_USERNAME: __token__ - # The PYPI_PASSWORD must be a pypi token with the "pypi-" prefix with sufficient permissions to upload this package - # https://pypi.org/help/#apitoken - TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} - run: | - python setup.py sdist bdist_wheel - twine upload dist/* + - uses: actions/checkout@v4 + with: + # Need this to get version number from last tag + fetch-depth: 0 + + - uses: prefix-dev/setup-pixi@v0.10.0 + + - name: Install dev dependencies + run: | + set -vxeuo pipefail + pixi install --environment=${{ env.python_env }} + pixi list --environment=${{ env.python_env }} + pixi run --environment=${{ env.python_env }} pip list + pixi run --environment=${{ env.python_env }} conda list + + - name: Build sdist and wheel + run: > + export SOURCE_DATE_EPOCH=$(git log -1 --pretty=%ct) && + pixi run --environment=${{ env.python_env }} python -m build + + - name: Check for packaging errors + run: pixi run --environment=${{ env.python_env }} twine check --strict dist/* + + - name: Install produced wheel + run: pixi run --environment=${{ env.python_env }} pip install dist/*.whl + + - name: Test module is importable using the installed wheel + # If more than one module in src/ replace with module name to test + run: pixi run --environment=${{ env.python_env }} python -c "import $(ls --hide='*.egg-info' src | head -1)" + + - name: Publish to PyPI using trusted publishing + uses: pypa/gh-action-pypi-publish@release/v1 + with: + attestations: false