diff --git a/.github/workflows/linter.yml b/.github/workflows/linter.yml deleted file mode 100644 index 677ab11..0000000 --- a/.github/workflows/linter.yml +++ /dev/null @@ -1,30 +0,0 @@ -name: Linter - -on: [push] - -jobs: - lint: - runs-on: ubuntu-latest - strategy: - matrix: - python-version: ["3.9"] - steps: - - uses: actions/checkout@v3 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v3 - with: - python-version: ${{ matrix.python-version }} - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install ruff pylint pytest - pip install -r requirements.in - - name: Run ruff format check - run: | - ruff format --check . - - name: Run ruff lint - run: | - ruff check . - - name: Run pylint - run: | - pylint examples/ rocketserializer/ tests/ diff --git a/.github/workflows/linters.yml b/.github/workflows/linters.yml new file mode 100644 index 0000000..11c3adf --- /dev/null +++ b/.github/workflows/linters.yml @@ -0,0 +1,42 @@ +name: Linters + +on: + push: + branches: + - master + - main + pull_request: + types: [opened, synchronize, reopened, ready_for_review] + paths: + - "**.py" + - "**.ipynb" + - ".github/**" + - "pyproject.toml" + - "requirements*" + - ".pylintrc" + - "Makefile" + +jobs: + lint: + runs-on: ubuntu-latest + strategy: + matrix: + python-version: ["3.10"] + steps: + - uses: actions/checkout@main + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@main + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install ruff pylint pytest + pip install -r requirements.in + - name: Ruff (lint) + run: ruff check --output-format=github . + - name: Ruff (format) + run: ruff format --check . + - name: Pylint + run: | + pylint examples/ rocketserializer/ tests/ diff --git a/.github/workflows/test-pytest.yaml b/.github/workflows/test-pytest.yaml index c924fcc..ce77c9d 100644 --- a/.github/workflows/test-pytest.yaml +++ b/.github/workflows/test-pytest.yaml @@ -1,6 +1,10 @@ name: pytest on: + push: + branches: + - master + - main pull_request: types: [opened, synchronize, reopened, ready_for_review] paths: diff --git a/rocketserializer/openrocket_runtime.py b/rocketserializer/openrocket_runtime.py index 6f422ef..a497750 100644 --- a/rocketserializer/openrocket_runtime.py +++ b/rocketserializer/openrocket_runtime.py @@ -153,9 +153,9 @@ def __init__(self, jar_path, log_level="OFF"): ) # Get the default JVM path early so we can pass it - jvm_path = jpype.getDefaultJVMPath() # Initialize the base class with kwargs to bypass auto-discovery - super().__init__(jar=str(self.jar_path), jvm=str(jvm_path), loglevel=log_level) + super().__init__(jar_path=str(self.jar_path), log_level=log_level) + self.jar_path = Path(self.jar_path) # orhelper may overwrite it as str self.openrocket = None # for newest orhelper support self.openrocket_core = None @@ -182,7 +182,9 @@ def _block_loader(gui_module, field_name): pass def __enter__(self): - ensure_java_compatibility(self.jar_path) + # We need to guarantee that the right Java is used for the jar + # before starting JVM + ensure_java_compatibility(Path(self.jar_path)) jvm_path = jpype.getDefaultJVMPath() logger.info(