How mattoofahad/net-salary-calculator works
Project Type & Purpose
• This is a Python-based salary calculator that computes the additional amount required over a desired net salary in order to cover taxes, travel costs, and work schedule factors.
• Although the current implementation is CLI-based (and includes a Streamlit scaffolding via the “app.py” file), there is also a roadmap (see TODO) for adding a REST API server and a web interface (via Streamlit) along with deployment support (e.g., via Hugging Face Spaces).
• Knowing this is primarily a command-line tool but with potential for multi-interface expansion is key.
Main Components
• User Interface:
• Command-Line Interface (CLI): Handled through “salary_calculator.py” where users provide arguments.
• Web Interface: “app.py” indicates usage of Streamlit for a future or experimental GUI.
• Business Logic & Calculation:
• “functions.py” likely contains the core algorithms to compute the necessary additional salary.
• “salary_calculator.py” acts as the main entry point that orchestrates input arguments, calls the functions, and displays outcomes.
• “constants.py” holds configuration or constant values used in calculations.
• Logging & Observability:
• “logs.py” manages application logging, error reporting, or debugging information.
• Configuration & Dependencies:
• “requirements.txt” lists all Python packages needed.
• The .github/workflows directory (with “hf-space.yml”) shows CI/CD and potential deployment automation (likely for Hugging Face Spaces).
Relationships & Interactions
• The user interacts with the CLI (or Streamlit UI) which launches the corresponding entry point (“salary_calculator.py” for CLI, “app.py” for Streamlit).
• From the entry point, input values are passed to the calculation logic in “functions.py.”
• “constants.py” provides any necessary fixed values used in these computations.
• “logs.py” is integrated with these components to capture logs and diagnostic messages.
• That the output (calculation results) is displayed on the command line or via Streamlit.
Architectural Patterns & Design Principles
• Despite the small scale, the project has a modular design separating the UI, business logic, and configuration.
• This modularity anticipates future extension (REST API or Streamlit-based deployment) and shows a separation-of-concerns principle.
• Flow from user input to processing logic and then output, ensuring each module/component is labeled and its dependencies are highlighted.
Technology and Tools
• Python 3.11 is the runtime.
• Streamlit for the future UI (“app.py”).
• GitHub Actions workflows for auto-deployment (especially to hugging face per “hf-space.yml”).
• The project is configured to run in a Conda environment.