Locked learning resources

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

Unlock This Lesson

Locked learning resources

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

Unlock This Lesson

Laying Out the Project

00:00 It’s time to start creating needed files and directories for your Typer CLI to-do application. Let’s take a look at what the intended project layout should look like.

00:10 You start with the main project directory, which is rp_todo_project/, and in there you’ll be creating the main CLI application package called rp_todo.

00:21 And in that package, you’ll have __init__.py, __main__.py, and a cli.py module, a config.py module, a database.py module, and rptodo.py module.

00:35 And in the parent or root directory, you can have the README .md file for project documentation and a requirements.txt file to put a list of your project’s dependencies.

00:47 Now let’s understand these files and modules in more detail. __init__.py is what enables your rptodo directory to become a Python package.

00:59 The __main__.py will provide an entry point script to run your application from the package using the Python command, python -m rptodo.

01:10 The cli.py module will provide the main Typer command-line interface for the application. The config.py module will contain code to handle the management of the application’s configurations and settings. The database.py module will contain code to handle the management of the application’s to-do database.

01:31 And finally, the rp_todo.py module. This will contain code that connects the main application command-line interface with the to-do database.

01:42 Great. Now that you’ve seen the structure of your project layout, it’s time to implement that structure. While in your root project directory, create a directory and call it rptodo.

01:53 This will be your main CLI package. And in there, create a file __init__.py,

02:06 __main__.py,

02:13 cli.py,

02:18 config.py,

02:23 database.py,

02:27 and rptodo.py. And now, you go outside of that package and into the root project directory to create README .md and you should already have the requirements .txt file obtained from running pip freeze after installing Typer in your isolated virtual environments.

02:52 Great. You should now have all the files you need to proceed.

02:58 You can reference the project layout in your slide to create them. In the next lesson, you proceed to set up your to-do application with Typer.

Become a Member to join the conversation.