Skip to content
Merged

Dev #26

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
14 changes: 4 additions & 10 deletions .github/actions/install_package/action.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: install_package
description: Install a package from local poetry
description: Install a package from local pyproject.toml
inputs:
python_version:
description: "Python version to install"
Expand All @@ -16,21 +16,15 @@ runs:
python-version: ${{ inputs.python_version }}
allow-prereleases: true

- name: Install Poetry
- name: Install UV
shell: bash
run: |
python -m pip install --upgrade pip
pip install poetry
pip install uv
echo "python-version=${{ steps.setup_python.outputs.python-version }}" >> "$GITHUB_OUTPUT"

- name: Setup a local virtual environment (if no poetry.toml file)
shell: bash
run: |
poetry config virtualenvs.create true --local
poetry config virtualenvs.in-project true --local

- name: Install Dependencies
shell: bash
run: |
poetry install --no-interaction
uv sync
echo "python-version=${{ steps.setup_python.outputs.python-version }}" >> "$GITHUB_OUTPUT"
2 changes: 1 addition & 1 deletion .github/workflows/py_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ jobs:
python_version: ${{ matrix.python-version }}

- name: Run Tests
run: poetry run pytest
run: uv run pytest
8 changes: 4 additions & 4 deletions .github/workflows/version_publish_main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,21 +26,21 @@ jobs:
python_version: 3.12

- name: Run Tests
run: poetry run pytest
run: uv run pytest

- name: Get current package version
shell: bash
id: get_version
run: |
CURRENT_VERSION=$(poetry version --short)
CURRENT_VERSION=$(uvx poetry version --short)
echo "CURRENT_VERSION=${CURRENT_VERSION}" >> $GITHUB_ENV
echo "CURRENT_VERSION=${CURRENT_VERSION}"

- name: Get latest version from PyPI
shell: bash
id: get_pypi_version
run: |
PACKAGE_NAME=$(poetry version | awk '{print $1}')
PACKAGE_NAME=$(uvx poetry version | awk '{print $1}')
LATEST_VERSION=$(curl -s https://pypi.org/pypi/$PACKAGE_NAME/json | jq -r .info.version)
echo "LATEST_VERSION=${LATEST_VERSION}" >> $GITHUB_ENV
echo "LATEST_VERSION=${LATEST_VERSION}"
Expand All @@ -56,7 +56,7 @@ jobs:
fi

- name: Package project
run: poetry build
run: uv build

- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
Expand Down
17 changes: 7 additions & 10 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,16 @@ repos:
- id: no-commit-to-branch
args: ["--branch", "main", "--branch", "master", "--branch", "test"]

- repo: https://github.com/python-poetry/poetry
rev: "2.0.1" # add version here
- repo: https://github.com/astral-sh/uv-pre-commit
# uv version.
rev: "0.6.14"
hooks:
- id: poetry-check
verbose: true
- id: poetry-lock
verbose: true
- id: poetry-install
verbose: true
# Update the uv lockfile
- id: uv-lock

- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.9.1
rev: v0.11.6
hooks:
# Run the linter.
- id: ruff
Expand All @@ -29,7 +26,7 @@ repos:
- id: ruff-format

- repo: https://github.com/pycqa/flake8
rev: 7.1.1 # pick a git hash / tag to point to
rev: 7.2.0 # pick a git hash / tag to point to
hooks:
- id: flake8
args: ["--config=.flake8"]
14 changes: 14 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
graft src
graft tests

global-exclude __pycache__/*
prune __pycache__
prune */__pycache__
recursive-exclude */__pycache__ *

global-exclude .venv/*
global-exclude .venv/**/*
prune .venv
prune */.venv
recursive-exclude .venv *
recursive-exclude */.venv *
1,785 changes: 0 additions & 1,785 deletions poetry.lock

This file was deleted.

54 changes: 30 additions & 24 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,39 +1,45 @@
[project]
name = "funcnodes-basic"
version = "0.2.1"
version = "0.2.2"
description = "Basic functionalities for funcnodes"
authors = [
{name = "Julian Kimmig", email = "julian.kimmig@linkdlab.de>"}
]
readme = "README.md"
license = "AGPL-3.0"
classifiers = [
"License :: OSI Approved :: GNU Affero General Public License v3 or later (AGPLv3+)",
]

classifiers = [ "License :: OSI Approved :: GNU Affero General Public License v3 or later (AGPLv3+)",]
requires-python = ">=3.11"
dependencies = [
"funcnodes-core>=0.3.9",
"funcnodes",
]
"funcnodes-core>=0.3.9",
"funcnodes",
]
authors = [{name = "Julian Kimmig", email = "julian.kimmig@linkdlab.de"}]

