From 0c4663a5fa2945a70ba41fefe6b0372cf3e47be3 Mon Sep 17 00:00:00 2001 From: iripiri Date: Mon, 31 Mar 2025 10:34:02 +0200 Subject: [PATCH] pipeline fixes (find module, json schema checking) get version (fix ModuleNotFound error), remove tags Signed-off-by: iripiri add long description which got lost in last commit Signed-off-by: iripiri updated json schema checking Signed-off-by: iripiri added blank lines (flake8) Signed-off-by: iripiri add init.py for modules to be found in tests Signed-off-by: iripiri --- .gitlab-ci.yml | 4 ---- .pre-commit-config.yaml | 6 +++--- setup.py | 22 +++++++++++++++++++--- villas/__init__.py | 0 4 files changed, 22 insertions(+), 10 deletions(-) create mode 100644 villas/__init__.py diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index d0aafc1..dc583b0 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -20,8 +20,6 @@ build:precommit: - pip3 install -r requirements-dev.txt script: - pre-commit run --all-files - tags: - - docker build:test: stage: build @@ -33,8 +31,6 @@ build:test: - pip3 install -r requirements-dev.txt script: - pytest -v - tags: - - docker build:dist: stage: build diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index a669ed8..0ab5e36 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -18,8 +18,8 @@ repos: rev: 6.0.0 hooks: - id: flake8 -- repo: https://github.com/sirosen/check-jsonschema - rev: 0.22.0 +- repo: https://github.com/python-jsonschema/check-jsonschema + rev: 0.32.1 hooks: - id: check-jsonschema name: "Check schemas" @@ -32,4 +32,4 @@ repos: language: python files: ^doc/openapi.yaml$ types: [yaml] - args: ["--schemafile", "https://raw.githubusercontent.com/OAI/OpenAPI-Specification/main/schemas/v3.1/schema.json"] + args: ["--schemafile", "https://spec.openapis.org/oas/3.1/schema/2025-02-13"] diff --git a/setup.py b/setup.py index bf1cd1b..4f5b5f2 100644 --- a/setup.py +++ b/setup.py @@ -1,14 +1,30 @@ from setuptools import setup, find_namespace_packages from glob import glob -from villas.controller import __version__ as version +import os +import re + + +def get_version(): + here = os.path.abspath(os.path.dirname(__file__)) + init_file = os.path.join(here, "villas", "controller", "__init__.py") + + with open(init_file, "r") as f: + content = f.read() + + match = re.search(r"^__version__ = ['\"]([^'\"]*)['\"]", content, re.M) + if match: + return match.group(1) + + raise RuntimeError("Version not found") + with open('README.md') as f: long_description = f.read() setup( name='villas-controller', - version=version, + version=get_version(), description='A controller/orchestration API for real-time ' 'power system simulators', long_description=long_description, @@ -20,7 +36,7 @@ keywords='simulation controller villas', classifiers=[ 'Development Status :: 3 - Alpha', - 'License :: OSI Approved :: Apache Software License' + 'License :: OSI Approved :: Apache Software License', 'Programming Language :: Python :: 3' ], packages=find_namespace_packages(include=['villas.*']), diff --git a/villas/__init__.py b/villas/__init__.py new file mode 100644 index 0000000..e69de29