Skip to content

Commit 4492cbf

Browse files
authored
Merge pull request #18 from opatrascoiu/main
Release 1.0.0
2 parents 4c66884 + 4c3bc56 commit 4492cbf

File tree

112 files changed

+9931
-238
lines changed

Some content is hidden

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

112 files changed

+9931
-238
lines changed

.bandit.yml

+2
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,5 @@ skips:
33
- B404 # Ignore warnings about importing subprocess
44
- B603 # Ignore warnings about calling subprocess.Popen without shell=True
55
- B607 # Ignore warnings about calling subprocess.Popen without a full path to executable
6+
- B410 # Ignore parsing DOM from strings
7+
- B320 # Ignore parsing DOM from strings

.github/workflows/build.yml

+3
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ jobs:
1919
- os: windows-latest
2020
python: '3.10'
2121
toxenv: py
22+
- os: windows-latest
23+
python: '3.10'
24+
toxenv: linters
2225
runs-on: ${{ matrix.os }}
2326
steps:
2427
- uses: actions/checkout@v2

.gitignore

+7-5
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,14 @@ __pychache__
99
**/.ipynb_checkpoints
1010

1111
# CI files
12-
.eggs
13-
*egg-info
14-
dist/
15-
.coverage
1612
.venv
13+
.tox
14+
.coverage
15+
target/
16+
dist/
1717
build/
1818
sphink-doc/
1919
test-reports/
20-
.tox
20+
.eggs
21+
*egg-info
22+
*.log

.pylintrc

+1-1
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ max-nested-blocks=5
185185
[FORMAT]
186186

187187
# Maximum number of characters on a single line.
188-
max-line-length=100
188+
max-line-length=180
189189

