0

I started a new Python project and I want to have a good structure from the beginning. I'm reading some convention Python guides but I don't find any info about how the main script must be named. Is there any rules for this? Is there any other kind of convention for folders or text files inside the project (like readme files)?

By the way, I'm programming a client-server app so there is no way for this to become a package (at least in the way a think a package is).

5
  • 1
    What framework? Also from what I've seen most people just use main.py or something generic. Commented Oct 31, 2012 at 11:38
  • No framework at the moment. Is not a web app. Commented Oct 31, 2012 at 11:39
  • 1
    For something official see python.org/dev/peps/pep-0008/#prescriptive-naming-conventions. Commented Oct 31, 2012 at 11:42
  • Is not a web app., you can use something like twisted(which is a framework) to develop client-server apps. Just pointing out that not all frameworks are for webapps. Commented Oct 31, 2012 at 11:44
  • Yes, I checked that before post but I didn't find anything related. I think that I'm going to check some popular project to see if the use any convention. Thanks. Commented Oct 31, 2012 at 11:44

2 Answers 2

2

If you want to package your application to allow a ZIP file containing it or its directory to be passed as an argument to the python interpreter to run the application, name your main script __main__.py. If you don't care about being able to do this (and most python applications do not), name it whatever you want.

Sign up to request clarification or add additional context in comments.

Comments

1

No such rule exists for python main script which starts your application. There are coding guidelines (PEP8) which you can follow to keep your code clean though.

You can check existing python applications which are easily available. May be open source/free software projects e.g yum (on rpm based distros) command, lots of python apps (you can checkout them from publicly available source code management systems e.g git repo) etc. You can check basic principles they follow. But there are no constraints as such.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.