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/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ jobs:

- run: |
mk python-release owner=libre-embedded \
repo=ifgen version=4.4.4
repo=ifgen version=4.4.5
if: |
matrix.python-version == '3.12'
&& matrix.system == 'ubuntu-latest'
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
=====================================
generator=datazen
version=3.2.3
hash=8ee0ca6fb45a3831f000ce66e553d694
hash=bb7c6c6ee9e74f924d3169c09662b491
=====================================
-->

# ifgen ([4.4.4](https://pypi.org/project/ifgen/))
# ifgen ([4.4.5](https://pypi.org/project/ifgen/))

[![python](https://img.shields.io/pypi/pyversions/ifgen.svg)](https://pypi.org/project/ifgen/)
![Build Status](https://github.com/libre-embedded/ifgen/workflows/Python%20Package/badge.svg)
Expand Down
4 changes: 2 additions & 2 deletions ifgen/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# =====================================
# generator=datazen
# version=3.2.3
# hash=df27db53be175c0270252c83f57d166d
# hash=67eaf4ed029fdce58622eee8dd8cfdf0
# =====================================

"""
Expand All @@ -10,4 +10,4 @@

DESCRIPTION = "An interface generator for distributed computing."
PKG_NAME = "ifgen"
VERSION = "4.4.4"
VERSION = "4.4.5"
9 changes: 3 additions & 6 deletions ifgen/enum/python/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from ifgen.generation.interface import GenerateTask
from ifgen.generation.python import (
python_class,
python_docstring,
python_function,
python_imports,
)
Expand Down Expand Up @@ -73,13 +74,9 @@ def python_enum_header(task: GenerateTask, writer: IndentedFileWriter) -> None:
if value:
final = value.get("value", final)

line = f"{to_enum_name(enum)} = {final}"
writer.write(f"{to_enum_name(enum)} = {final}")
if value and "description" in value:
line += f" # {value['description']}"

writer.write(line)

writer.empty()
python_docstring(writer, value["description"])

# Override underlying primitive if necessary.
underlying = strip_t_suffix(task.instance["underlying"])
Expand Down
19 changes: 15 additions & 4 deletions ifgen/generation/python/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,19 @@ def python_imports(
writer.empty(count=final_empty)


def python_docstring(
writer: IndentedFileWriter, *docstrings: str, empty: bool = True
) -> None:
"""Write docstring data."""

writer.write('"""')
for docstring in docstrings:
writer.write(docstring)
writer.write('"""')
if empty:
writer.empty()


@contextmanager
def python_class(
writer: IndentedFileWriter,
Expand All @@ -61,8 +74,7 @@ def python_class(

writer.write(line)
with writer.indented():
writer.write(f'"""{docstring}"""')
writer.empty()
python_docstring(writer, docstring)
yield

writer.empty(count=final_empty)
Expand All @@ -86,8 +98,7 @@ def python_function(
writer.write(f"def {name}({params}) -> {return_type}:")

with writer.indented():
writer.write(f'"""{docstring}"""')
writer.empty()
python_docstring(writer, docstring)
yield

writer.empty(count=final_empty)
2 changes: 1 addition & 1 deletion local/variables/package.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
major: 4
minor: 4
patch: 4
patch: 5
entry: ig
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta:__legacy__"

[project]
name = "ifgen"
version = "4.4.4"
version = "4.4.5"
description = "An interface generator for distributed computing."
readme = "README.md"
requires-python = ">=3.12"
Expand Down