Skip to content

Commit

Permalink
0.5.2 (#150)
Browse files Browse the repository at this point in the history
* πŸ“ Refactor codebase: unify type annotations and import future features

* πŸ› Allow methods decorated by @ProcGroup.add_proc to return None

* πŸ“ˆ Bump up pipen version to v0.5.2
  • Loading branch information
pwwang authored Mar 8, 2023
1 parent e426025 commit 4e6219f
Show file tree
Hide file tree
Showing 17 changed files with 170 additions and 126 deletions.
5 changes: 5 additions & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Change Log

## 0.5.2

- πŸ“ Refactor codebase: unify type annotations and import future features
- πŸ› Allow methods decorated by @ProcGroup.add_proc to return None

## 0.5.1

- πŸš‘ Remove remaining more-itertools
Expand Down
10 changes: 6 additions & 4 deletions pipen/channel.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
"""Provide some function for creating and modifying channels (dataframes)"""
from __future__ import annotations

from glob import glob
from os import path
from typing import Any, List, Union
from typing import Any, List

import pandas
from pandas import DataFrame
Expand All @@ -14,7 +16,7 @@ class Channel(DataFrame):
"""A DataFrame wrapper with creators"""

@classmethod
def create(cls, value: Union[DataFrame, List[Any]]) -> DataFrame:
def create(cls, value: DataFrame | List[Any]) -> DataFrame:
"""Create a channel from a list.
The second dimension is identified by tuple. if all elements are tuple,
Expand Down Expand Up @@ -151,7 +153,7 @@ def from_table(cls, *args, **kwargs):
@register_verb(DataFrame)
def expand_dir(
data: DataFrame,
col: Union[str, int] = 0,
col: str | int = 0,
pattern: str = "*",
ftype: str = "any",
sortby: str = "name",
Expand Down Expand Up @@ -189,7 +191,7 @@ def expand_dir(


@register_verb(DataFrame)
def collapse_files(data: DataFrame, col: Union[str, int] = 0) -> DataFrame:
def collapse_files(data: DataFrame, col: str | int = 0) -> DataFrame:
"""Collapse a Channel according to the files in <col>,
other cols will use the values in row 0.
Expand Down
2 changes: 1 addition & 1 deletion pipen/cli/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,5 +51,5 @@ def exec_command(self, args: Namespace) -> None:
ver = versions[key]
verlines = ver.splitlines()
print(f"{key.ljust(keylen)}: {verlines.pop(0)}")
for verline in verlines:
for verline in verlines: # pragma: no cover
print(f"{' ' * keylen} {verline}")
6 changes: 3 additions & 3 deletions pipen/defaults.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,16 +59,16 @@

# Just the total width of the terminal
# when logging with a rich.Panel()
CONSOLE_WIDTH_WITH_PANEL: int = 100
CONSOLE_WIDTH_WITH_PANEL = 100
# The width of the terminal when the width cannot be detected,
# we are probably logging into a file
CONSOLE_DEFAULT_WIDTH: int = 256
CONSOLE_DEFAULT_WIDTH = 256
# [05/16/22 11:46:40] I
# v0.3.4:
# 05-16 11:11:11 I
# The markup code is included
# Don't modify this unless the logger formatter is changed
CONSOLE_WIDTH_SHIFT: int = 25
CONSOLE_WIDTH_SHIFT = 25
# For pipen scheduler plugins
SCHEDULER_ENTRY_GROUP = "pipen_sched"
# For pipen template plugins
Expand Down
6 changes: 4 additions & 2 deletions pipen/job.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
"""Provide the Job class"""
from __future__ import annotations

import logging
import shlex
from os import PathLike
from pathlib import Path
import shutil
from typing import TYPE_CHECKING, Any, Dict, Mapping, Union
from typing import TYPE_CHECKING, Any, Dict, Mapping

from diot import OrderedDiot
from xqute import Job as XquteJob
Expand Down Expand Up @@ -210,7 +212,7 @@ def template_data(self) -> Mapping[str, Any]:

def log(
self,
level: Union[int, str],
level: int | str,
msg: str,
*args,
limit: int = 3,
Expand Down
8 changes: 5 additions & 3 deletions pipen/pipen.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
"""Main entry module, provide the Pipen class"""
from __future__ import annotations

import asyncio
from itertools import chain
from os import PathLike
from pathlib import Path
import pprint
import textwrap
from typing import ClassVar, Iterable, List, Sequence, Type, Union
from typing import ClassVar, Iterable, List, Sequence, Type

from diot import Diot
from rich import box
Expand Down Expand Up @@ -64,7 +66,7 @@ def __init__(
self,
name: str = None,
desc: str = None,
outdir: PathLike = None,
outdir: str | PathLike = None,
**kwargs,
) -> None:
"""Constructor"""
Expand Down Expand Up @@ -215,7 +217,7 @@ def set_data(self, *indata: Iterable) -> "Pipen":

def set_starts(
self,
*procs: Union[Type[Proc], Sequence[Type[Proc]]],
*procs: Type[Proc] | Sequence[Type[Proc]],
clear: bool = True,
):
"""Set the starts
Expand Down
Loading

0 comments on commit 4e6219f

Please sign in to comment.