CodingNic

Modules, Packages, and Virtual Environments

Final Capstone

Modules, Packages, and Virtual Environments 60 min read

Final Capstone

Final Capstone

Great job finishing this module.

Now it is time to build one real project that uses everything you learned:

  • modules
  • packages
  • imports
  • standard library modules
  • pip
  • virtual environments
  • requirements.txt

Project: Personal Productivity Toolkit

Build a multi-file Python project with useful tools.

This project will help a user perform small daily tasks from one program.


Skills You Will Use

  • custom modules
  • packages
  • imports
  • random
  • datetime
  • virtual environment setup
  • requirements management
  • organized project structure

Step 1: Create Project Structure

text
productivity_toolkit/
    main.py
    tools/
        math_tools.py
        text_tools.py
        date_tools.py

Step 2: Create math_tools.py

Add:

python
def double(n):
    return n * 2

def square(n):
    return n * n

Step 3: Create text_tools.py

Add:

python
def shout(text):
    return text.upper()

def count_letters(text):
    return len(text)

Step 4: Create date_tools.py

Add:

python
from datetime import date

def today():
    return date.today()

def year():
    return date.today().year

Step 5: Create main.py

Import all tools.

Show this menu in a loop:

text
1. Double Number
2. Square Number
3. Shout Text
4. Count Letters
5. Show Date
6. Show Year
7. Exit

Ask the user to choose an option.


Step 6: Add Menu Actions

If User Chooses 1

Ask for a number.

Print:

python
double(number)

If User Chooses 2

Ask for a number.

Print:

python
square(number)

If User Chooses 3

Ask for text.

Print:

python
shout(text)

If User Chooses 4

Ask for text.

Print:

python
count_letters(text)

If User Chooses 5

Print today’s date.

If User Chooses 6

Print current year.

If User Chooses 7

Print:

text
Goodbye

Then stop the loop.


Full Example Run

text
1. Double Number
2. Square Number
3. Shout Text
4. Count Letters
5. Show Date
6. Show Year
7. Exit

Choose: 1
Enter number: 5
10

Choose: 3
Enter text: hello
HELLO

Choose: 6
2026

Choose: 7
Goodbye

Step 7: Environment Practice

In terminal:

bash
python -m venv venv

Activate the environment.

Create:

bash
pip freeze > requirements.txt

Final Structure

text
productivity_toolkit/
    venv/
    main.py
    requirements.txt
    tools/
        math_tools.py
        text_tools.py
        date_tools.py

Extra Challenges

After finishing, try adding:

  • Random password tool
  • Reverse text
  • Cube number
  • Day of week
  • Save history to file
  • Better menu design

Real World Use Case

This project uses the same structure developers use for utilities, admin tools, automation scripts, and helper apps.


Assignment

Build the full project, then add one new module with your own feature.


Summary

You built a real multi-file Python project using modules, packages, imports, standard libraries, and professional project setup.