Skip to main content

spirit-link

使用

下面是一个示例。通常来说,我们根据需求 (Requirement) 进行项目开发,项目 (Project) 被拆分为一个或多个模块,模块 (Module) 被拆分为多个任务,任务(Task) 可以拆分为子任务:

  • 项目
    • 模块
      • 任务
        • 子任务
          • 子任务的子任务

代码示例如下:

from spirit_link import *
项目(
    "项目名",
    [
        模块(
            "模块名",
            [
                任务("任务1"),
                任务(
                    "任务2",
                    [
                        # 子任务
                    ]
                ),
            ]
        ),
    ]
)

不管还是最顶层的项目,还是中间的模块,根部的任务,甚至是需求,这些都是节点 (Node)。节点之间可以创建依赖:

assert isinstance(项目, Node) and isinstance(任务, Node) and isinstance(需求, Node)
任务1.depends(任务2)
任务1.depends(项目3)

节点可以被用标签 (Tag)标记:

from enum import Enum

class 我的标签(标签, Enum):
    情况1 = 1
    情况2 = 2

任务1.tag(我的标签.情况1)

下面是一个例子:

from enum import Enum
from spirit_link import *
from spirit_link.backends.dot import build_graph, output

class 进度(Tag, Enum):
    未开始 = 0
    规划中 = 1
    进行中 = 2
    已完成 = 3
    已验证 = 4

## 描述需求

A = 需求("A")

B = 项目(
    "B",
    [
        模块(
            "C",
            [
                任务("a1"),
                任务("a2")
            ]
        ),
        模块(
            "D",
            [
                任务("a3"),
                任务("a4"),
                任务(
                    "a5",
                    children=[
                        任务("a5-1"),
                        任务("a5-2")
                    ]
                )
            ]
        ),
])


A.depends(B)

root = B
outliers = [A]

可以从中构建一个PDF:

spirit-link.exe test.py --o=test.pdf

得到下图:

Metadata

Release files for spirit-link 0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for spirit-link 0.1
File Interpreter ABI Platform Actions
spirit_link-0.1-py3-none-any.whl Python 3 none any Details for spirit_link-0.1-py3-none-any.whl

Security for spirit-link 0.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1 This release

1 release file No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page