1

Currently I have a python script (proofreader.py) that help me to read a text file, process from several proofreading method, and output the corrected test to a file.

But the script is quite lengthy, e.g.> 1000 Line of codes, so I want to better organize it and better reuse in the future.

Current structure: proofreader.py

def main(argv)
..
def read_text_file():
def proofreading_method_1():
def proofreading_method_2():
def proofreading_method_3():
..
def common_string_function_1():
def common_string_function_2():
def common_string_function_3():
..
def write_text_file():

Can anyone suggest a proper layout for this project (Proofreader)?

According to: http://jcalderone.livejournal.com/39794.html, I came up with with the following:

Proofreader/
|-- bin/
| |-- proofreader (The python script with the .py extension)
|
|-- proofreader/
| |-- test/
| | |-- __init__.py
| | |-- test_main.py
| | 
| |-- __init__.py
| |-- main.py
| |-- proofreading.py (class for proofreading methods)
| |-- stringutil.py (class for frequently used string methods)
|
|-- setup.py
|-- README

Any problem with the above suggestion?

BenMorel
37.1k53 gold badges208 silver badges339 bronze badges
asked Nov 14, 2011 at 15:11

2 Answers 2

1

Consider to use the automatic script creation of distribute (see: http://packages.python.org/distribute/setuptools.html?highlight=entry_points#automatic-script-creation ) instead of keeping a seperate .py file in 'bin'. I usualy keep the tests outside my module. Split up your proofreader.py into several files containing different classes if possible. Thats actually the most important thing to keep an overview.

answered Nov 14, 2011 at 18:12
Sign up to request clarification or add additional context in comments.

Comments

1

I usually use a similar layout.

The only significant difference I'd say is that test module would be under Proofreader instead of under Proofreader/proofreader. The main reason to keep tests separate from the code is that you usually just want to make them available to other developers, but not to the users that just want to install your software.

answered Nov 14, 2011 at 17:08

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.