Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/changelog_check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
python-version: '3.13'

- name: Install Python libraries
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/documentation_builder.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
python-version: "3.13"

- name: Install Python libraries
run: |
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/validation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
python-version: '3.13'

- name: Install Formatting
run: |
Expand All @@ -42,7 +42,7 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python: ["3.10", "3.11", "3.12", "3.13"]
python: ["3.10", "3.11", "3.12", "3.13", "3.14"]
runs-on: ${{ matrix.os }}
timeout-minutes: 30
steps:
Expand Down Expand Up @@ -74,7 +74,7 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest]
python: ["3.11"]
python: ["3.13"]
runs-on: ${{ matrix.os }}
timeout-minutes: 30
steps:
Expand Down
2 changes: 1 addition & 1 deletion docs/changelogs/1.2.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
:octicons-issue-opened-24: Issue Ref | :fontawesome-solid-thumbtack: Summary | :material-message-text: Description
-|-|-
[No ref] | Adding flag to detect OneCode Cloud env | Useful flag to handle local vs cloud env when running code using display (e.g. plot show).
[No Ref] | Python version 3.13 now supported | All Python versions ranging from 3.10 through 3.13 are now supported.
[No Ref] | Python version 3.13 and 3.14 are now supported | All Python versions ranging from 3.10 through 3.14 are now supported.
[No Ref] | No longer checking modules at startup | `ONECODE_FLAG_CHECK_MODULES` not set to False by default as verbosity is annoying, especially combined with #45.
[No Ref] | Avoid warnings on duplicate files with `onecode-zip` | `onecode-zip` checks first if file already added to the archive (in case of duplicates entry in MANIFEST).

Expand Down
2 changes: 1 addition & 1 deletion onecode/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# SPDX-FileCopyrightText: 2023-2024 DeepLime <contact@deeplime.io>
# SPDX-License-Identifier: MIT

__version__ = "1.2.0.dev"
__version__ = "1.2.0"


from .base import *
Expand Down
3 changes: 1 addition & 2 deletions onecode/cli/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
from typing import Dict, List, Optional

