Join us and get access to hundreds of tutorials and a community of expert Pythonistas.

Unlock This Lesson

This lesson is for members only. Join us and get access to hundreds of tutorials and a community of expert Pythonistas.

Unlock This Lesson

Hint: You can adjust the default video playback speed in your account settings.
Hint: You can set the default subtitles language in your account settings.
Sorry! Looks like there’s an issue with video playback 🙁 This might be due to a temporary outage or because of a configuration issue with your browser. Please see our video player troubleshooting guide to resolve the issue.

Including Other Files in Your Python Package

Give Feedback

In this lesson you’ll learn how to include other files in your Python package such as your config.txt defined in a previous lesson.

00:00 Occasionally, you’ll need to include other types of files in your package that aren’t source code. These may be CSV files, binaries, or config files, like we have in this project. When you run setup() it’s going to create something called a manifest file that’s going to include all source code and README files.

00:20 If all your project contains are source code and README files, you don’t need to modify the manifest at all. If you do have something else, like we have under reader/ a config.txt, you’re going to need to create a manifest template to include this.

00:38 So go to your top level directory, create a new file, and this needs to be called MANIFEST, in all caps, .in.

00:49 The only line you need to include in here is include reader/*.txt.

00:59 What this is going to do is it’s going to look in the reader/ folder and any .txt file that it sees, it’s going to include in the build.

01:07 Now, creating this file is fine. Then you need to make sure that if you go to, if you go down to this include_package_data, this must be set to True or it will ignore that file. All right!

01:21 And with that, you’ve finally done all the configuration and setup you need to get your work onto PyPI. Hopefully you’re starting to see that writing your actual code is only part of the effort, and there’s quite a bit of overhead that needs to be done to distribute your project. In the next video, you’ll actually build your package into a format that PyPI will accept, and then you’re ready for upload. Thanks for watching.

Lee Jordan on Oct. 25, 2020

Do we need to do this for subfolders that hold images and the image files inside them?

Become a Member to join the conversation.