Due to the long runtime of Data Science (DS) pipelines, even small programming mistakes can be very costly, if they are not detected statically. However, even basic static type checking of DS pipelines is difficult because most are written in Python. Static typing is available in Python only via external linters. These require static type annotations for parameters or results of functions, which many DS libraries do not provide. In this paper, we show how the wealth of Python DS libraries can be used in a statically safe way via Safe-DS, a domain specific language (DSL) for DS. Safe-DS catches conventional type errors plus errors related to range restrictions, data manipulation, and call order of functions, going well beyond the abilities of current Python linters. Python libraries are integrated into Safe-DS via a stub language for specifying the interface of its declarations, and an API-Editor that is able to extract type information from the code and documentation of Python libraries, and automatically generate suitable stubs. Moreover, Safe-DS complements textual DS pipelines with a graphical representation that eases safe development by preventing syntax errors. The seamless synchronization of textual and graphic view lets developers always choose the one best suited for their skills and current task. We think that Safe-DS can make DS development easier, faster, and more reliable, significantly reducing development costs.
翻译:由于数据科学管线的运行时间长,即使是微小的编程错误若未能被静态检测,也可能导致高昂成本。然而,数据科学管线大多使用Python编写,因此对其实现基本的静态类型检查本身就存在困难。Python仅能通过外部链接器实现静态类型,但这些需要函数参数或结果的静态类型注解,而许多数据科学库并未提供此类注解。本文展示了如何通过面向数据科学的领域特定语言Safe-DS,以静态安全的方式利用丰富的Python数据科学库。Safe-DS不仅能捕获常规类型错误,还能检测与范围限制、数据操作及函数调用顺序相关的错误,其能力远超现有Python链接器。Safe-DS通过存根语言定义声明的接口,并借助API编辑器从Python库的代码和文档中提取类型信息、自动生成合适的存根,从而实现对Python库的集成。此外,Safe-DS用图形化表示补充文本式数据科学管线,通过防止语法错误来提升开发安全性。文本视图与图形视图的无缝同步使开发者能够根据自身技能和当前任务灵活选择最适模式。我们认为Safe-DS能够使数据科学开发更简单、更快速、更可靠,显著降低开发成本。