import pydash
from astunparse import unparse
from InquirerPy.base.control import Choice
from pycg.pycg import CallGraphGenerator
from pycg.utils.constants import CALL_GRAPH_OP
Expand Down Expand Up @@ -178,7 +177,7 @@ def extract_calls(
code.body[0].value.func = ast.parse(fn['normed'])
calls.append({
"func": fn['normed'],
"loc": unparse(code).strip()
"loc": ast.unparse(code).strip()
})
else:
if verbose:
Expand Down
7 changes: 3 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "onecode"
version = "1.2.0.dev"
version = "1.2.0"
description = "Python skeleton and library for OneCode projects"
readme = "README.md"
authors = ["DeepLime <contact@deeplime.io>"]
Expand All @@ -23,7 +23,7 @@ classifiers = [
]

[tool.poetry.dependencies]
python = ">=3.8, <3.14"
python = ">=3.8, <3.15"
'flufl.lock' = ">=7.1.1,<9"
pandas = ">=1.4.0,<3"
pydash = ">=5.1.0,<8"
Expand All @@ -33,9 +33,8 @@ typeguard = ">=3,<5"
requirements-parser = ">=0.10.2,<1"

# cli
astunparse = ">=1.6.3,<2"
inquirerpy = ">=0.3.3,<1"
onecode-pycg = ">=0.0.7,<1"
onecode-pycg = ">=0.0.7,<2"
yaspin = ">=2.1.0,<4"

# docs
Expand Down
46 changes: 35 additions & 11 deletions tests/emulations/base/test_run_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,18 +73,30 @@ def test_output_multiprocess():
flow_dir = os.path.join(tmp, flow_folder)
flow_data = os.path.join(flow_dir, 'data')

with open(os.path.join(flow_dir, 'flows', f'{flow_id}.py'), 'a') as f:
with open(os.path.join(flow_dir, 'flows', 'utils.py'), 'w') as f:
f.write("""
import onecode


def write_output(data, flow_name):
onecode.Project().current_flow = flow_name
onecode.Project().write_output({data: '0'})
""")

with open(os.path.join(flow_dir, 'flows', f'{flow_id}.py'), 'w') as f:
f.write("""
from multiprocessing import Process
from multiprocessing import Process
from flows.utils import write_output
import onecode

def write_output(data):
onecode.Project().write_output({data: '0'})

def run():
names = ['b', 'a', 'c'] * 10
procs = []

parent_flow = onecode.Project().current_flow

for name in names:
proc = Process(target=write_output, args=(name,))
proc = Process(target=write_output, args=(name, parent_flow))
procs.append(proc)
proc.start()

Expand Down Expand Up @@ -119,18 +131,30 @@ def test_manifest_cleaning():
flow_dir = os.path.join(tmp, flow_folder)
flow_data = os.path.join(flow_dir, 'data')

with open(os.path.join(flow_dir, 'flows', f'{flow_id}.py'), 'a') as f:
with open(os.path.join(flow_dir, 'flows', 'utils.py'), 'w') as f:
f.write("""
from multiprocessing import Process
import onecode


def write_output(data):
onecode.Project().write_output({data: '0'})
def write_output(data, flow_name):
onecode.Project().current_flow = flow_name
onecode.Project().write_output({data: '0'})
""")

with open(os.path.join(flow_dir, 'flows', f'{flow_id}.py'), 'w') as f:
f.write("""
from multiprocessing import Process
from flows.utils import write_output
import onecode


def run():
names = ['b', 'a', 'c'] * 10
procs = []
parent_flow = onecode.Project().current_flow

for name in names:
proc = Process(target=write_output, args=(name,))
proc = Process(target=write_output, args=(name, parent_flow))
procs.append(proc)
proc.start()

Expand Down
16 changes: 13 additions & 3 deletions tests/unit/elements/test_dropdown.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import sys

import pytest

from onecode import Dropdown, Mode, Project
Expand Down Expand Up @@ -100,7 +102,11 @@ def test_execute_invalid_single_dropdown_single_choice():
with pytest.raises(TypeError) as excinfo:
widget()

assert "Invalid value A, expected: list(typing.Union[str, int, float])" == str(excinfo.value)
if sys.version_info < (3, 14):
assert "Invalid value A, expected: list(typing.Union[str, int, float])" \
== str(excinfo.value)
else:
assert "Invalid value A, expected: list(str | int | float)" == str(excinfo.value)


def test_execute_invalid_single_dropdown_multiple_choice():
Expand All @@ -117,8 +123,12 @@ def test_execute_invalid_single_dropdown_multiple_choice():
with pytest.raises(TypeError) as excinfo:
widget()

assert "Invalid value type for each element of ['A', 'C'], expected: " \
"typing.List[typing.Union[str, int, float]]" == str(excinfo.value)
if sys.version_info < (3, 14):
assert "Invalid value type for each element of ['A', 'C'], expected: " \
"typing.List[typing.Union[str, int, float]]" == str(excinfo.value)
else:
assert "Invalid value type for each element of ['A', 'C'], expected: " \
"typing.List[str | int | float]" == str(excinfo.value)


def text_execute_invalid_optional_dropdown():
Expand Down
15 changes: 12 additions & 3 deletions tests/unit/elements/test_slider.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import sys

import pytest

from onecode import Mode, Project, Slider
Expand Down Expand Up @@ -106,7 +108,10 @@ def test_execute_invalid_single_slider():
with pytest.raises(TypeError) as excinfo:
widget()

assert "Invalid value 0.6, expected: list(typing.Union[float, int])" == str(excinfo.value)
if sys.version_info < (3, 14):
assert "Invalid value 0.6, expected: list(typing.Union[float, int])" == str(excinfo.value)
else:
assert "Invalid value 0.6, expected: list(float | int)" == str(excinfo.value)


def test_execute_invalid_multiple_slider():
Expand All @@ -122,8 +127,12 @@ def test_execute_invalid_multiple_slider():
with pytest.raises(TypeError) as excinfo:
widget()

assert "Invalid value type for [0.6, 0.3, 0.4], expected: typing.Union[float, int]" == \
str(excinfo.value)
if sys.version_info < (3, 14):
assert "Invalid value type for [0.6, 0.3, 0.4], expected: typing.Union[float, int]" == \
str(excinfo.value)
else:
assert "Invalid value type for [0.6, 0.3, 0.4], expected: float | int" == \
str(excinfo.value)


def test_execute_invalid_min_max_single_slider():
Expand Down