Skip to content

Commit

Permalink
Merge pull request #6 from hz-b/dev/feature/pyproject-toml
Browse files Browse the repository at this point in the history
[TASK] moved info to pyproject.toml
  • Loading branch information
PierreSchnizer authored Jun 14, 2024
2 parents 75ed1d9 + 11ce10f commit be30a87
Show file tree
Hide file tree
Showing 6 changed files with 77 additions and 85 deletions.
21 changes: 15 additions & 6 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
7 changes: 2 additions & 5 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -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
Expand Down
1 change: 0 additions & 1 deletion proto/__init__.py

This file was deleted.

38 changes: 36 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -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="[email protected]"},
{name = "Pierre Schnizer", email="[email protected]"},
]
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"
]
]


[project.urls]
homepage = "https://github.com/hz-b/bact-archiver"



[tool.setuptools.packages.find]
exclude = ["*.cc", "*.h", "proto/*"]
namespaces = false

61 changes: 1 addition & 60 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,67 +1,8 @@
# -*- 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 = [email protected]
[email protected]
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
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
34 changes: 23 additions & 11 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,30 @@
# -*- coding: utf-8 -*-
# Authors : Andreas Schälicke <[email protected]>
# Pierre Schnizer <[email protected]>
# 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ä[email protected], " "[email protected]"
),
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++",
)
],
)

0 comments on commit be30a87

Please sign in to comment.