Skip to content

Commit

Permalink
Merge branch '0.8-dev' into 2629_merge_0.8
Browse files Browse the repository at this point in the history
  • Loading branch information
soininen committed Apr 29, 2024
2 parents 6f80f0f + 082272a commit e3393db
Show file tree
Hide file tree
Showing 620 changed files with 19,951 additions and 18,137 deletions.
61 changes: 53 additions & 8 deletions .github/workflows/bundle.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,63 @@
# Workflow stub to build Toolbox bundles.
name: PyInstaller Bundle

on: workflow_dispatch

jobs:
bundle:
name: Bundle
strategy:
fail-fast: True
matrix:
python-version: ["3.11"]
os: [windows-latest]
runs-on: windows-latest
steps:
- name: Print notification
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: "Set up Python"
uses: actions/setup-python@v5
with:
python-version: "3.11"
cache: pip
- name: Install dependencies
run: |
echo "This workflow is stub and does not do anything meaningful."
python -m pip install --upgrade pip
python -m pip install -r requirements.txt
- name: Run tests
run: |
python -m unittest discover --verbose
- name: Install PyInstaller
run: |
python -m pip install PyInstaller
- name: Download embeddable Python
run: |
mkdir embedded-python
cd embedded-python
curl -o python.zip https://www.python.org/ftp/python/3.11.9/python-3.11.9-embed-amd64.zip
tar xf python.zip
del python.zip
- name: Build bundle
run: |
python -m PyInstaller spinetoolbox.spec -- --embedded-python=embedded-python
- name: Get Toolbox version
id: toolbox-version
shell: bash
run: |
python -c "from importlib.metadata import version; print('version=' + version('spinetoolbox'))" >> $GITHUB_OUTPUT
- name: Upload archive
uses: actions/upload-artifact@v4
with:
name: Spine Toolbox ${{ steps.toolbox-version.outputs.version }}
path: dist
if-no-files-found: error
overwrite: true
update-downloads-page:
name: Trigger Downloads page generation
needs: bundle
runs-on: ubuntu-latest
steps:
- name: Trigger workflow
run: |
curl -L \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${{ secrets.DOWNLOADS_TRIGGER_TOKEN }}" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/spine-tools/Downloads/actions/workflows/generate_readme.yml/dispatches \
-d '{"ref":"main"}'
32 changes: 21 additions & 11 deletions .github/workflows/test_runner.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
push:
paths:
- "**.py"
- ".github/workflows/*.yml"
- ".github/workflows/test_runner.yml"
- "requirements.txt"
- "pyproject.toml"
- "execution_tests/**"
Expand All @@ -21,15 +21,19 @@ jobs:
python-version: [3.8, 3.9, "3.10", 3.11]
os: [windows-latest, ubuntu-22.04]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Version from Git tags
run: git describe --tags
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: pip
cache-dependency-path: |
requirements.txt
pyproject.toml
- name: Display Python version
run:
python -c "import sys; print(sys.version)"
Expand All @@ -45,12 +49,15 @@ jobs:
python -m pip install --upgrade pip
python -m pip install -r requirements.txt
- name: List packages
run:
run:
python -m pip list
- name: Install python3 kernelspecs
run: |
python -m pip install ipykernel
python -m ipykernel install --user
- name: Install coverage
run:
python -m pip install coverage[toml]
- name: Run tests
run: |
if [ "$RUNNER_OS" != "Windows" ]; then
Expand All @@ -59,8 +66,9 @@ jobs:
coverage run -m unittest discover --verbose
shell: bash
- name: Upload coverage report to Codecov
uses: codecov/codecov-action@v3

uses: codecov/codecov-action@v4
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
execution-tests:
name: Execution tests
runs-on: ${{ matrix.os }}
Expand All @@ -69,15 +77,17 @@ jobs:
matrix:
python-version: [3.8, 3.9, "3.10", 3.11]
os: [windows-latest, ubuntu-22.04]
needs: unit-tests
# needs: unit-tests
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: pip
cache-dependency-path: |
requirements.txt
pyproject.toml
- name: Install additional packages for Linux
if: runner.os == 'Linux'
run: |
Expand Down
45 changes: 43 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,53 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
## [Unreleased]

### Added
- New context menu action (Select superclass) for entity class items in the entity tree.
- Added Tool Specification type (Python, Gams, etc.) icons on Design View.
- There is now a new filter type, Alternative filter available in Link properties.
Unlike scenario filters, the execution is not parallelized.
Instead, a successor item sees parameter values of all selected alternatives.
Because of this behavior,
alternative filters cannot be used at the same time with scenario filters.
Link properties tab has a combo box that lets one choose which filter type to use.

### Changed

#### Spine data structure

Many parts of the Spine data structure have been redesigned.

- *Entities* have replaced objects and relationships.
Zero-dimensional entities correspond to objects while multidimensional entities replace the former relationships.
Unlike relationships, the *elements* of multidimensional entities can now be other multidimensional entities.
- Simple inheritance is now supported by *superclasses*.
- Tools, features and methods have been removed.
The functionality that was previously implemented using the is_active parameter
has been replaced by *entity alternatives*.
Entity classes have a default setting for the entity alternative called *active by default*.
Database migration should automatically replace tools, features and methods
by entity alternatives and set active by default to whatever default value `is_active`
or similar parameter had.
The `is_active` parameter is not removed from entity classes but its values are.
- Note that new zero-dimensional entity classes have *active by default* set to `false` initially.
This means that the entities of those classes are hidden when using scenario filters
unless specifically shown using entity alternatives.

#### Miscellaneous changes

