0

I am new at writing APIs in python, in any language for that matter. I was hoping to get pointers on how i can create an API that can be installed using setup.py method and used in other python projects. Something similar to the twitterapi.

I have already created and coded all the methods i want to include in the API. I just need to know how to implement the installation so other can use my code to leverage ideas they may have. Or if i need to format the code a certain way to facilitate installation.

I learn best with examples or tutorials.

Thanks so much.

4

2 回答 2

1

值得注意的是,python的这一部分现在正在发生一些变化。一切都有些混乱。我所知道的最新概述是 Hitchhiker 的包装指南:http: //guide.python-distribute.org/

包装部分的当前状态很重要: http: //guide.python-distribute.org/introduction.html#current-state-of-packaging

于 2010-05-21T10:14:19.250 回答
1

python 包装世界是一团糟(就像 poswald 说的那样)。这是一个简短的概述以及一堆指针。您的基本问题(使用 setup.py 等)通过阅读msw 在他的评论中提到的distutils 指南得到解决。

现在是污垢。Python 标准库中的分发模块的基本基础结构是上面提到的 distutils。它在某些方面受到限制,因此在其上编写了一系列扩展,称为 setuptools。Setuptools 与实际增加的功能一起提供了一个名为“easy_install”的命令行“安装程序”。

Setuptools 维护不是太好,因此它被分叉并设置了一个名为“distribute”的更活跃的分支,它是目前的首选替代方案。除此之外,创建了一个名为 pip 的 easy_install 替代品,它更加模块化和有用。

现在有一个巨大的项目正在进行,它试图将所有更改从分发和内容折叠到一个统一的库中,该库将进入标准库。它暂时称为“distutils2”。

于 2010-05-21T10:22:56.763 回答