Skip to content

Conversation

@KelvinLinBU
Copy link
Member

@KelvinLinBU KelvinLinBU commented Apr 22, 2025

Closes #168. Adhere to testing best practices as outlined in #159 (comment) and #168 (comment). Modify utils.py to accommodate changes.

@QuanMPhm QuanMPhm requested review from QuanMPhm and larsks and removed request for QuanMPhm April 22, 2025 14:56
@KelvinLinBU KelvinLinBU self-assigned this May 14, 2025
@KelvinLinBU KelvinLinBU force-pushed the refactor-env branch 3 times, most recently from 63d9226 to 6d1bdef Compare May 29, 2025 16:02
@KelvinLinBU
Copy link
Member Author

@QuanMPhm can be merged with main now

- NewPICreditProcessor
"""

chrome_binary_location: str
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you move this arg below the constants. In this codebase, the conventional structure is class constants, then variables, then functions

chrome_binary_location = os.environ.get(
"CHROME_BIN_PATH", "/usr/bin/chromium"
)
if not os.path.exists(chrome_binary_location):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You do not need to move this check to process_report.py. We only want to move the fetching of the env var. Error checking can stay in the invoice class for now.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should add CHROME_BIN_PATH in REQUIRED_ENV_VARS

def main():
"""Remove non-billable PIs and projects"""

chrome_binary_location = os.environ.get("CHROME_BIN_PATH", "/usr/bin/chromium")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Related to the adding CHROME_BIN_PATH to REQUIRED_ENV_VARS, you should have the env var fetched after the env vars have been validated

…ipeline.

This makes use of `required_env_vars()`.
@QuanMPhm QuanMPhm requested review from knikolla and naved001 July 24, 2025 15:01
@QuanMPhm QuanMPhm dismissed their stale review August 1, 2025 14:13

I am now a contributor to this PR as well

subprocess.run(
[
CHROME_BIN_PATH,
os.environ.get("CHROME_BIN_PATH", "/usr/bin/chromium"),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What was the motivation for this change? I think it's generally better practice to read your environment variables early, rather than doing it inline like this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Refactor invoices so all env vars are fetched at the start of billing pipeline

3 participants