Skip to content

Commit

Permalink
Updated to use Python 3.12 (ONLY - due to distutils being deprecated)
Browse files Browse the repository at this point in the history
This commit also includes formatting changes from ruff
  • Loading branch information
Oliver Copping committed Apr 16, 2024
1 parent 70b030d commit ec56024
Show file tree
Hide file tree
Showing 25 changed files with 1,574 additions and 1,316 deletions.
214 changes: 16 additions & 198 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,229 +43,47 @@ jobs:
# Check build from .tar
- name: Source
os: ubuntu-latest
python: "3.9"
python: "3.12"
source: true

# Linux py builds x64
- name: linux 2.7 amd64
os: ubuntu-latest
pyver: cp27-cp27m
piparch: manylinux1_x86_64
numpy: numpy==1.8.2
cython: Cython==0.29.2

- name: linux 2.7u amd64
os: ubuntu-latest
pyver: cp27-cp27mu
piparch: manylinux1_x86_64
numpy: numpy==1.8.2
cython: Cython==0.29.2

- name: linux 3.5 amd64
os: ubuntu-latest
pyver: cp35-cp35m
piparch: manylinux1_x86_64
numpy: numpy==1.12.1
cython: Cython==0.29.2

- name: linux 3.6 amd64
os: ubuntu-latest
pyver: cp36-cp36m
piparch: manylinux1_x86_64
numpy: numpy==1.12.1
cython: Cython==0.29.2

- name: linux 3.7 amd64
os: ubuntu-latest
pyver: cp37-cp37m
piparch: manylinux1_x86_64
numpy: numpy==1.16.2
cython: Cython==0.29.2

- name: linux 3.8 amd64
os: ubuntu-latest
pyver: cp38-cp38
piparch: manylinux1_x86_64
numpy: numpy==1.17.3
cython: Cython==0.29.2

- name: linux 3.9 amd64
os: ubuntu-latest
pyver: cp39-cp39
piparch: manylinux2010_x86_64
numpy: numpy==1.19.3
cython: Cython==0.29.23

- name: linux 3.10 amd64
- name: linux 3.12 amd64
os: ubuntu-latest
pyver: cp310-cp310
pyver: cp312-cp312
piparch: manylinux2014_x86_64
numpy: numpy==1.22.0
cython: Cython==0.29.23

- name: linux 3.11 amd64
os: ubuntu-latest
pyver: cp311-cp311
piparch: manylinux2014_x86_64
numpy: numpy==1.23.5
cython: Cython==0.29.35
numpy: numpy==1.26.4
cython: Cython==3.0.10
skip_cothread: yes

# Linux py builds x64
- name: linux 2.7 i686
os: ubuntu-latest
pyver: cp27-cp27m
piparch: manylinux1_i686
numpy: numpy==1.11.1
cython: Cython==0.29.2
pre: linux32

- name: linux 2.7u i686
os: ubuntu-latest
pyver: cp27-cp27mu
piparch: manylinux1_i686
numpy: numpy==1.11.1
cython: Cython==0.29.2
pre: linux32

- name: linux 3.5 i686
os: ubuntu-latest
pyver: cp35-cp35m
piparch: manylinux1_i686
numpy: numpy==1.12.1
cython: Cython==0.29.2
pre: linux32

- name: linux 3.6 i686
os: ubuntu-latest
pyver: cp36-cp36m
piparch: manylinux1_i686
numpy: numpy==1.12.1
cython: Cython==0.29.2
pre: linux32

- name: linux 3.7 i686
- name: linux 3.12 i686
os: ubuntu-latest
pyver: cp37-cp37m
piparch: manylinux1_i686
numpy: numpy==1.16.2
cython: Cython==0.29.2
pre: linux32

- name: linux 3.8 i686
os: ubuntu-latest
pyver: cp38-cp38
piparch: manylinux1_i686
numpy: numpy==1.17.3
cython: Cython==0.29.2
pre: linux32

- name: linux 3.9 i686
os: ubuntu-latest
pyver: cp39-cp39
pyver: cp312-cp312
piparch: manylinux2010_i686
numpy: numpy==1.19.3
cython: Cython==0.29.23
numpy: numpy==1.26.4
cython: Cython==3.0.10
pre: linux32

# numpy i386 wheels not built >= 3.10

# OSX py builds
- name: osx 3.6 intel
os: macos-latest
python: "3.6"
piparch: macosx_10_9_intel
numpy: numpy==1.11.3
cython: Cython==0.29.2

- name: osx 3.7 intel
os: macos-latest
python: "3.7"
piparch: macosx_10_9_intel
numpy: numpy==1.16.2
cython: Cython==0.29.2

- name: osx 3.8 intel
os: macos-latest
python: "3.8"
piparch: macosx_10_9_intel
numpy: numpy==1.17.3
cython: Cython==0.29.2

