Skip to content

Commit fb9e525

Browse files
committed
Initial commit of pydnp3
1 parent 90c4bd3 commit fb9e525

File tree

235 files changed

+24117
-1
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

235 files changed

+24117
-1
lines changed

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ downloads/
1616
eggs/
1717
.eggs/
1818
lib/
19+
pydnp3/dnp3/
1920
lib64/
2021
parts/
2122
sdist/
@@ -99,3 +100,4 @@ ENV/
99100

100101
# mypy
101102
.mypy_cache/
103+
*.pytest_cache/

.gitmodules

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[submodule "deps/dnp3"]
2+
path = deps/dnp3
3+
url = https://github.com/automatak/dnp3
4+
[submodule "deps/pybind11"]
5+
path = deps/pybind11
6+
url = https://github.com/Kisensum/pybind11

.travis.yml

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
language: python
2+
3+
python:
4+
- "2.7"
5+
- "3.6"
6+
7+
# For linux
8+
before_install:
9+
- sudo apt-get update -qq
10+
- sudo apt-get install -qq [build-essential, python-dev, openssl, libssl-dev, libevent-dev]
11+
12+
install:
13+
- pip install -r requirements.txt
14+
- python setup.py -q install
15+
16+
script:
17+
- pytest

CMakeLists.txt

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
cmake_minimum_required (VERSION 2.8)
2+
3+
project (pydnp3)
4+
set(PYDNP3_MAJOR_VERSION 0)
5+
set(PYDNP3_MINOR_VERSION 1)
6+
set(PYDNP3_MICRO_VERSION 1)
7+
set(PYDNP3_VERSION ${PYDNP3_MAJOR_VERSION}.${PYDNP3_MINOR_VERSION}.${PYDNP3_MICRO_VERSION})
8+
9+
if(NOT CMAKE_BUILD_TYPE)
10+
set(CMAKE_BUILD_TYPE "Release" CACHE STRING
11+
"Choose the type of build, options are: Debug Release
12+
RelWithDebInfo MinSizeRel."
13+
FORCE)
14+
endif()
15+
16+
message("CMake build is: ${CMAKE_BUILD_TYPE}")
17+
18+
19+
#include(${PROJECT_SOURCE_DIR}/settings.cmake)
20+
21+
22+
# other options off-by-default that you can enable
23+
option(WERROR "Set all warnings to errors" OFF)
24+
option(STATICLIBS "Builds static versions of all installed libraries" OFF)
25+
option(COVERAGE "Builds the libraries with coverage info for gcov (gcc only)" OFF)
26+
option(PROFILE "Builds the libraries with profiling support (gcc only)" OFF)
27+
28+
set(CMAKE_REQUIRED_FLAGS ${CMAKE_CXX_FLAGS})
29+
30+
set(STATICLIBS ON)
31+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden")
32+
33+
add_subdirectory(deps/pybind11)
34+
add_subdirectory(deps/dnp3)
35+
36+
# include paths for all the local libraries
37+
include_directories(deps/dnp3/cpp/libs/include)
38+
#include_directories(/Users/bbarcklay/.virtualenvs/dnp3/include/python3.5m)
39+
#include_directories(/Users/bbarcklay/.virtualenvs/dnp3/bin/../include/site/python3.5)
40+
41+
# asio
42+
include_directories(deps/dnp3/deps/asio/asio/include)
43+
add_definitions(-DASIO_STANDALONE)
44+
45+
pybind11_add_module(pydnp3 MODULE src/pydnp3.cpp)
46+
target_link_libraries(pydnp3 PRIVATE asiopal asiodnp3 openpal opendnp3)
47+
48+
49+

README.md

+55-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,56 @@
11
# pydnp3
2-
Python bindings for opendnp3 libary
2+
Python bindings for the [opendnp3](https://github.com/automatak/dnp3) library, an open source
3+
implementation of the [DNP3](http://ww.dnp.org) protocol stack written in C++14.
4+
5+
Note: This is a work in progress. See [Issues](http://github.com/Kisensum/pydnp3/issues) for things we know about and feel free to add your own.
6+
7+
**Supported Platforms:** Linux, MacOS
8+
9+
## Dependencies
10+
To build the library from source, you must have:
11+
12+
* A toolchain with a C++14 compiler
13+
* CMake >= 2.8.12 (https://cmake.org/download/)
14+
15+
This repository includes two repositories as submodules (under `deps/`):
16+
17+
* dnp3 (https://github.com/automatak/dnp3)
18+
* pybind11 (https://github.com/Kisensum/pybind11) - This is a fork containing a minor patch
19+
required to compile some of the pydnp3 wrapper code. It will be replaced with pybind11 proper
20+
when the issue is resolved.
21+
22+
## Build & Install
23+
At the moment, this library must be built from source:
24+
```
25+
$ clone --recursive http://github.com/Kisensum/pydnp3
26+
$ cd pydnp3
27+
$ python setup.py install
28+
```
29+
30+
31+
## Documentation
32+
33+
pydnp3 is a thin wrapper around most all of the opendnp3 classes. Documentation for the opendnp3
34+
classes is available at [automatak](www.automatak.com/opendnp3/#documentation).
35+
36+
Use python's help to discover the available wrapper classes and functions. For example,
37+
38+
```
39+
> import pydnp3
40+
> help (pydnp3.opendnp3)
41+
Help on module pydnp3.opendnp3 in pydnp3:
42+
43+
NAME
44+
pydnp3.opendnp3 - Bindings for opendnp3 namespace
45+
46+
FILE
47+
(built-in)
48+
49+
CLASSES
50+
pybind11_builtins.pybind11_object(__builtin__.object)
51+
AnalogCommandEvent
52+
AnalogInfo
53+
AnalogSpec
54+
...
55+
```
56+

__init__.py

Whitespace-only changes.

deps/dnp3

Submodule dnp3 added at 71e767f

deps/pybind11

Submodule pybind11 added at 338d615

0 commit comments

Comments
 (0)