- "Rubber band" selection of items in Design and Graph views is now done with **left mouse button**
(no need to press Ctrl anymore). The views can be dragged around by holding the **right mouse button**.
- Spine Database Editor now remembers the configuration of the docs in each view for a specific URL. The docks
can be reset from the hamburger menu **View->Docks...->Reset docks**.
- You can now select a different Julia executable & project or Julia kernel for each Tool spec.
This overrides the global setting from Toolbox Settings.
- Headless mode now supports remote execution (see 'python -m spinetoolbox --help')
- Commit Viewer's UI has undergone some redesigning and can now handle large databases.

### Deprecated

### Removed
- Project dock widget
- Dependency on Dagster

### Fixed

Expand All @@ -30,14 +71,14 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
- On Toolbox startup, a link appears in Event log that opens Upgrade notification window
offering information about the upcoming 0.8 update.

## [0.7.2]
## [0.7.2] - 2023-12-04

### Added

- Data Connection items now support schemas in database references
- Importer Specification Editor now supports database schemas

## [0.7.1]
## [0.7.1] - 2023-10-06

### Added

Expand Down
3 changes: 3 additions & 0 deletions PyInstaller hooks/hook-datapackage.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from PyInstaller.utils.hooks import collect_data_files

datas = collect_data_files("datapackage")
3 changes: 3 additions & 0 deletions PyInstaller hooks/hook-jill.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from PyInstaller.utils.hooks import collect_data_files

datas = collect_data_files("jill", subdir="config")
5 changes: 5 additions & 0 deletions PyInstaller hooks/hook-spine_engine.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from PyInstaller.utils.hooks import collect_data_files

datas = collect_data_files(
"spine_engine", subdir="execution_managers", includes=("spine_repl.*",), include_py_files=True
)
3 changes: 3 additions & 0 deletions PyInstaller hooks/hook-spinedb_api.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from PyInstaller.utils.hooks import collect_data_files

datas = collect_data_files("spinedb_api", subdir="alembic", include_py_files=True)
6 changes: 6 additions & 0 deletions PyInstaller hooks/hook-tableschema.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from PyInstaller.utils.hooks import collect_data_files

package = "tableschema"

datas = collect_data_files(package)
datas += collect_data_files(package, subdir="profiles")
5 changes: 5 additions & 0 deletions PyInstaller hooks/hook-tabulator.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from PyInstaller.utils.hooks import collect_data_files

datas = collect_data_files("tabulator")
datas += collect_data_files("tabulator", subdir="loaders", include_py_files=True)
datas += collect_data_files("tabulator", subdir="parsers", include_py_files=True)
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ We provide three options for installing Spine Toolbox. The first two options als
the Pre-installation steps**:
- [Python/pipx](#installation-with-python-and-pipx) (we intend to make stable releases every month or so)
- [From source files](#installation-from-sources-using-git) (this is the cutting edge - and more likely to have bugs)
- [Windows executable as .zip bundle](https://spine-tools.github.io/Downloads/) (requires only unzipping the downloaded .zip file)
- [Windows installation package](#windows-64-bit-installer-package) (these are quite old - not recommended)

### Pre-installation
Expand Down Expand Up @@ -124,6 +125,7 @@ or upgrade the *development* version with

python -m pipx upgrade spinetoolbox-dev


### Installation from sources using Git

This option is for developers and other contributors who want to debug or edit Spine Toolbox source code. Once
Expand Down
Empty file added benchmarks/__init__.py
Empty file.
61 changes: 61 additions & 0 deletions benchmarks/compound_model_filter_accepts_model.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
"""
This script benchmarks CompoundModelBase.filter_accepts_model().
"""
import os
import sys

if sys.platform == "win32" and "HOMEPATH" not in os.environ:
import pathlib
os.environ["HOMEPATH"] = str(pathlib.Path(sys.executable).parent)

import time
from typing import Optional
import pyperf
from PySide6.QtCore import QSettings
from PySide6.QtWidgets import QApplication
from benchmarks.utils import StdOutLogger
from spinetoolbox.spine_db_manager import SpineDBManager
from spinetoolbox.spine_db_editor.mvcmodels.compound_models import CompoundModelBase, CompoundParameterValueModel
from spinetoolbox.spine_db_editor.mvcmodels.single_models import SingleModelBase


def call_filter_accepts_model(
loops: int, compound_model: CompoundModelBase, single_model: SingleModelBase
) -> float:
duration = 0.0
for _ in range(loops):
start = time.perf_counter()
compound_model.filter_accepts_model(single_model)
duration += time.perf_counter() - start
return duration


def run_benchmark(output_file: Optional[str]):
if not QApplication.instance():
QApplication()
db_mngr = SpineDBManager(QSettings(), parent=None)
logger = StdOutLogger()
db_map = db_mngr.get_db_map("sqlite://", logger, create=True)
entity_class, error = db_map.add_entity_class_item(name="Object")
assert error is None
db_map.add_entity_class_item(name="Subject")
relationship_class, error = db_map.add_entity_class_item(name="Object__Subject", dimension_name_list=("Object", "Subject"))
assert error is None
compound_model = CompoundParameterValueModel(None, db_mngr, db_map)
compound_model.set_filter_class_ids({db_map: {entity_class["id"]}})
single_model = SingleModelBase(compound_model, db_map, relationship_class["id"], committed=False)
runner = pyperf.Runner()
benchmark = runner.bench_time_func(
"CompoundModelBase.filter_accepts_model[filter by class ids]",
call_filter_accepts_model,
compound_model,
single_model
)
if output_file:
pyperf.add_runs(output_file, benchmark)
db_mngr.close_all_sessions()
db_mngr.deleteLater()


if __name__ == "__main__":
run_benchmark(output_file="")
Loading

0 comments on commit e3393db

Please sign in to comment.