- name: osx 3.9 intel
os: macos-latest
python: "3.9"
piparch: macosx_10_9_intel
numpy: numpy==1.19.3
cython: Cython==0.29.23

- name: osx 3.10 intel
os: macos-latest
python: "3.10"
piparch: macosx_10_9_intel
numpy: numpy==1.22.0
cython: Cython==0.29.23

- name: osx 3.11 intel
- name: osx 3.12 intel
os: macos-latest
python: "3.11"
python: "3.12"
piparch: macosx_10_9_intel
numpy: numpy==1.23.5
cython: Cython==0.29.35
numpy: numpy==1.26.4
cython: Cython==3.0.10
skip_cothread: yes

# Windows py builds

## missing Microsoft Visual C++ 9.0
#- os: windows-latest
# python: "2.7"
# python: "3.12"
# piparch: win_amd64

- name: win64 3.5
os: windows-2019
python: "3.5"
piparch: win_amd64
profile: latest
skip_cothread: yes

- name: win64 3.6
os: windows-latest
python: "3.6"
piparch: win_amd64
profile: latest
skip_cothread: yes

- name: win64 3.7
os: windows-latest
python: "3.7"
piparch: win_amd64
profile: latest
skip_cothread: yes

- name: win64 3.8
os: windows-latest
python: "3.8"
piparch: win_amd64
profile: latest
skip_cothread: yes

- name: win64 3.9
os: windows-latest
python: "3.9"
piparch: win_amd64
profile: latest
skip_cothread: yes

- name: win64 3.10
os: windows-latest
python: "3.10"
piparch: win_amd64
profile: latest
skip_cothread: yes

- name: win64 3.11
- name: win64 3.12
os: windows-latest
python: "3.11"
python: "3.12"
piparch: win_amd64
profile: latest
skip_cothread: yes
Expand Down
42 changes: 24 additions & 18 deletions example/dynamicbox_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,9 @@
$ pvget -m foo:list
"""

from __future__ import print_function

import sys
import time, logging

_log = logging.getLogger(__name__)

from threading import Lock
Expand All @@ -31,19 +30,19 @@

prefix = sys.argv[1]

list_type = NTScalar('as')
list_type = NTScalar("as")

types = {
'int':NTScalar('i').wrap(0),
'float':NTScalar('d').wrap(0.0),
'str':NTScalar('s').wrap(''),
'enum':NTEnum().wrap(0),
"int": NTScalar("i").wrap(0),
"float": NTScalar("d").wrap(0.0),
"str": NTScalar("s").wrap(""),
"enum": NTEnum().wrap(0),
}

pvs_lock = Lock()
pvs = {}

provider = StaticProvider('dynamicbox')
provider = StaticProvider("dynamicbox")


class MailboxHandler(object):
Expand All @@ -52,34 +51,40 @@ def put(self, pv, op):
pv.post(op.value())
op.done()

addpv = SharedPV(initial=NTScalar('s').wrap('Only RPC'))
delpv = SharedPV(initial=NTScalar('s').wrap('Only RPC'))

addpv = SharedPV(initial=NTScalar("s").wrap("Only RPC"))
delpv = SharedPV(initial=NTScalar("s").wrap("Only RPC"))
listpv = SharedPV(nt=list_type, initial=[])

provider.add(prefix + "add", addpv)
provider.add(prefix + "del", delpv)
provider.add(prefix + "list", listpv)
_log.info("add with %s, remove with %s, list with %s", prefix + "add", prefix + "del", prefix + "list")
_log.info(
"add with %s, remove with %s, list with %s",
prefix + "add",
prefix + "del",
prefix + "list",
)


@addpv.rpc
def adder(pv, op):
name = op.value().query.name
type = op.value().query.get('type', 'int')
type = op.value().query.get("type", "int")

if type not in types:
op.done(error='unknown type %s. Known types are %s'%(type, ', '.join(types)))
op.done(error="unknown type %s. Known types are %s" % (type, ", ".join(types)))
return

with pvs_lock:

if name in pvs:
op.done(error='PV already exists')
op.done(error="PV already exists")
return

pv = SharedPV(initial=types[type], handler=MailboxHandler())
provider.add(name, pv)
pvs[name] = pv
names = list(pvs) # makes a copy to ensure consistency outside lock
names = list(pvs) # makes a copy to ensure consistency outside lock

_log.info("Added mailbox %s", name)
listpv.post(names)
Expand All @@ -96,13 +101,14 @@ def remover(pv, op):
return
pv = pvs.pop(name)
provider.remove(name)
names = list(pvs) # makes a copy to ensure consistency outside lock
names = list(pvs) # makes a copy to ensure consistency outside lock

_log.info("Removed mailbox %s", name)
listpv.post(names)

op.done()


Server.forever(providers=[provider])

print('Done')
print("Done")
Loading

0 comments on commit ec56024

Please sign in to comment.