190190
# Regexp for a line that is allowed to be longer than the limit.
191191
ignore-long-lines=^\s*(# )?<?https?://\S+>?$

README.md

+40
Original file line numberDiff line numberDiff line change
@@ -1 +1,41 @@
11
# jdmn-python-runtime
2+
3+
## How to install
4+
5+
```> pip install jdmn-python-runtime```
6+
7+
## SDLC
8+
* Check-out project
9+
* Create a venv (see below) if you do not have one already
10+
* Make changes
11+
* Run tests (see below) and fix errors
12+
* Run linters (see below) and fix errors
13+
* Make sure the test coverage is decent (e.g. around 70-75%)
14+
* Commit changes
15+
16+
### How to create a venv
17+
18+
```> ci/make_env.bat```
19+
20+
### How to run tests
21+
22+
```> tox -e py310```
23+
or
24+
```> python -m pytest --cov=jdmn tests/```
25+
26+
### How to run pylint
27+
28+
```> tox -e pylint```
29+
30+
### How to run flake8
31+
32+
```> tox -e flake8```
33+
34+
### How to build the wheel
35+
36+
```> tox -e build```
37+
38+
### How to publish the wheel
39+
40+
```twine upload --repository testpypi --skip-existing dist/* ```
41+

TODO.txt

+68
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
FEELOperatorsTest
2+
3+
Negative date time
4+
# self.assertEqual(-124649967477, self.getLib().dateTimeValue(self.makeDateAndTime("-1980-01-01T01:02:03.0004")))
5+
# self.assertEqual(-124649971137, self.getLib().dateTimeValue(self.makeDateAndTime("-1980-01-01T01:02:03+01:01")))
6+
# self.assertEqual(-124649967477, self.getLib().dateTimeValue(self.makeDateAndTime("-1980-01-01T01:02:03@Etc/UTC")))
7+
8+
Both are timedelta
9+
# self.assertFalse(self.getLib().durationIs(self.makeDuration("P0Y"), self.makeDuration("P0D")))
10+
11+
BaseFEELLibTest
12+
13+
Negative dates
14+
# year must be in the range [-999,999,999..999,999,999].
15+
# self.assertEqualsDateTime("999999999-10-11", self.getLib().date(self.getLib().date("999999999-10-11")))
16+
# self.assertEqualsDateTime("-999999999-10-11", self.getLib().date(self.getLib().date("-999999999-10-11")))
17+
# self.assertIsNone(self.getLib().date(self.getLib().date("9999999991-10-11")))
18+
# self.assertIsNone(self.getLib().date(self.getLib().date("-9999999991-10-11")))
19+
20+
21+
BaseStandardFEELLibTest
22+
23+
Overflow in duration
24+
# self.assertEqualsDateTime("P2129706043D", self.getLib().duration("P2129706043D"))
25+
26+
Missing fraction
27+
# self.assertEqualsDateTime("PT0S", self.getLib().duration("PT0.S"))
28+
29+
# self.assertEqualsNumber(self.makeNumber("-10"), self.getLib().decimal(self.makeNumber("-10"), self.makeNumber(Long.MAX_VALUE)))
30+
31+
DefaultStandardFEELLibTest
32+
33+
Rounding to 60 secs, failing validation
34+
# self.assertEqualsDateTime("P2Y9M", self.getLib().yearsAndMonthsDuration(
35+
# self.makeDateAndTime("2015-12-31T23:59:59.9999999"), self.makeDateAndTime("2018-10-01T12:32:59.111111")))
36+
37+
Z in time -> UTC
38+
# self.assertEqual("11:00:01Z", self.getLib().string(self.makeTime("11:00:01Z")))
39+
40+
Offset in mili seconds
41+
# self.assertEqual("11:59:45+02:45:55",
42+
# self.getLib().string(self.getLib().time(self.makeNumber(11), self.makeNumber(59), self.makeNumber(45), self.getLib().duration("PT2H45M55S"))))
43+
# self.assertEqual("11:59:45-02:45:55",
44+
# self.getLib().string(self.getLib().time(self.makeNumber(11), self.makeNumber(59), self.makeNumber(45), self.getLib().duration("-PT2H45M55S"))))
45+
46+
Z is not +00:00
47+
# self.assertEqual("00:00:00Z", self.getLib().string(self.getLib().time(self.makeDate("2017-08-10"))))
48+
49+
Precision is micro (6 digits) and padding
50+
# self.assertEqual("2011-12-31T10:15:30.987@Europe/Paris", self.getLib().string(self.makeDateAndTime("2011-12-31T10:15:30.987@Europe/Paris")))
51+
# self.assertEqual("2011-12-31T10:15:30.123456789@Europe/Paris", self.getLib().string(self.makeDateAndTime("2011-12-31T10:15:30.123456789@Europe/Paris")))
52+
# self.assertEqual("999999999-12-31T23:59:59.999999999@Europe/Paris", self.getLib().string(self.makeDateAndTime("999999999-12-31T23:59:59.999999999@Europe/Paris")))
53+
# self.assertEqual("-999999999-12-31T23:59:59.999999999+02:00", self.getLib().string(self.makeDateAndTime("-999999999-12-31T23:59:59.999999999+02:00")))
54+
# self.assertEqual("2017-01-01T23:59:01.123456789@Europe/Paris",
55+
# self.getLib().string(self.getLib().dateAndTime(self.makeDate("2017-01-01"), self.makeTime("23:59:01.123456789@Europe/Paris"))))
56+
# self.assertEqual("2017-09-05T09:15:30.987654321@Europe/Paris",
57+
# self.getLib().string(self.getLib().dateAndTime(self.makeDateAndTime("2017-09-05T10:20:00"), self.makeTime("09:15:30.987654321@Europe/Paris"))))
58+
# self.assertEqual("2017-09-05T09:15:30.987654321@Europe/Paris", self.getLib().string(
59+
# self.getLib().dateAndTime(self.makeDateAndTime("2017-09-05T10:20:00-01:00"), self.makeTime("09:15:30.987654321@Europe/Paris"))))
60+
# self.assertEqual("2017-09-05T09:15:30.987654321@Europe/Paris", self.getLib().string(
61+
# self.getLib().dateAndTime(self.makeDateAndTime("2017-09-05T10:20:00@Europe/Paris"), self.makeTime("09:15:30.987654321@Europe/Paris"))))
62+
63+
Both are UTC
64+
# self.assertEqual("Z", self.getLib().timezone(self.makeDateAndTime("2018-12-10T12:01:02Z")))
65+
# self.assertEqual("Etc/UTC", self.getLib().timezone(self.makeDateAndTime("2018-12-10T12:01:02@Etc/UTC")))
66+
67+
# Deviations from ISO
68+
https://www.w3.org/TR/xmlschema-2/#deviantformats

ci/ci_requirements.txt

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
-r ../requirements.txt
2+
-r ../requirements.testing.txt
3+
4+
tox>=3.25.1 # Command line driven CI frontend and development task automation tool
5+
setuptools >= 40.0.4 # build dist
6+
setuptools_scm >= 2.0.0 # build dist
7+
wheel >= 0.37.1 # build dist
8+
9+
twine >= 4.0.1

ci/make_env.bat

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
@ECHO OFF
2+
3+
set CI_PROJECT_DIR=%cd%
4+
5+
IF "%1"=="" (
6+
ECHO Usage make_env.bat PYTHON_ENV_DIR
7+
exit /b
8+
)
9+
10+
REM set PIP_INDEX_URL=https://pypi.python.org/pypi
11+
REM set PIP_TRUSTED_HOST=pypi.python.org
12+
13+
set PYTHON_ENV_DIR=%1
14+
python -m venv %PYTHON_ENV_DIR%
15+
call %PYTHON_ENV_DIR%/Scripts/activate
16+
17+
python --version
18+
pip --version
19+
python -m pip install -U pip
20+
pip install -r %CI_PROJECT_DIR%/ci/ci_requirements.txt
21+

ci_build.bat

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
call ci/make_env.bat .venv
2+
3+
tox -e py310
4+
tox -e linters
+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
1) I, Octavian Patrascoiu, certify that all work committed with the commit message
2+
"covered by: goldman_sachs-octavian_patrascoiu.dco" is copyright
3+
Goldman Sachs and that I am authorized by Goldman Sachs
4+
to contribute this code under the Apache 2.0 license.
5+
6+
2) I understand and agree all contribution including all personal
7+
information I submit with it is maintained indefinitely and may be
8+
redistributed consistent with the open source license(s) involved.
9+
10+
This certification is effective for all code contributed from 2016-01-01 to 9999-01-01.

