Skip to content

Conversation

@AlexandreSinger
Copy link
Contributor

@AlexandreSinger AlexandreSinger commented Nov 15, 2025

The format test for CPP was done through a bash script which calls make
format under the hood. The issue was that if make format fails, it
thinks that the formatting is good, which is bad. I have fixed the
script so that it actually fails if make format fails.

The thing that was causing make format to fail was that the dependencies
that VPR needs to build were not installed. Added these dependencies.

@github-actions github-actions bot added the infra Project Infrastructure label Nov 15, 2025
@github-actions github-actions bot added the lang-shell Shell scripts (bash etc.) label Nov 15, 2025
@AlexandreSinger
Copy link
Contributor Author

Ok, I was close. Its not a Python issue (or maybe its not). Its a dependencies issue:
image

image image

I did not install all of the dependencies since, why would you need dependencies if you are just doing formatting... But it looks like VTR cannot even be formatted without installing the dependencies. Thats kinda annoying but whatever.

@AlexandreSinger
Copy link
Contributor Author

image

Ug. It also needs submodules. Thats fun...

@AlexandreSinger
Copy link
Contributor Author

image

Looks like the python tests are failing for the same reason. Thats fun.

The format test for CPP was done through a bash script which calls make
format under the hood. The issue was that if make format fails, it
thinks that the formatting is good, which is bad. I have fixed the
script so that it actually fails if make format fails.

The thing that was causing make format to fail was that the dependencies
that VPR needs to build were not installed. Added these dependencies.
The formatter was failing on some python files since they were using the
Python2 syntax for the print statements instead of the Python3 syntax.
Run make format-py to fix all Python format issues.
@github-actions github-actions bot added Odin Odin II Logic Synthesis Tool: Unsorted item lang-python Python code labels Nov 15, 2025
Now that the CI test is fixed, I have resolved all outstanding
format issues.
@github-actions github-actions bot added VPR VPR FPGA Placement & Routing Tool lang-cpp C/C++ code labels Nov 15, 2025
Copy link
Contributor

@AmirhosseinPoolad AmirhosseinPoolad left a comment

Choose a reason for hiding this comment

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

Thanks for doing this Alex! LGTM.

P.S. We have so many Python 2 scripts! Is there a tool that can check a .py file and check if it's compatible with python 2 or 3?



def usage():
print USAGE_TEXT
Copy link
Contributor

Choose a reason for hiding this comment

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

Unrelated to this PR:

Woah! is that python 2? Do we even run this anywhere?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Many of the scripts in VTR are not run by the CI. I do not have any hard data on this, but I think most Python scripts outside of vtr_task's python libs are not run at all.

Another issue is that Python is an interpreted language; so a Python2 syntax file can be executed by a Python3 interpreter and not crash unless it hits a magic if statement which prints something. I actually saw a file with this exact problem.

@AlexandreSinger
Copy link
Contributor Author

Thanks for doing this Alex! LGTM.

P.S. We have so many Python 2 scripts! Is there a tool that can check a .py file and check if it's compatible with python 2 or 3?

@AmirhosseinPoolad I agree. I do not like it either, I am not aware of any tool; however, I think the Python linter was running the python code in some form since it drew my attention to this Python2 syntax issues (and had me fix them) without actually executing the code. However, this process has to be limited since Python is interpreted and the types of variables are not known until run time.

@AlexandreSinger AlexandreSinger merged commit a632849 into master Nov 16, 2025
30 checks passed
@AlexandreSinger AlexandreSinger deleted the feature-fix-cpp-format branch November 16, 2025 02:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

infra Project Infrastructure lang-cpp C/C++ code lang-python Python code lang-shell Shell scripts (bash etc.) Odin Odin II Logic Synthesis Tool: Unsorted item VPR VPR FPGA Placement & Routing Tool

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants