English 中文(简体)
• 如何为一揽子计划实施一个标准记录器和一台发动机
原标题:How to implement a standard logger and argparser for a package

我正试图对我们内部软件开发过程实施一套建材和功能测试包。 我的主要目标是实施一种全球/标准记录(类似于参考here)和一种增减器,即所有模块都将从自己的观点组合中加以使用(即,建筑标识和树冠与试验套案和树脂不同)。

是否应在一揽子计划中的<代码>_init__py中做到这一点? 是否有其他办法实现这一目标? 我尚未看到对<代码>_init__py的真正需要是什么? 也许,这回答了我自己的问题?

我已经撰写了无数的漫画单元和其他材料,但从来没有包裹/图书馆。 这一概念似乎给我带来了新的可能性,例如使这些进程标准化。

概括地说,我为这些一揽子计划制定的目标如下:

1) 消除通过/编制冗长的论据清单和/或进入系统环境的必要性。

b) 消除过去从各种测试和文字制作中看到的大量产出。

3) 提供易于使用的自我记录包。 关于一揽子文件的任何建议都将非常有用,而且:

这将使这些包裹的使用者能够:

1) 容易获得一套标准的论点。 例如,一揽子计划中的每个单元(按优先顺序)将指挥线论点与标准旗挂钩,装上公交档案,或使用违约数值。

b) 通常会以标准方式放行器、警告和去除。

3.) As these test/build modules are passed around, this will ultimately enable "users" (i.e. someone who did not write the module) to run it in a universal way.

我相信,我正在寻求一些真正的“常设”执行建议,因为各种选择和可能性似乎都很大。 提前感谢。

最佳回答

For logging look no further than the python logging documentation. It is a very easy to implement logging system that is very flexible.

As to your question about __init__.py, if you come from other programming languages, think of it as a constructor. If you want some default values assigned on load, then they should go into __init__.py.

我并不熟悉<代码>argparse,因此,其他人可能能够就此发表一些看法。

问题回答

暂无回答




相关问题
Can Django models use MySQL functions?

Is there a way to force Django models to pass a field to a MySQL function every time the model data is read or loaded? To clarify what I mean in SQL, I want the Django model to produce something like ...

An enterprise scheduler for python (like quartz)

I am looking for an enterprise tasks scheduler for python, like quartz is for Java. Requirements: Persistent: if the process restarts or the machine restarts, then all the jobs must stay there and ...

How to remove unique, then duplicate dictionaries in a list?

Given the following list that contains some duplicate and some unique dictionaries, what is the best method to remove unique dictionaries first, then reduce the duplicate dictionaries to single ...

What is suggested seed value to use with random.seed()?

Simple enough question: I m using python random module to generate random integers. I want to know what is the suggested value to use with the random.seed() function? Currently I am letting this ...

How can I make the PyDev editor selectively ignore errors?

I m using PyDev under Eclipse to write some Jython code. I ve got numerous instances where I need to do something like this: import com.work.project.component.client.Interface.ISubInterface as ...

How do I profile `paster serve` s startup time?

Python s paster serve app.ini is taking longer than I would like to be ready for the first request. I know how to profile requests with middleware, but how do I profile the initialization time? I ...

Pragmatically adding give-aways/freebies to an online store

Our business currently has an online store and recently we ve been offering free specials to our customers. Right now, we simply display the special and give the buyer a notice stating we will add the ...

Converting Dictionary to List? [duplicate]

I m trying to convert a Python dictionary into a Python list, in order to perform some calculations. #My dictionary dict = {} dict[ Capital ]="London" dict[ Food ]="Fish&Chips" dict[ 2012 ]="...

热门标签