python(command line)是什么,python命令行應用程序的最佳布局是什么?

What is the right way (or I'll settle for a good way) to lay out a command line python application of moderate complexity? I've created a python project skeleton using paster, which gave me a few files to start with:

什么是合適的方式(或者我將滿足於好的方式)來部署中等復雜度的命令行python應用程序?我使用paster創建了一個python項目框架,這給了我一些文件作為開始:

myproj/__init__.py

MyProj.egg-info/

dependency_links.txt

entry_points.txt

PKG-INFO

SOURCES.txt

top_level.txt

zip-safe

setup.cfg

setup.py

I want to know, mainly, where should my program entry point go, and how can I get it installed on the path? Does setuptools create it for me? I'm trying to find this in the HHGTP, but maybe I'm just missing it.

我主要想知道,我的程序入口點應該放在哪里,我如何在路徑上安裝它?setuptools為我創建了它嗎?我試着在HHGTP找到這個,但也許我只是錯過了。

1 个解决方案

#1

7

You don't need to create all that, the .egg-info directory is generated by setuptools. You mention the command line, so I assumed you have a 'top level' script somewhere, let's say myproj-bin. Then this would work:

您不需要創建所有這些,. egginfo目錄是由setuptools生成的。您提到了命令行,所以我假設您在某個地方有一個“頂級”腳本,比方說myproject -bin。然后這將工作:

./setup.py

./myproj

./myproj/__init__.py

./scripts

./scripts/myproj-bin

And then put something like this in setup.py:

然后把這樣的東西放到setupy中。

#! /usr/bin/python

from setuptools import setup

setup(name="myproj",

description='shows how to create a python package',

version='123',

packages=['myproj'], # python package names here

scripts=['scripts/myproj-bin'], # scripts here

)

There's a lot more that you can do if your project is complex, the full manual of setuptools is here: http://peak.telecommunity.com/DevCenter/setuptools.

如果您的項目比較復雜,那么您還可以做更多的事情,setuptools的完整手冊在這里:http://peak.telecommunity.com/DevCenter/setuptools。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值