-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #40 from dnv-opensource/feature/python-sdk
Start of python sdk, fixed with ruff, all functionality up till GmodPath implemented
- Loading branch information
Showing
36 changed files
with
3,449 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
name: Python Package | ||
|
||
on: | ||
push: | ||
branches: [main] | ||
paths: ["python/**", ".github/workflows/build-python.yml"] | ||
pull_request: | ||
branches: [main] | ||
paths: ["python/**", ".github/workflows/build-python.yml"] | ||
workflow_dispatch: | ||
|
||
env: | ||
CI_BUILD: true | ||
|
||
jobs: | ||
build: | ||
name: Build, test, and publish | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout entire repository | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: "3.x" | ||
|
||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install pytest | ||
pip install -r python/requirements.txt | ||
- name: Copy resources folder into python/vista_sdk | ||
run: | | ||
cp -r ./resources ./python/vista_sdk/resources | ||
- name: Generate VisVersion script | ||
env: | ||
PYTHONPATH: ${{ github.workspace }}/python # Set PYTHONPATH to the python directory | ||
run: | | ||
python python/vista_sdk/SourceGenerator/VisVersionsGenerator.py --resources-dir resources | ||
- name: Run tests | ||
env: | ||
PYTHONPATH: ${{ github.workspace }}/python # Ensure PYTHONPATH is set for tests as well | ||
run: | | ||
pytest python/tests | ||
- name: Move Python directory to root | ||
run: | | ||
mv python/* ./ | ||
mv python/.[!.]* ./ | ||
rm -rf python | ||
- name: Set up Python again | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: "3.x" | ||
|
||
- name: Install dependencies for building | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install setuptools wheel twine | ||
- name: Build package | ||
if: success() | ||
run: | | ||
python setup.py sdist bdist_wheel --version=${{ github.run_number }} | ||
- name: Publish package | ||
if: success() | ||
env: | ||
TWINE_USERNAME: ${{ secrets.TWINE_USERNAME }} | ||
TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD }} | ||
run: | | ||
twine upload dist/* --verbose |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -90,3 +90,8 @@ lerna-debug.log | |
# System Files | ||
.DS_Store | ||
Thumbs.db | ||
|
||
.vs | ||
|
||
# Python test files | ||
*.pytest_cache/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# Ignore compiled Python bytecode files | ||
*.pyc | ||
|
||
# Ignore Python cache directories | ||
__pycache__/ | ||
|
||
# Ignore environment-specific settings | ||
.env | ||
|
||
# Ignore editor-specific files | ||
.idea/ | ||
*.sublime-* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
recursive-include python/vista_sdk/resources * |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import os | ||
import sys | ||
|
||
ROOT_DIR = os.path.dirname(os.path.abspath(__file__)) | ||
sys.path.append(ROOT_DIR) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
cachetools==5.3.3 | ||
parameterized==0.9.0 | ||
pydantic==2.7.4 | ||
python-dotenv==1.0.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
|
||
# Consider packages in the src directory as first-party code | ||
src = ["src"] | ||
# Run ruff on Notebooks as well | ||
extend-include = ["*.ipynb"] | ||
|
||
[lint.per-file-ignores] | ||
# Allow the use of assert in tests | ||
"tests/*" = ["S101"] | ||
|
||
[lint] | ||
select = [ | ||
"F", # Pyflakes | ||
"E", # pycodestyle | ||
"W", # pycodestyle | ||
"I", # isort | ||
"ICN", # flake8-import-conventions | ||
# "D", # pydocstyle | ||
# "N", # pep8-naming | ||
# "A", # flake8-builtins | ||
"B", # flake8-bugbear | ||
"S", # flake8-bandit | ||
"SIM", # flake8-simplify | ||
# "C4", # flake8-comprehensions | ||
# "DTZ", # flake8-datetimez | ||
# "FA", # flake8-future-annotations | ||
# "ISC", # flake8-implicit-str-concat | ||
# "PT", # flake8-pytest-style | ||
# "Q", # flake8-quotes | ||
# "RET", # flake8-return | ||
# "PTH", # flake8-use-pathlib | ||
# "UP", # pyupgrade | ||
# "RUF", # Ruff-specific rules | ||
# "PD", # pandas-vet | ||
# # "FAST", # FastAPI | ||
] | ||
ignore = [ | ||
"ISC001", # may cause conflicts when used with the formatter | ||
] | ||
|
||
[lint.pydocstyle] | ||
convention = "google" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import sys | ||
|
||
from setuptools import find_packages, setup # type: ignore | ||
|
||
# Default version number | ||
|
||
|
||
version = "0.1.0-preview-" | ||
|
||
if len(sys.argv) > 1: | ||
for arg in sys.argv: | ||
if arg.startswith("--version="): | ||
version += arg.split("=")[1] | ||
sys.argv.remove(arg) | ||
|
||
setup( | ||
name="vista-sdk", | ||
version=version, | ||
author="Anders Fredriksen", | ||
author_email="[email protected]", | ||
description="SDKs and tools relating to DNVs Vessel Information Structure (VIS)," | ||
"ISO 19847, ISO 19848 standards", | ||
url="https://github.com/dnv-opensource/vista-sdk", | ||
license="MIT", | ||
packages=find_packages(), | ||
include_package_data=True, | ||
package_data={ | ||
"vista_sdk": ["resources/*"], | ||
}, | ||
install_requires=["cachetools>=5.3.3", "parameterized>=0.9.0", "pydantic>=2.7.1"], | ||
classifiers=[ | ||
"Programming Language :: Python :: 3", | ||
"License :: OSI Approved :: MIT License", | ||
"Operating System :: OS Independent", | ||
], | ||
python_requires=">=3.8", | ||
) |
Empty file.
Oops, something went wrong.