pom.xml

+76
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
4+
Copyright 2016 Goldman Sachs.
5+
6+
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License.
7+
8+
You may obtain a copy of the License at
9+
http://www.apache.org/licenses/LICENSE-2.0
10+
11+
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an
12+
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
13+
specific language governing permissions and limitations under the License.
14+
15+
-->
16+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
17+
<modelVersion>4.0.0</modelVersion>
18+
19+
<parent>
20+
<groupId>com.goldmansachs.jdmn</groupId>
21+
<artifactId>jdmn-parent</artifactId>
22+
<version>6.2.1-SNAPSHOT</version>
23+
</parent>
24+
25+
<artifactId>jdmn-python-runtime</artifactId>
26+
<name>jDMN: Core</name>
27+
<packaging>jar</packaging>
28+
29+
<profiles>
30+
<profile>
31+
<activation>
32+
<os>
33+
<family>windows</family>
34+
</os>
35+
</activation>
36+
<build>
37+
<plugins>
38+
<plugin>
39+
<groupId>org.codehaus.mojo</groupId>
40+
<artifactId>exec-maven-plugin</artifactId>
41+
<version>3.1.0</version>
42+
<executions>
43+
<execution>
44+
<id>python-test</id>
45+
<phase>test</phase>
46+
<configuration>
47+
<executable>ci_build.bat</executable>
48+
<workingDirectory>${project.basedir}</workingDirectory>
49+
</configuration>
50+
<goals>
51+
<goal>exec</goal>
52+
</goals>
53+
</execution>
54+
<execution>
55+
<id>python-build</id>
56+
<phase>prepare-package</phase>
57+
<configuration>
58+
<executable>python</executable>
59+
<workingDirectory>${project.basedir}</workingDirectory>
60+
<arguments>
61+
<argument>setup.py</argument>
62+
<argument>sdist</argument>
63+
<argument>bdist_wheel</argument>
64+
</arguments>
65+
</configuration>
66+
<goals>
67+
<goal>exec</goal>
68+
</goals>
69+
</execution>
70+
</executions>
71+
</plugin>
72+
</plugins>
73+
</build>
74+
</profile>
75+
</profiles>
76+
</project>

