Compare commits
15 Commits
948d3a4032
...
master
Author | SHA1 | Date | |
---|---|---|---|
aca95cc018 | |||
002e00f959 | |||
|
424e989681 | ||
|
67ddec8e0d | ||
|
2ea0a9c7fb | ||
|
89aaa231fb | ||
|
cdca3cc508 | ||
|
17820bfb9b | ||
|
e417519ef8 | ||
|
5a23c065c5 | ||
|
10bf55f62c | ||
|
58645da74f | ||
|
38292af470 | ||
|
bfde38ea42 | ||
|
b94dbd9ed3 |
170
.drone.yml
170
.drone.yml
@@ -1,170 +0,0 @@
|
|||||||
---
|
|
||||||
kind: pipeline
|
|
||||||
type: exec
|
|
||||||
name: CentOS7_test
|
|
||||||
|
|
||||||
platform:
|
|
||||||
os: linux
|
|
||||||
arch: amd64
|
|
||||||
variant: CentOS7
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Run unit test
|
|
||||||
environment:
|
|
||||||
PYTHONPATH: .
|
|
||||||
commands:
|
|
||||||
- python3 setup.py test
|
|
||||||
|
|
||||||
---
|
|
||||||
kind: pipeline
|
|
||||||
type: exec
|
|
||||||
name: CentOS8_test
|
|
||||||
|
|
||||||
platform:
|
|
||||||
os: linux
|
|
||||||
arch: amd64
|
|
||||||
variant: CentOS8
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Run unit test
|
|
||||||
environment:
|
|
||||||
PYTHONPATH: .
|
|
||||||
commands:
|
|
||||||
- python3 setup.py test
|
|
||||||
|
|
||||||
---
|
|
||||||
kind: pipeline
|
|
||||||
type: exec
|
|
||||||
name: Ubuntu1804_test
|
|
||||||
|
|
||||||
platform:
|
|
||||||
os: linux
|
|
||||||
arch: amd64
|
|
||||||
variant: Ubuntu1804
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Run unit test
|
|
||||||
environment:
|
|
||||||
PYTHONPATH: .
|
|
||||||
commands:
|
|
||||||
- python3 setup.py test
|
|
||||||
|
|
||||||
---
|
|
||||||
kind: pipeline
|
|
||||||
type: exec
|
|
||||||
name: Fedora_test
|
|
||||||
|
|
||||||
platform:
|
|
||||||
os: linux
|
|
||||||
arch: amd64
|
|
||||||
variant: Fedora
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Run unit test
|
|
||||||
environment:
|
|
||||||
PYTHONPATH: .
|
|
||||||
commands:
|
|
||||||
- python3 setup.py test
|
|
||||||
|
|
||||||
---
|
|
||||||
kind: pipeline
|
|
||||||
type: docker
|
|
||||||
name: docker_python:3.6
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Run unit test
|
|
||||||
image: python:3.6
|
|
||||||
environment:
|
|
||||||
PYTHONPATH: .
|
|
||||||
commands:
|
|
||||||
- pip install python-dateutil flask
|
|
||||||
- python setup.py test
|
|
||||||
|
|
||||||
---
|
|
||||||
kind: pipeline
|
|
||||||
type: docker
|
|
||||||
name: docker_python:latest
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Run unit test
|
|
||||||
image: python:latest
|
|
||||||
environment:
|
|
||||||
PYTHONPATH: .
|
|
||||||
commands:
|
|
||||||
- pip install python-dateutil flask
|
|
||||||
- python setup.py test
|
|
||||||
|
|
||||||
---
|
|
||||||
kind: pipeline
|
|
||||||
type: exec
|
|
||||||
name: Build
|
|
||||||
|
|
||||||
platform:
|
|
||||||
os: linux
|
|
||||||
arch: amd64
|
|
||||||
vatiant: Fedora
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Build package files
|
|
||||||
commands:
|
|
||||||
- python setup.py sdist
|
|
||||||
- name: Versie toevoegen aan download
|
|
||||||
environment:
|
|
||||||
DOWNLOADDIR: /usr/share/nginx/html/download/python/ddoperapi
|
|
||||||
commands:
|
|
||||||
- mkdir -p "$${DOWNLOADDIR}"
|
|
||||||
- cd dist
|
|
||||||
- |
|
|
||||||
for f in *
|
|
||||||
do
|
|
||||||
if [ -f "$${DOWNLOADDIR}/$${f}" ]
|
|
||||||
then
|
|
||||||
echo version error
|
|
||||||
exit 1
|
|
||||||
else
|
|
||||||
cp "$${f}" "$${DOWNLOADDIR}"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
- ls -l "$${DOWNLOADDIR}"
|
|
||||||
when:
|
|
||||||
branch:
|
|
||||||
- master
|
|
||||||
|
|
||||||
depends_on:
|
|
||||||
- CentOS7_test
|
|
||||||
- CentOS8_test
|
|
||||||
- Ubuntu1804_test
|
|
||||||
- Fedora_test
|
|
||||||
- docker_python:latest
|
|
||||||
- docker_python:3.6
|
|
||||||
|
|
||||||
---
|
|
||||||
kind: pipeline
|
|
||||||
type: docker
|
|
||||||
name: installCheck
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: install Check
|
|
||||||
image: python:3.6
|
|
||||||
# Make sure we run the pip installed version
|
|
||||||
commands:
|
|
||||||
- rm -rf ddOperApi
|
|
||||||
when:
|
|
||||||
branch:
|
|
||||||
- master
|
|
||||||
|
|
||||||
depends_on:
|
|
||||||
- Build
|
|
||||||
|
|
||||||
#
|
|
||||||
# todo: Uitzoeken
|
|
||||||
#
|
|
||||||
# - >
|
|
||||||
# pip install --extra-index-url
|
|
||||||
# https://marceln.org/download/python ddOperApi
|
|
||||||
# - python -c "import lmwsip"
|
|
||||||
# - python -c "import lmwsip; print(lmwsip.__version__)"
|
|
||||||
# - >
|
|
||||||
# [ $(python -c "import lmwsip; print(lmwsip.__version__)") =
|
|
||||||
# $(python setup.py --version) ]
|
|
||||||
# - python -m unittest -v lmwsip.tests
|
|
91
.gitea/workflows/build.yml
Normal file
91
.gitea/workflows/build.yml
Normal file
@@ -0,0 +1,91 @@
|
|||||||
|
---
|
||||||
|
name: build
|
||||||
|
on:
|
||||||
|
- push
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
testFedoraBuilder:
|
||||||
|
runs-on: fedora-builder
|
||||||
|
steps:
|
||||||
|
- name: Check out repository code
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
- name: Test
|
||||||
|
run: tox
|
||||||
|
testRockylinux8:
|
||||||
|
runs-on: rockylinux8
|
||||||
|
steps:
|
||||||
|
- name: add ca
|
||||||
|
run: |
|
||||||
|
curl -o /etc/pki/ca-trust/source/anchors/ca-marceln.org.crt \
|
||||||
|
https://marceln.org/ca-marceln.org.crt
|
||||||
|
update-ca-trust
|
||||||
|
- name: Update yum conf
|
||||||
|
run: "/usr/bin/sed -i -e \
|
||||||
|
's@#baseurl=http://dl.rockylinux.org/$contentdir@\
|
||||||
|
baseurl=https://rock64.fritz.box/nluug/os/Linux/distr/rocky@' \
|
||||||
|
-e 's@^mirrorlist=https@#mirrorlist=https@' \
|
||||||
|
$(grep -l '#baseurl=http://dl.rockylinux.org/$contentdir' \
|
||||||
|
/etc/yum.repos.d/*)"
|
||||||
|
- name: Setup
|
||||||
|
run: |
|
||||||
|
dnf install -y git nodejs \
|
||||||
|
python36 python38 python39 python3.11 python3.12 \
|
||||||
|
python3.11-pip python3.12-pip
|
||||||
|
pip-3 install tox
|
||||||
|
- name: Check out repository code
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
- name: Test
|
||||||
|
run: tox -e py36,py38,py39,py311
|
||||||
|
testRockylinux9:
|
||||||
|
runs-on: rockylinux9
|
||||||
|
steps:
|
||||||
|
- name: add ca
|
||||||
|
run: |
|
||||||
|
curl -o /etc/pki/ca-trust/source/anchors/ca-marceln.org.crt \
|
||||||
|
https://marceln.org/ca-marceln.org.crt
|
||||||
|
update-ca-trust
|
||||||
|
- name: Update yum conf
|
||||||
|
run: "/usr/bin/sed -i -e \
|
||||||
|
's@#baseurl=http://dl.rockylinux.org/$contentdir@\
|
||||||
|
baseurl=https://rock64.fritz.box/nluug/os/Linux/distr/rocky@' \
|
||||||
|
-e 's@^mirrorlist=https@#mirrorlist=https@' \
|
||||||
|
$(grep -l '#baseurl=http://dl.rockylinux.org/$contentdir' \
|
||||||
|
/etc/yum.repos.d/*)"
|
||||||
|
- name: Setup
|
||||||
|
run: |
|
||||||
|
dnf install -y git nodejs \
|
||||||
|
python39 python3.11 python3.12 \
|
||||||
|
python3-pip python3.11-pip python3.12-pip
|
||||||
|
pip-3 install tox
|
||||||
|
- name: Check out repository code
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
- name: Test
|
||||||
|
run: tox -e py39,py311,py312
|
||||||
|
testUbuntu22:
|
||||||
|
runs-on: ubuntu-22.04
|
||||||
|
steps:
|
||||||
|
- name: Setup
|
||||||
|
run: |
|
||||||
|
apt update
|
||||||
|
apt install -y git nodejs python3 python3-pip tox
|
||||||
|
pip
|
||||||
|
- name: Check out repository code
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
- name: Test
|
||||||
|
run: tox -e py310
|
||||||
|
buildAndPublish:
|
||||||
|
needs: [testFedoraBuilder, testRocky8, testRocky9, testUbuntu22]
|
||||||
|
runs-on: fedora-builder
|
||||||
|
env:
|
||||||
|
TWINE_USERNAME: $(( secrets.PYPI_USER ))
|
||||||
|
TWINE_PASSWORD: $(( secrets.PYPI_PASSWORD ))
|
||||||
|
if: gitea.ref_name == 'main'
|
||||||
|
steps:
|
||||||
|
- name: Check out repository code
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
- name: Build
|
||||||
|
run: python3 -m build
|
||||||
|
- name: Test
|
||||||
|
run: tox
|
||||||
|
- name: Upload naar pypi
|
||||||
|
run: python3 -m twine upload dist/*
|
1
.gitignore
vendored
1
.gitignore
vendored
@@ -7,3 +7,4 @@ PKG-INFO
|
|||||||
requires.txt
|
requires.txt
|
||||||
SOURCES.txt
|
SOURCES.txt
|
||||||
top_level.txt
|
top_level.txt
|
||||||
|
.tox
|
||||||
|
21
LICENSE
21
LICENSE
@@ -1 +1,20 @@
|
|||||||
TODO
|
Copyright (c) 2022 Rijkswaterstaat
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
||||||
|
|
||||||
|
31
README.md
31
README.md
@@ -9,14 +9,14 @@ gebruikt voor het opvragen van:
|
|||||||
* Verwachtingen
|
* Verwachtingen
|
||||||
* Astronomisch getij
|
* Astronomisch getij
|
||||||
|
|
||||||
De digitale delta api is beschikbaar via:
|
De operationele digitale delta api is beschikbaar via:
|
||||||
|
|
||||||
* https://ddapi.rws.nl/dd-oper/2.0
|
* https://ddapi.rws.nl/dd-oper/2.0
|
||||||
|
|
||||||
De authenticatie op deze url is geregeld via PKI overheidscertificaten.
|
De authenticatie op deze url is geregeld via PKI overheidscertificaten.
|
||||||
Zonder PKI overheidscertificaat is de api niet toegankelijk.
|
Zonder PKI overheidscertificaat is de api niet toegankelijk.
|
||||||
|
|
||||||
Deze git repository bevat een python module om de dd-oper api te benaderen
|
Deze git repository bevat een python module om de dd oper api te benaderen
|
||||||
inclusief:
|
inclusief:
|
||||||
|
|
||||||
* Autenticatie via certificaten.
|
* Autenticatie via certificaten.
|
||||||
@@ -24,34 +24,29 @@ inclusief:
|
|||||||
|
|
||||||
## Installatie
|
## Installatie
|
||||||
|
|
||||||
De package is op dit moment nog niet beschikbaar via [PyPI](https://pypi.org/).
|
|
||||||
De package is beschikbaar via https://marceln.org/download/python
|
|
||||||
|
|
||||||
Het installeren gaat via:
|
Het installeren gaat via:
|
||||||
```
|
```
|
||||||
pip install -i https://marceln.org/download/python ddOperApi
|
pip ddOperApi
|
||||||
```
|
```
|
||||||
|
|
||||||
## De inhoud van de git repository
|
## De inhoud van de git repository
|
||||||
|
|
||||||
TODO: Aanpassen aan module
|
* ddOperApi/: De module
|
||||||
|
* ddOperApi/tests: De module test code
|
||||||
|
* githooks: Standaard hooks voor een locale zelf test
|
||||||
|
* demo/DD-API-Oper demo.ipynb: [Jupyter notebook](https://jupyter.org/)
|
||||||
|
demo file
|
||||||
|
|
||||||
* ddapioper.py: Python module
|
### ddOperApi
|
||||||
* test-ddapi: Een klein voorbeeld en test programma voor de module
|
|
||||||
* DD-API-Oper demo.ipynb: Een [Jupyter notebook](met een demo).
|
|
||||||
|
|
||||||
### dd-oper-api
|
|
||||||
|
|
||||||
Deze module bevat documentatie. Deze is op te vragen door de module te
|
Deze module bevat documentatie. Deze is op te vragen door de module te
|
||||||
laden en vervolgens via de python hulp functie heb je toegang tot de
|
laden en vervolgens via de python hulp functie heb je toegang tot de
|
||||||
documentatie.
|
documentatie.
|
||||||
|
|
||||||
### test-ddapi
|
### ddOperApi/tests
|
||||||
|
|
||||||
Een werkend voorbeeld en test programma voor de api.
|
Bevat een flask webserver waartegen de module getest kan worden en
|
||||||
|
python unittest code.
|
||||||
Wel moeten de paden van het certificaat en de bijbehorende private key
|
|
||||||
nog ingevuld worden. Er staat twee keer "<TODO>" in de code.
|
|
||||||
|
|
||||||
### DD-API-Oper demo.ipynb
|
### DD-API-Oper demo.ipynb
|
||||||
|
|
||||||
@@ -85,4 +80,4 @@ stabiele code!
|
|||||||
|
|
||||||
## Vragen en/of uitbreidingen.
|
## Vragen en/of uitbreidingen.
|
||||||
|
|
||||||
Vragen en of uitbreidingen kunnen gemaild worden naar ddoperapi@pion.xs4all.nl.
|
Vragen en of uitbreidingen kunnen gemaild worden naar ddoperapi(a)marceln(.)org.
|
||||||
|
@@ -1,7 +1,10 @@
|
|||||||
#!/bin/sh -e
|
#!/bin/sh -e
|
||||||
VERSION=$(grep version setup.py | sed -e 's/.*="//' -e 's/",//')
|
|
||||||
sed -i "s/^__version__ = .*/__version__ = '${VERSION}'/" ddOperApi/__init__.py
|
|
||||||
git add ddOperApi/__init__.py
|
|
||||||
|
|
||||||
python setup.py test
|
yamllint .gitea/workflows/build.yml
|
||||||
yamllint .drone.yml
|
|
||||||
|
VERSION=$(python setup.py --version)
|
||||||
|
sed -i "s/^__version__ = .*/__version__ = '${VERSION}'/" src/ddOperApi/__init__.py
|
||||||
|
|
||||||
|
git add src/ddOperApi/__init__.py
|
||||||
|
|
||||||
|
tox
|
||||||
|
28
setup.cfg
Normal file
28
setup.cfg
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
[metadata]
|
||||||
|
name = ddOperApi
|
||||||
|
version = 0.9.3
|
||||||
|
author = Marcel Nijenhof
|
||||||
|
author_email = pypi@marceln.org
|
||||||
|
description = Interface for the dd-oper protocol
|
||||||
|
long_description = file: README.md
|
||||||
|
long_description_content_type = text/markdown
|
||||||
|
url = https://git.marceln.org/marceln/ddOperApi
|
||||||
|
classifiers =
|
||||||
|
Programming Language :: Python :: 3
|
||||||
|
License :: OSI Approved :: MIT License
|
||||||
|
Operating System :: OS Independent
|
||||||
|
Development Status :: 4 - Beta
|
||||||
|
|
||||||
|
[options]
|
||||||
|
package_dir =
|
||||||
|
= src
|
||||||
|
install_requires =
|
||||||
|
python-dateutil
|
||||||
|
requests
|
||||||
|
numpy
|
||||||
|
pyopenssl
|
||||||
|
packages = find:
|
||||||
|
python_requires = >= 3.6
|
||||||
|
|
||||||
|
[options.packages.find]
|
||||||
|
where = src
|
31
setup.py
31
setup.py
@@ -1,29 +1,4 @@
|
|||||||
import setuptools
|
from setuptools import setup
|
||||||
|
|
||||||
with open("README.md", "r") as fh:
|
if __name__ == "__main__":
|
||||||
long_description = fh.read()
|
setup()
|
||||||
|
|
||||||
setuptools.setup(
|
|
||||||
name="ddOperApi", # Replace with your own username
|
|
||||||
version="0.1.0",
|
|
||||||
author="Marcel Nijenhof",
|
|
||||||
author_email="pip@pion.xs4all.nl",
|
|
||||||
description="Interface for dd-oper protocol",
|
|
||||||
long_description=long_description,
|
|
||||||
long_description_content_type="text/markdown",
|
|
||||||
url="https://marceln.org/git/Werk/lmwsip",
|
|
||||||
packages=setuptools.find_packages(),
|
|
||||||
install_requires=[
|
|
||||||
'python-dateutil',
|
|
||||||
'requests',
|
|
||||||
'numpy',
|
|
||||||
'pyopenssl'
|
|
||||||
],
|
|
||||||
classifiers=[
|
|
||||||
"Programming Language :: Python :: 3",
|
|
||||||
"License :: TODO",
|
|
||||||
"Operating System :: OS Independent",
|
|
||||||
"Topic :: dd-oper api"
|
|
||||||
],
|
|
||||||
python_requires='>=3.6',
|
|
||||||
)
|
|
||||||
|
@@ -20,7 +20,7 @@ from datetime import datetime, timedelta
|
|||||||
from dateutil.parser import parse
|
from dateutil.parser import parse
|
||||||
|
|
||||||
""" Version info changed by git hook """
|
""" Version info changed by git hook """
|
||||||
__version__ = '0.1.0'
|
__version__ = '0.9.3'
|
||||||
|
|
||||||
class ddOperApi:
|
class ddOperApi:
|
||||||
"""
|
"""
|
@@ -3,7 +3,7 @@
|
|||||||
import unittest
|
import unittest
|
||||||
import ddOperApi
|
import ddOperApi
|
||||||
from time import sleep
|
from time import sleep
|
||||||
from ddOperApi.tests.testServer import forkTestServer, stopTestServer
|
from testServer import forkTestServer, stopTestServer
|
||||||
|
|
||||||
|
|
||||||
class ddOperApiTest(unittest.TestCase):
|
class ddOperApiTest(unittest.TestCase):
|
Reference in New Issue
Block a user