[project.urls]
homepage = "https://github.com/Linkdlab/funcnodes_basic"
source = "https://github.com/Linkdlab/funcnodes_basic"
tracker = "https://github.com/Linkdlab/funcnodes_basic/issues"
download = "https://pypi.org/project/funcnodes-basic/#files"

[dependency-groups]
dev = [
"funcnodes-module>=0.2.9",
"pre-commit>=4.1.0",
"pytest>=8.3.4",
"pytest-funcnodes>=0.1.0",
]

[build-system]
requires = [ "setuptools>=42",]
build-backend = "setuptools.build_meta"

[tool.poetry.group.dev.dependencies]
pytest = "*"
pre-commit = "*"
funcnodes-module = "^0.1.19"
[project.license]
text = "AGPL-3.0"

[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"
[project.urls]
homepage = "https://github.com/Linkdlab/funcnodes_basic"
source = "https://github.com/Linkdlab/funcnodes_basic"
tracker = "https://github.com/Linkdlab/funcnodes_basic/issues"
download = "https://pypi.org/project/funcnodes-basic/#files"

[project.entry-points."funcnodes.module"]
module = "funcnodes_basic"
shelf = "funcnodes_basic:NODE_SHELF"

[tool.setuptools.package-dir]
"" = "src"


[tool.setuptools.packages.find]
where = [ "src",]
3 changes: 3 additions & 0 deletions pytest.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[pytest]
pythonpath = src
testpaths = tests
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,15 @@
from .lists import NODE_SHELF as lists_shelf
from .strings import NODE_SHELF as strings_shelf
from .dicts import NODE_SHELF as dicts_shelf
from .input import NODE_SHELF as input_shelf


__version__ = "0.2.1"
__version__ = "0.2.2"

NODE_SHELF = Shelf(
nodes=[],
subshelves=[
input_shelf,
lists_shelf,
dicts_shelf,
strings_shelf,
Expand Down
File renamed without changes.
84 changes: 84 additions & 0 deletions src/funcnodes_basic/input.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
from typing import Union
import funcnodes_core as fn


@fn.NodeDecorator(
node_id="input.any",
node_name="Input",
description="Any input",
outputs=[
{"name": "out"},
],
)
def any_input(input: Union[str, float, int, bool]) -> str:
return input


@fn.NodeDecorator(
node_id="input.str",
node_name="String Input",
description="Input a string",
outputs=[
{"name": "string"},
],
)
def str_input(input: str) -> str:
return str(input)


@fn.NodeDecorator(
node_id="input.int",
node_name="Integer Input",
description="Input an integer",
outputs=[
{"name": "integer"},
],
)
def int_input(input: int) -> int:
return int(input)


@fn.NodeDecorator(
node_id="input.float",
node_name="Float Input",
description="Input a float",
outputs=[
{"name": "float"},
],
)
def float_input(input: float) -> float:
return float(input)


@fn.NodeDecorator(
node_id="input.bool",
node_name="Boolean Input",
description="Input a boolean",
outputs=[
{"name": "boolean"},
],
)
def bool_input(input: bool) -> bool:
if isinstance(input, str):
if input.lower() in ("true", "1", "yes"):
input = True
elif input.lower() in ("false", "0", "no"):
input = False
elif isinstance(input, (int, float)):
input = bool(input)
else:
input = bool(input)
return bool(input)


NODE_SHELF = fn.Shelf(
nodes=[
any_input,
str_input,
int_input,
float_input,
bool_input,
],
name="Input",
description="Simple input nodes",
)
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading