Day 27

Studio Time for Day 27 - videos

Final work deadline

For Friday

Class photo Backdrop Challenge

Capturing videos

If you would like to create a video of a game or interactive project that you’re working on, we have some guidance on our class page.

Capturing dependencies

Your project may require 3rd party Python packages that are not part of the standard library. In your README file (e.g. “Getting Started” or Install section), you must at minimum list these extra packages necessary to run your code (with versions if necessary).

You should know what modules are needed because you wrote an import statement for each (read about best practices for import statements), but in case you forget or you’re looking at someone else’s code: command line tools can help. In your project directory, type:

grep -hr "^import" . | sort | uniq

This means 1) search recursively in the current directory for lines that start with “import” (without printing which file you found them in), 2) sort those results alphabetically, and 3) don’t show me duplicates.

(Technically "^\(from .\+ \)\?import" would be a better search expression, since it also catches from foo import bar style imports.)

In order to make things easier for your users, in addition to just listing the required packages, you can give them a listing that they can automatically install using their package manager.

To generate this list, you can run:

pip freeze > requirements.txt

or

conda list --export > requirements.txt

depending on which package manager you are using. This will create a file called requirements.txt that you can include in your project repository. Users can then install the needed dependencies by simply running:

pip install -r requirements.txt

or

conda install --file requirements.txt

as appropriate.

Important caveat: this process will dump every package you’ve installed, not just the ones needed for this project. It is best practice to edit down the list to just those necessary for your project.

Make sure the README file for your project has up-to-date installation instructions including required packages. A requirements.txt file for your project is a nice-to-have, but you can submit your final code with written instructions for packages that users will need to install.