From 252b28785a551ee3cc03e861b7034541c5da95d6 Mon Sep 17 00:00:00 2001 From: Martin Renold Date: Fri, 1 Nov 2019 17:07:15 +0100 Subject: [PATCH 1/2] fix flake8 warnings --- docs/conf.py | 5 +---- setup.py | 4 +--- src/python_cpp_example/hello.py | 2 +- tests/math_test.py | 2 +- 4 files changed, 4 insertions(+), 9 deletions(-) diff --git a/docs/conf.py b/docs/conf.py index a005b25..8d35dc6 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -42,7 +42,7 @@ autosummary_generate = True -breathe_projects = { "python_cpp_example": "_build/doxygenxml/" } +breathe_projects = {"python_cpp_example": "_build/doxygenxml/"} breathe_default_project = "python_cpp_example" breathe_domain_by_extension = {'hpp': 'cpp'} @@ -183,6 +183,3 @@ def generate_doxygen_xml(app): def setup(app): """Add hook for building doxygen xml when needed""" app.connect("builder-inited", generate_doxygen_xml) - - - diff --git a/setup.py b/setup.py index 54753b8..e2f40e3 100755 --- a/setup.py +++ b/setup.py @@ -3,14 +3,12 @@ import os import re import sys -import sysconfig import platform import subprocess from distutils.version import LooseVersion from setuptools import setup, Extension, find_packages from setuptools.command.build_ext import build_ext -from setuptools.command.test import test as TestCommand from shutil import copyfile, copymode @@ -100,7 +98,7 @@ def copy_test_file(self, src_file): description='A hybrid Python/C++ test project', long_description='', packages=find_packages('src'), - package_dir={'':'src'}, + package_dir={'': 'src'}, ext_modules=[CMakeExtension('python_cpp_example/python_cpp_example')], cmdclass=dict(build_ext=CMakeBuild), test_suite='tests', diff --git a/src/python_cpp_example/hello.py b/src/python_cpp_example/hello.py index caf5928..67f7e53 100644 --- a/src/python_cpp_example/hello.py +++ b/src/python_cpp_example/hello.py @@ -1,3 +1,3 @@ def say_hello(): - print("Hello world!") \ No newline at end of file + print("Hello world!") diff --git a/tests/math_test.py b/tests/math_test.py index 2aa74a2..e2b9f2c 100644 --- a/tests/math_test.py +++ b/tests/math_test.py @@ -9,4 +9,4 @@ def test_subtract(self): self.assertEqual(python_cpp_example.subtract(1, 1), 0) if __name__ == '__main__': - unittest.main() \ No newline at end of file + unittest.main() From 487ae64a0105f7114d9382d637ba9f1a333dfe91 Mon Sep 17 00:00:00 2001 From: Martin Renold Date: Fri, 1 Nov 2019 17:14:58 +0100 Subject: [PATCH 2/2] update to pybind11 v2.4.3 Previous dependency was some mid-2017 git snapshot. --- lib/pybind11 | 2 +- src/python_cpp_example/bindings.cpp | 10 ++++------ 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/lib/pybind11 b/lib/pybind11 index a4d0d95..80d4524 160000 --- a/lib/pybind11 +++ b/lib/pybind11 @@ -1 +1 @@ -Subproject commit a4d0d95e2ec717f15b42cd3e4b3bbccf12f57d57 +Subproject commit 80d452484c5409444b0ec19383faa84bb7a4d351 diff --git a/src/python_cpp_example/bindings.cpp b/src/python_cpp_example/bindings.cpp index d76eb89..b3a7e8c 100644 --- a/src/python_cpp_example/bindings.cpp +++ b/src/python_cpp_example/bindings.cpp @@ -3,8 +3,8 @@ namespace py = pybind11; -PYBIND11_PLUGIN(python_cpp_example) { - py::module m("python_cpp_example", R"doc( +PYBIND11_MODULE(python_cpp_example, m) { + m.doc() = R"doc( Python module ----------------------- .. currentmodule:: python_cpp_example @@ -13,7 +13,7 @@ PYBIND11_PLUGIN(python_cpp_example) { add subtract - )doc"); + )doc"; m.def("add", &add, R"doc( Add two numbers @@ -26,6 +26,4 @@ PYBIND11_PLUGIN(python_cpp_example) { Some other information about the subtract function. )doc"); - - return m.ptr(); -} \ No newline at end of file +} pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy