The Palos Publishing Company

Follow Us On The X Platform @PalosPublishing
Categories We Write About

Build a software license tracker

A Software License Tracker is an application designed to monitor, manage, and ensure compliance with software licenses used by a company or an individual. Below is a basic implementation guide with code using Python and a SQLite database. This is a CLI-based version, but it can be extended into a full web or desktop app later.


Features

  • Add software licenses

  • Edit/update license info

  • List all licenses

  • Check for expired licenses

  • Search by software name

  • Delete licenses


Tools & Libraries

  • Python 3.x

  • SQLite via sqlite3

  • datetime for expiry tracking


Step-by-Step Implementation

Step 1: Setup Database

python
import sqlite3 def init_db(): conn = sqlite3.connect("licenses.db") cursor = conn.cursor() cursor.execute(''' CREATE TABLE IF NOT EXISTS licenses ( id INTEGER PRIMARY KEY AUTOINCREMENT, software_name TEXT NOT NULL, license_key TEXT NOT NULL, assigned_to TEXT, purchase_date TEXT, expiry_date TEXT, license_type TEXT ) ''') conn.commit() conn.close()

Step 2: Add New License

python
def add_license(): software_name = input("Software Name: ") license_key = input("License Key: ") assigned_to = input("Assigned To: ") purchase_date = input("Purchase Date (YYYY-MM-DD): ") expiry_date = input("Expiry Date (YYYY-MM-DD): ") license_type = input("License Type (Single/User/Enterprise): ") conn = sqlite3.connect("licenses.db") cursor = conn.cursor() cursor.execute(''' INSERT INTO licenses (software_name, license_key, assigned_to, purchase_date, expiry_date, license_type) VALUES (?, ?, ?, ?, ?, ?) ''', (software_name, license_key, assigned_to, purchase_date, expiry_date, license_type)) conn.commit() conn.close() print("License added successfully.")

Step 3: List All Licenses

python
def list_licenses(): conn = sqlite3.connect("licenses.db") cursor = conn.cursor() cursor.execute('SELECT * FROM licenses') rows = cursor.fetchall() for row in rows: print(row) conn.close()

Step 4: Search License by Software Name

python
def search_license(): name = input("Enter software name to search: ") conn = sqlite3.connect("licenses.db") cursor = conn.cursor() cursor.execute("SELECT * FROM licenses WHERE software_name LIKE ?", ('%' + name + '%',)) results = cursor.fetchall() for res in results: print(res) conn.close()

Step 5: Delete a License

python
def delete_license(): license_id = input("Enter license ID to delete: ") conn = sqlite3.connect("licenses.db") cursor = conn.cursor() cursor.execute("DELETE FROM licenses WHERE id=?", (license_id,)) conn.commit() conn.close() print("License deleted.")

Step 6: Check for Expired Licenses

python
from datetime import datetime def check_expired(): today = datetime.today().date() conn = sqlite3.connect("licenses.db") cursor = conn.cursor() cursor.execute("SELECT * FROM licenses") rows = cursor.fetchall() print("Expired Licenses:") for row in rows: expiry = datetime.strptime(row[5], "%Y-%m-%d").date() if expiry < today: print(row) conn.close()

Step 7: Update License Information

python
def update_license(): license_id = input("Enter license ID to update: ") field = input("Enter field to update (software_name, license_key, assigned_to, purchase_date, expiry_date, license_type): ") new_value = input(f"Enter new value for {field}: ") conn = sqlite3.connect("licenses.db") cursor = conn.cursor() cursor.execute(f"UPDATE licenses SET {field} = ? WHERE id = ?", (new_value, license_id)) conn.commit() conn.close() print("License updated.")

Step 8: CLI Menu

python
def menu(): init_db() while True: print("nSoftware License Tracker") print("1. Add License") print("2. List All Licenses") print("3. Search License") print("4. Delete License") print("5. Update License") print("6. Check Expired Licenses") print("7. Exit") choice = input("Choose an option: ") if choice == '1': add_license() elif choice == '2': list_licenses() elif choice == '3': search_license() elif choice == '4': delete_license() elif choice == '5': update_license() elif choice == '6': check_expired() elif choice == '7': break else: print("Invalid choice.") if __name__ == "__main__": menu()

Future Enhancements

  • Web-based dashboard (Flask/Django)

  • Email notifications before license expiry

  • Export reports to CSV/Excel

  • User authentication

  • License file/document upload support


This command-line software license tracker provides a functional base for tracking your software assets and license compliance. It can be extended to include analytics, integrations, or a frontend interface depending on your needs.

Share this Page your favorite way: Click any app below to share.

Enter your email below to join The Palos Publishing Company Email List

We respect your email privacy

Categories We Write About