diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index 85a038c..e5ad6c8 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -23,21 +23,29 @@ jobs: - uses: ConorMacBride/install-package@v1 with: apt: protobuf-compiler - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v3 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - name: Install dependencies run: | python -m pip install --upgrade pip - python -m pip install flake8 pytest wheel + python -m pip install flake8 pytest wheel setuptools if [ -f requirements.txt ]; then pip install -r requirements.txt; fi - name: build and binary module run: | python setup.py build_proto_c - python -m pip install . - + python -m pip wheel ./ + python -m pip install ./ + + - name: Archive wheel + uses: actions/upload-artifact@v4 + with: + name: bact_archiver_${{ matrix.python-version }} + path: bact_archiver*.whl + retention-days: 14 + - name: Lint with flake8 run: | # stop the build if there are Python syntax errors or undefined names @@ -46,4 +54,5 @@ jobs: flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics - name: Test with pytest run: | - pytest --log-cli-level INFO + find . -type f + (cd tests && python -m pytest --log-cli-level INFO) diff --git a/MANIFEST.in b/MANIFEST.in index 659c915..33e2d2f 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,11 +1,8 @@ -include cysetuptools.py include protocol_buffer.py # the source files -include proto/* +# include proto/* # the files generated -include proto_gen/* -include bact_archiver/*.py -# configuration files +b# configuration files include bact_archiver/*.cfg # documentation files include doc/conf.py diff --git a/proto/__init__.py b/proto/__init__.py deleted file mode 100644 index 7ecaefa..0000000 --- a/proto/__init__.py +++ /dev/null @@ -1 +0,0 @@ -# Solely required for cython build process. diff --git a/pyproject.toml b/pyproject.toml index a6bbe84..d87c7d6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,9 +1,43 @@ +# -*- coding: utf-8 -*- [build-system] -requires = ["setuptools", "setuptools-scm", "numpy"] +requires = ["setuptools >= 61.0", "setuptools-scm", "cython", "numpy"] build-backend = "setuptools.build_meta" +[project] +name = "bact-archiver" +# url = +# fullname = "BACT epics archiver appliance access" +version = "0.2.2" +description = "EPICS archiver appliance access using google protobuf" +readme="README.rst" +authors = [ + {name = "Andreas Schälicke", email="andreas.schaelicke@helmholtz-berlin.de"}, + {name = "Pierre Schnizer", email="pierre.schnizer@helmholtz-berlin.de"}, +] +license = {text = "GNU General Public License (GPL)"} +classifiers = [ + "Development Status :: 4 - Beta", + "Intended Audience :: Science/Research", + "Programming Language :: Python :: 3", + "Topic :: Scientific/Engineering :: Physics", +] + +requires-python = ">= 3.7" + dependencies = [ + "numpy", "pandas", "protobuf >=3.18.3, ==3.*", "python-dateutil" -] \ No newline at end of file +] + + +[project.urls] +homepage = "https://github.com/hz-b/bact-archiver" + + + +[tool.setuptools.packages.find] +exclude = ["*.cc", "*.h", "proto/*"] +namespaces = false + diff --git a/setup.cfg b/setup.cfg index cf5b4cb..abbf747 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,50 +1,4 @@ -# -*- coding: utf-8 -*- - -[metadata] -name = bact-archiver -fullname = BACT epics archiver appliance access -version = 0.2.1 -url = https://github.com/hz-b/bact-archiver -author = Andreas Schälicke, Pierre Schnizer -author_email = andreas.schaelicke@helmholtz-berlin.de - pierre.schnizer@helmholtz-berlin.de -description = EPICS archiver appliance access using google protobuf -long_description = file: README.rst -classifiers = - Development Status :: 4 - Beta - Intended Audience :: Science/Research - License :: OSI Approved :: GNU General Public License (GPL) - Programming Language :: Python :: 3 - Topic :: Scientific/Engineering :: Physics -[build-system] -requires = setup_tools - - -[options] -packages = find: -setup_requires = cython -install_requires = - pandas - protobuf >=3.18.3, ==3.* - python-dateutil - -requires = numpy -include_package_data = True -# zip_safe = False - -# [package_data] -[options.package_data] -bact_archiver = - archiver.cfg - -[options.extras_require] -dev = - cython -# only needed once to create cysetuptools locally -# cython-setuptools - -# The configuration of the following two build steps depens on each -# other. +# Howto include this section to pyproject.toml [build_proto_c] python = True cpp = True @@ -52,16 +6,3 @@ src_dir = proto build_dir = proto_gen pydir = bact_archiver source = proto/epics_event.proto - -[cython-module: bact_archiver.epics_event] -include_dirs = proto_gen - eval(__import__('numpy').get_include()) - -# The directory will be typically match the src_dir directory -# of the build_proto_c section for the .pyx file and the -# build_dir for the .cc file -sources = proto/epics_event.pyx - proto_gen/epics_event.pb.cc -libraries = protobuf -language = c++ -show-all-warnings = True diff --git a/setup.py b/setup.py index 4603c40..892454f 100644 --- a/setup.py +++ b/setup.py @@ -1,18 +1,30 @@ # -*- coding: utf-8 -*- # Authors : Andreas Schälicke # Pierre Schnizer -# Date : 2017, 2020, 2023 -import sys, os.path -# required that cysetuptools is found +# Date : 2017, 2020, 2023, 2024 +import os +import sys + +from setuptools import Extension, setup +from numpy import get_include +# required that protocol_buffer is found sys.path.append(os.path.dirname(__file__)) -from cysetuptools import setup -import protocol_buffer +from protocol_buffer import GenerateProtocolBuffer -cmdclass = dict(build_proto_c=protocol_buffer.GenerateProtocolBuffer) setup( - cmdclass=cmdclass, - author="Andreas Schälicke, Pierre Schnizer", - author_email=( - "andreas.schälicke@helmholtz-berlin.de, " "pierre.schnizer@helmholtz-berlin.de" - ), + cmdclass=dict(build_proto_c=GenerateProtocolBuffer), + ext_modules=[ + Extension( + name="bact_archiver.epics_event", + sources=[ + "proto/epics_event.pyx", + "proto_gen/epics_event.pb.cc", + ], + include_dirs=[".", "proto_gen/", get_include()], + libraries=[ + "protobuf", + ], + language="c++", + ) + ], )