Skip to content

Commit ced7890

Browse files
committed
Prepare for dss_python_backend
1 parent 6af436a commit ced7890

File tree

11 files changed

+39
-328
lines changed

11 files changed

+39
-328
lines changed

.github/workflows/builds.yml

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ jobs:
2525
image: ${{ matrix.container-image }}
2626
env:
2727
CONDA_SUBDIR: 'linux-64'
28-
DSS_CAPI_PATH: '${{ github.workspace }}/dss_capi'
2928
CONDA: "/opt/miniconda/"
3029
steps:
3130
- name: 'Checkout'
@@ -35,9 +34,7 @@ jobs:
3534
git checkout $GITHUB_SHA
3635
- name: 'Download/extract DSS C-API binaries'
3736
run: |
38-
curl -s -L https://github.com/dss-extensions/dss_capi/releases/download/${DSS_CAPI_TAG}/dss_capi_${DSS_CAPI_TAG}_linux_x64.tar.gz -o dss_capi.tar.gz
3937
curl -s -L https://github.com/dss-extensions/dss_capi/releases/download/${DSS_CAPI_TAG}/messages.tar.gz -o messages.tar.gz
40-
tar zxf dss_capi.tar.gz
4138
cd dss_python/dss
4239
tar zxf ../../messages.tar.gz
4340
- name: Build wheel
@@ -74,16 +71,14 @@ jobs:
7471
docker pull $DOCKER_IMAGE
7572
- name: 'Download/extract DSS C-API binaries'
7673
run: |
77-
curl -s -L https://github.com/dss-extensions/dss_capi/releases/download/${DSS_CAPI_TAG}/dss_capi_${DSS_CAPI_TAG}_linux_x86.tar.gz -o dss_capi.tar.gz
7874
curl -s -L https://github.com/dss-extensions/dss_capi/releases/download/${DSS_CAPI_TAG}/messages.tar.gz -o messages.tar.gz
79-
tar zxf dss_capi.tar.gz
8075
cd dss_python/dss
8176
tar zxf ../../messages.tar.gz
8277
- name: Build wheel
8378
run: |
8479
mkdir -p artifacts
8580
mkdir -p artifacts_raw
86-
docker run -e GITHUB_SHA -e GITHUB_REF -e DSS_CAPI_PATH=/build/dss_capi -v "${PWD}:/build" -w /build $DOCKER_IMAGE bash /build/dss_python/ci/build_linux.sh x86
81+
docker run -e GITHUB_SHA -e GITHUB_REF -v "${PWD}:/build" -w /build $DOCKER_IMAGE bash /build/dss_python/ci/build_linux.sh x86
8782
- name: 'Upload artifacts'
8883
uses: "actions/upload-artifact@v2"
8984
with:
@@ -94,7 +89,6 @@ jobs:
9489
name: 'macOS x64'
9590
runs-on: 'macos-10.15'
9691
env:
97-
DSS_CAPI_PATH: '${{ github.workspace }}/dss_capi'
9892
SDKROOT: '${{ github.workspace }}/MacOSX10.13.sdk'
9993
PYTHON: python3
10094
steps:
@@ -104,15 +98,9 @@ jobs:
10498
path: 'dss_python'
10599
- name: 'Download/extract DSS C-API binaries'
106100
run: |
107-
curl -s -L https://github.com/dss-extensions/dss_capi/releases/download/${DSS_CAPI_TAG}/dss_capi_${DSS_CAPI_TAG}_darwin_x64.tar.gz -o dss_capi.tar.gz
108101
curl -s -L https://github.com/dss-extensions/dss_capi/releases/download/${DSS_CAPI_TAG}/messages.tar.gz -o messages.tar.gz
109-
tar zxf dss_capi.tar.gz
110102
cd dss_python/dss
111103
tar zxf ../../messages.tar.gz
112-
- name: 'Download macOS SDK 10.13'
113-
run: |
114-
curl -s -L https://github.com/phracker/MacOSX-SDKs/releases/download/11.3/MacOSX10.13.sdk.tar.xz -o macOSsdk.tar.xz
115-
tar xf macOSsdk.tar.xz
116104
- name: Build wheel
117105
run: |
118106
bash dss_python/ci/build_wheel.sh
@@ -131,8 +119,6 @@ jobs:
131119
name: 'macOS ARM64'
132120
runs-on: 'macos-11'
133121
env:
134-
DSS_CAPI_PATH: '${{ github.workspace }}/dss_capi'
135-
# SDKROOT: '${{ github.workspace }}/MacOSX10.13.sdk'
136122
PYTHON: python3
137123
_PYTHON_HOST_PLATFORM: macosx-11.0-arm64
138124
ARCHFLAGS: '-arch arm64'
@@ -144,9 +130,7 @@ jobs:
144130
path: 'dss_python'
145131
- name: 'Download/extract DSS C-API binaries'
146132
run: |
147-
curl -s -L https://github.com/dss-extensions/dss_capi/releases/download/${DSS_CAPI_TAG}/dss_capi_${DSS_CAPI_TAG}_darwin_arm64.tar.gz -o dss_capi.tar.gz
148133
curl -s -L https://github.com/dss-extensions/dss_capi/releases/download/${DSS_CAPI_TAG}/messages.tar.gz -o messages.tar.gz
149-
tar zxf dss_capi.tar.gz
150134
cd dss_python/dss
151135
tar zxf ../../messages.tar.gz
152136
# - name: 'Download macOS SDK 10.13'
@@ -172,7 +156,6 @@ jobs:
172156
runs-on: windows-2019
173157
env:
174158
CONDA_SUBDIR: 'win-64'
175-
DSS_CAPI_PATH: '${{ github.workspace }}\dss_capi'
176159
PYTHON: python
177160
steps:
178161
- uses: actions/checkout@v2
@@ -182,9 +165,7 @@ jobs:
182165
- name: 'Download/extract DSS C-API binaries'
183166
shell: cmd
184167
run: |
185-
"c:\Program Files\Git\mingw64\bin\curl" -s -L https://github.com/dss-extensions/dss_capi/releases/download/%DSS_CAPI_TAG%/dss_capi_%DSS_CAPI_TAG%_win_x64.zip -o dss_capi.zip
186168
"c:\Program Files\Git\mingw64\bin\curl" -s -L https://github.com/dss-extensions/dss_capi/releases/download/%DSS_CAPI_TAG%/messages.zip -o messages.zip
187-
7z x -y -o. dss_capi.zip
188169
cd dss_python\dss
189170
tar zxf ..\..\messages.zip
190171
- name: Build wheel
@@ -207,7 +188,6 @@ jobs:
207188
runs-on: windows-2019
208189
env:
209190
CONDA_SUBDIR: 'win-32'
210-
DSS_CAPI_PATH: '${{ github.workspace }}\dss_capi'
211191
PYTHON: python
212192
steps:
213193
- uses: actions/checkout@v2
@@ -221,9 +201,7 @@ jobs:
221201
- name: 'Download/extract DSS C-API binaries'
222202
shell: cmd
223203
run: |
224-
"c:\Program Files\Git\mingw64\bin\curl" -s -L https://github.com/dss-extensions/dss_capi/releases/download/%DSS_CAPI_TAG%/dss_capi_%DSS_CAPI_TAG%_win_x86.zip -o dss_capi.zip
225204
"c:\Program Files\Git\mingw64\bin\curl" -s -L https://github.com/dss-extensions/dss_capi/releases/download/%DSS_CAPI_TAG%/messages.zip -o messages.zip
226-
7z x -y -o. dss_capi.zip
227205
cd dss_python\dss
228206
tar zxf ..\..\messages.zip
229207
- name: Build wheel

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Please see [FAQ](https://github.com/dss-extensions/dss-extensions#faq) for a cou
1616
- [DSS Sharp](http://github.com/dss-extensions/dss_sharp/) is available for .NET/C#, [packaged on NuGet](https://www.nuget.org/packages/dss_sharp/), also mimics the COM classes (drop-in replacement for `OpenDSSengine.DLL`). The current version is now multi-platform too! Soon it will be possible to use it via COM.
1717
- [DSS MATLAB](http://github.com/dss-extensions/dss_matlab/) presents multi-platform integration (Windows, Linux, MacOS) with DSS C-API and is also very compatible with the API of the official OpenDSS COM classes.
1818

19-
Version 0.13.x is based on OpenDSS revision 3595 (few commits after OpenDSS v9.6.1.1, but we pick and choose when to port certain features). While we plan to add a lot more functionality into DSS Python, the main goal of creating a COM-compatible API has been reached in 2018. If you find an unexpected missing feature, please report it! Currently missing features that will be implemented eventually are plotting (partial implementation available) and diakoptics (planned for future version).
19+
Version 0.14.x is based on OpenDSS revision 3595 (few commits after OpenDSS v9.6.1.1, but we pick and choose when to port certain features). While we plan to add a lot more functionality into DSS Python, the main goal of creating a COM-compatible API has been reached in 2018. If you find an unexpected missing feature, please report it! Currently missing features that will be implemented eventually are plotting (partial implementation available) and diakoptics (planned for future version).
2020

2121
This module mimics the COM structure (as exposed via `win32com` or `comtypes`) -- see [The DSS instance](https://dss-extensions.org/dss_python/#the-dss-instance) for some docs -- effectively enabling multi-platform compatibility at Python level. Compared to other options, it provides easier migration from code that uses the official OpenDSS through COM.
2222
Most of the COM documentation can be used as-is, but instead of returning tuples or lists, this modules returns/accepts NumPy arrays for numeric data exchange, which is usually preferred by the users.
@@ -25,6 +25,7 @@ The module depends on CFFI, NumPy and, optionally, SciPy.Sparse for reading the
2525

2626
## Brief release history
2727

28+
- 2023-04-03 / version 0.14.0: Same as 0.13.1, but splits dss_python into two packages: [dss_python_backend](https://github.com/dss-extensions/dss_python_backend) now contains the native binaries/DLLs. No need for user action.
2829
- **2023-04-01 / version 0.13.1: Microupdate to the OpenDSS engine; very minor Python changes.**
2930
- 2023-03-29 / version 0.13.0: Updates to the OpenDSS engine, move plotting and initial notebook integration, matrix shapes and complex numbers, bug fixes, etc.
3031
- 2022-07-16 / version 0.12.1: Very minor release to address a bug found in v0.12.0, to add the Storages API, and include the property descriptions/help.

ci/build_conda.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ if [ "$RUNNER_OS" = "Windows" ]; then
66
fi
77

88
export PATH=$CONDA:$CONDA/bin:$CONDA/scripts:$PATH
9-
export DSS_PYTHON_MANYLINUX=0
109

1110
source $CONDA/etc/profile.d/conda.sh
1211

ci/build_linux.sh

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,7 @@
11
set -e -x
22
export PATH=/opt/python/cp39-cp39/bin/:$PATH
3-
export DSS_PYTHON_MANYLINUX=1
43

54
cd dss_python
6-
python3 -m pip install --upgrade pip cffi wheel
7-
python3 setup.py --quiet bdist_wheel --py-limited-api cp37 --dist-dir="../artifacts_raw"
5+
python3 -m pip install --upgrade pip wheel
6+
python3 setup.py --quiet bdist_wheel --py-limited-api cp37 --dist-dir="../artifacts"
87
cd ..
9-
10-
# Bundle external shared libraries into the wheels
11-
export LD_LIBRARY_PATH=${DSS_CAPI_PATH}/lib/linux_$1:$LD_LIBRARY_PATH
12-
for whl in artifacts_raw/*.whl; do
13-
auditwheel repair "$whl" -w artifacts
14-
done

docs/changelog.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
# 0.14.x
2+
3+
## 0.14.0
4+
5+
Same as version 0.13.1, except that the organization of the module has changed to facilitate fast iteration of the Python side of the code.
6+
7+
We introduced the new package `dss_python_backend` that will contain all native libs and CFFI bindings from this point on. This leaves DSS-Python itself as a pure Python package, which is much easier to package and distribute.
8+
19
# 0.13.x
210

311
## 0.13.1

docs/examples/UserModels/PyIndMach012/README.ipynb

Lines changed: 16 additions & 16 deletions
Large diffs are not rendered by default.

dss/UserModels/wrappers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import re
2-
from .. import (
2+
from dss_python_backend import (
33
# _dss_CapUserControl,
44
_dss_GenUserModel,
55
# _dss_PVSystemUserModel,

dss/__init__.py

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,13 @@
55
This module used to provide instances for the OpenDSS Version 7 implementation.
66
As of 2022, most of the parallel-machine functions of EPRI's OpenDSS have been reimplemented using a different approach. Therefore the PM functions are available in the instances of this module too.
77
Besides the parallel-machine mechanisms, DSS Python also exposes the DSSContext mechanism provided by DSS Extensions. DSSContexts allow using multiple OpenDSS instances directly, including user-managed multi-threading, without using the internal OpenDSS actors.
8+
9+
Starting April 2023, our CFFI extension modules and DSS C-API binaries moved to `dss_python_backend` and are justed consumed here.
810
'''
911

1012
import os
1113
from .patch_dss_com import patch_dss_com
12-
13-
if os.environ.get('DSS_EXTENSIONS_DEBUG', '') != '1':
14-
from ._dss_capi import ffi, lib
15-
else:
16-
import warnings
17-
warnings.warn('Environment variable DSS_EXTENSIONS_DEBUG=1 is set: loading the debug version of the DSS C-API library')
18-
from ._dss_capid import ffi, lib
19-
20-
# Ensure this is called at least once. This was moved from
21-
# CffiApiUtil so we call it as soon as the DLL/so is loaded.
22-
lib.DSS_Start(0)
14+
from dss_python_backend import ffi, lib
2315
_properties_mo = os.path.join(os.path.dirname(__file__), 'messages', 'properties-en-US.mo')
2416
if os.path.exists(_properties_mo):
2517
lib.DSS_SetPropertiesMO(_properties_mo.encode())
@@ -50,5 +42,5 @@
5042
dss = DSS = DSS_GR #: Same as DSS_GR
5143

5244

53-
__version__ = '0.13.2.dev'
45+
__version__ = '0.14.0.dev'
5446
__all__ = ['dss', 'DSS', 'DSS_GR', 'prime_api_util', 'api_util', 'DSSException', 'patch_dss_com', 'set_case_insensitive_attributes', 'enums', 'Edit']

dss_build.py

Lines changed: 0 additions & 183 deletions
This file was deleted.

0 commit comments

Comments
 (0)