Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create python-publish.yml #532

Draft
wants to merge 13 commits into
base: main
Choose a base branch
from
44 changes: 44 additions & 0 deletions .github/workflows/python-app.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python

name: Python application

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

permissions:
contents: read

jobs:
build:

runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["pypy3.10", "3.9", "3.10", "3.11", "3.12", "3.13"]

steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Display Python version
run: python -c "import sys; print(sys.version)"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8 pytest
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics --exclude build
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test with pytest
run: |
pytest
39 changes: 39 additions & 0 deletions .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# This workflow will upload a Python Package using Twine when a release is created
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python#publishing-to-package-registries

# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.

name: Upload Python Package

on:
release:
types: [published]

permissions:
contents: read

jobs:
deploy:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build
- name: Build package
run: python -m build
- name: Publish package
uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
2 changes: 1 addition & 1 deletion docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

# must mock PyQt in order to get autodoc import running
MOCK_MODULES = ['numpy', 'scipy', 'qtpy', 'pyqtgraph', 'pandas',
'asyncio', 'quamash', 'scipy.signal', 'scipy.fftpack',
'asyncio', 'qasync', 'scipy.signal', 'scipy.fftpack',
'paramiko', 'scp']
sys.modules.update((mod_name, MagicMock()) for mod_name in MOCK_MODULES)

Expand Down
12 changes: 6 additions & 6 deletions docs/source/developer_guide/api/asynchronous/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ function). Let's see that on an example:
%pylab qt # in a notebook, we need the qt event loop to run in the background
import asyncio
import scipy.fftpack
import quamash # quamash allows to use the asyncio syntax of python 3 with the Qt event loop. Not sure how mainstream the library is...
import qasync # qasync allows to use the asyncio syntax of python 3 with the Qt event loop. Not sure how mainstream the library is...
from PyQt4 import QtCore, QtGui
import asyncio
loop = quamash.QEventLoop()
loop = qasync.QEventLoop()
asyncio.set_event_loop(loop) # set the qt event loop as the loop to be used by asyncio


Expand Down Expand Up @@ -58,12 +58,12 @@ practice, the code execution is probably extremely similar)
%pylab qt
import asyncio
import scipy.fftpack
import quamash
import qasync
from PyQt4 import QtCore, QtGui
APP = QtGui.QApplication.instance()
import asyncio
from promise import Promise
loop = quamash.QEventLoop()
loop = qasync.QEventLoop()
asyncio.set_event_loop(loop)


Expand Down Expand Up @@ -187,10 +187,10 @@ would easily do the trick:
%pylab qt
import asyncio
import scipy.fftpack
import quamash
import qasync
from PyQt4 import QtCore, QtGui
import asyncio
loop = quamash.QEventLoop()
loop = qasync.QEventLoop()
asyncio.set_event_loop(loop)


Expand Down
File renamed without changes.
File renamed without changes.
Loading
Loading