Python Package Best Practices

This lesson by the Molecular Sciences Software Institute (MolSSI) teaches users MolSSI’s best practices in Python package development.

MolSSI best practices provides a starting point to get into software development operations to ensure that your code is reliable and reproducible while decreasing long-term maintenance requirements, increasing long-term viability, and allow others to work on your code base to assist your own efforts. Before starting into MolSSI best practice one must first think about the user base of a given project whether this is a project only used by yourself, within a small group, or a large community project. If your project is small and personal you may want to consider each topic in detail before implementing while for large community projects each topic is quite crucial.

This lesson is under continual development, please report issues to the workshop repository. If you see a subject you would like to contribute to, submit a pull request!

Prerequisites

This material is best suited for people who have experience scripting in Python and are ready to learn about how to make their scripts into a software package. You should have experience programming Python and in using the terminal (or shell)

You can see a tutorial on using the shell from Software Carpentry.

Schedule

Setup Download files required for the lesson
00:00 1. Python Package Set-up What is the layout of a Python package?
How can I quickly create the structure of a Python package?
What license should I choose for my project?
00:45 2. Intro to Version Control with Git How do I use git to keep a record of my project?
01:20 3. Using GitHub How do I use git and GitHub?
01:55 4. Python Coding Style How can I write python code that is readable?
02:40 5. Deciding Package Structure How should I break my code into modules?
How can I handle imports in my package?
03:35 6. Type Hinting in Python What is type hinting?
What does type hinting do for my software?
03:55 7. Code Collaboration using GitHub How can others contribute to my project on GitHub?
How can I contribute to the projects of others?
04:30 8. Python Testing How is a Python module tested?
05:40 9. Continuous Integration How can we automate testing?
How do we link a repository on GitHub to continuous integration services?
07:10 10. Documentation How can we document our module?
08:10 11. Distributing Packages How can I get my project out there?
08:45 Finish

The actual schedule may vary slightly depending on the topics and exercises chosen by the instructor.

Legacy Lessons

Retired lessons are shown below. These are lessons which are no longer recommended by MolSSI, but may be useful if you are looking for information on a particular topic.

Continuous Integration using Travis-CI How can we automate testing?
How do we link a repository on GitHub to continuous integration services?