A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://realpython.com/lessons/including-other-files-your-python-package/ below:

Including Other Files in Your Python Package (Video) – Real Python

Including Other Files in Your Python Package

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 setup.py, 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.

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

Nice course, I would really like to see this course updated with using toml and build

Become a Member to join the conversation.

Course Contents


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4