pyproject.toml

+24-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,25 @@
1+
[tool.pytest.ini_options]
2+
pythonpath = [
3+
"src",
4+
"tests"
5+
]
6+
testpaths = [
7+
"tests"
8+
]
9+
norecursedirs = ".git .* *.egg* docs dist build"
10+
python_files = "*Test.py"
11+
python_functions = "check*"
12+
13+
log_level = "ERROR"
14+
log_file = "pytest.log"
15+
log_file_level = "DEBUG"
16+
log_file_format = "%(asctime)s [%(levelname)8s] %(message)s (%(filename)s:%(lineno)s)"
17+
log_file_date_format = "%Y-%m-%d %H:%M:%S"
18+
119
[build-system]
2-
requires = ["setuptools>=62", "wheel"]
3-
build-backend = "setuptools.build_meta"
20+
requires = [
21+
"setuptools >= 40.0.4",
22+
"setuptools_scm >= 2.0.0",
23+
"wheel >= 0.29.0",
24+
]
25+
build-backend = "setuptools.build_meta"

pytest.ini

-7
This file was deleted.

requirements.testing.txt

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pytest>=7.1.2 # framework that makes it easy to write small tests
2+
pytest-cov>=3.0.0 # allows generation of coverage reports with pytest
3+
4+
pylint>=2.14.5 # checks style, syntax and other useful errors
5+
flake8>=4.0.1 # checks style, syntax and other useful errors

requirements.txt

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
isodate
2+
python-dateutil
3+
tzdata
4+
lxml
5+
elementpath

setup.cfg

+17-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[metadata]
22
name = jdmn-python-runtime
3-
version = attr: com.__version__
3+
version = attr: jdmn.version.__version__
44
description = jdmn-python-runtime is a library that supports the execution of DMN
55
long_description = file: README.md
66
long_description_content_type = text/markdown
@@ -14,20 +14,33 @@ license_files =
1414
LICENSE.txt
1515
classifiers =
1616
Programming Language :: Python
17-
Programming Language :: Python :: 3.10
17+
Programming Language :: Python :: 3
18+
19+
[project.urls]
20+
"Homepage" = "https://github.com/goldmansachs/jdmn-python-runtime"
21+
"Issues" = "https://github.com/goldmansachs/jdmn-python-runtime/issues"
1822

1923
[options]
20-
packages = find:
24+
packages = find_namespace:
2125
package_dir =
2226
=src
27+
install_requires =
28+
isodate
29+
python-dateutil
30+
tzdata
31+
lxml
32+
elementpath
2333
tests_requires =
2434
# framework that makes it easy to write small tests
2535
pytest>=7.1.2
2636
# allows generation of coverage reports with pytest
2737
pytest-cov>=3.0.0
2838
# checks style, syntax and other useful errors
29-
pylint>=2.14.3
39+
pylint>=2.14.5
3040
flake8>=4.0.1
41+
# tox ci framework
42+
tox>=3.25.1
43+
include_package_data = True
3144

3245
python_requires = >=3.10
3346

0 commit comments

Comments
 (0)