Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Point to the right Lightning root folder independently from the invocation folder #874

Merged
merged 5 commits into from
Aug 29, 2024

Conversation

rauletorresc
Copy link
Contributor

Context: configure_pyproject_toml.py assumes it is being invoked from the root directory of Lightning. But the reality is that it can be invoked from anywhere else.

Description of the Change: Calculate safely the root folder by traversing back the folder structure starting from the current file location.

Benefits: The file can be invoked from any place.

@rauletorresc rauletorresc requested review from dime10 and a team August 27, 2024 22:26
@rauletorresc rauletorresc self-assigned this Aug 27, 2024
Copy link
Contributor

Hello. You may have forgotten to update the changelog!
Please edit .github/CHANGELOG.md with:

  • A one-to-two sentence description of the change. You may include a small working example for new features.
  • A link back to this PR.
  • Your name (or GitHub username) in the contributors section.

Copy link

codecov bot commented Aug 27, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 78.05%. Comparing base (2189af1) to head (54f5c63).
Report is 78 commits behind head on master.

❗ There is a different number of reports uploaded between BASE (2189af1) and HEAD (54f5c63). Click for more details.

HEAD has 76 uploads less than BASE
Flag BASE (2189af1) HEAD (54f5c63)
83 7
Additional details and impacted files
@@             Coverage Diff             @@
##           master     #874       +/-   ##
===========================================
- Coverage   98.35%   78.05%   -20.31%     
===========================================
  Files         117       17      -100     
  Lines       19405     1991    -17414     
===========================================
- Hits        19086     1554    -17532     
- Misses        319      437      +118     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@dime10 dime10 left a comment

Choose a reason for hiding this comment

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

Nice!

Copy link
Contributor

@AmintorDusko AmintorDusko left a comment

Choose a reason for hiding this comment

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

Hi @rauletorresc, thank you for your prompt answer to this problem.
I'm actually still having problems executing this script outside of the root directory.
How are you testing that? Which toml package are you using locally?

Traceback:

  File "configure_pyproject_toml.py", line 56, in <module>
    pyproject = toml.load(pyproject_path)
  File "/venv/lightning_310/lib/python3.10/site-packages/toml/decoder.py", line 133, in load
    with io.open(_getpath(f), encoding='utf-8') as ffile:
FileNotFoundError: [Errno 2] No such file or directory: 'pyproject.toml'

@rauletorresc
Copy link
Contributor Author

Hi @rauletorresc, thank you for your prompt answer to this problem. I'm actually still having problems executing this script outside of the root directory. How are you testing that? Which toml package are you using locally?

Traceback:

  File "configure_pyproject_toml.py", line 56, in <module>
    pyproject = toml.load(pyproject_path)
  File "/venv/lightning_310/lib/python3.10/site-packages/toml/decoder.py", line 133, in load
    with io.open(_getpath(f), encoding='utf-8') as ffile:
FileNotFoundError: [Errno 2] No such file or directory: 'pyproject.toml'

I forgot to update one variable that was still assuming it was in the root folder of Lightning. Tested locally on my machine. Could you please try again?

Copy link
Contributor

@AmintorDusko AmintorDusko left a comment

Choose a reason for hiding this comment

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

It works now! This is great! Thanks!

Copy link
Contributor

@AmintorDusko AmintorDusko left a comment

Choose a reason for hiding this comment

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

Please don't forget to update the changelog. @vincentmr, do we want to merge this directly with the release candidate?

@vincentmr
Copy link
Contributor

do we want to merge this directly with the release candidate?

I think so, this looks like a bug fix of sort.

@rauletorresc rauletorresc changed the base branch from master to v0.38.0_rc August 29, 2024 13:50
@rauletorresc rauletorresc changed the base branch from v0.38.0_rc to master August 29, 2024 14:28
@rauletorresc
Copy link
Contributor Author

Please don't forget to update the changelog. @vincentmr, do we want to merge this directly with the release candidate?

Done

@rauletorresc
Copy link
Contributor Author

do we want to merge this directly with the release candidate?

I think so, this looks like a bug fix of sort.

Can I merge it to master and you cheery-pick it from RC? I don't want to mess with your release :)

@vincentmr
Copy link
Contributor

Can I merge it to master and you cheery-pick it from RC? I don't want to mess with your release :)

NP, let's do that.

@rauletorresc rauletorresc merged commit 756eb7b into master Aug 29, 2024
80 of 81 checks passed
@rauletorresc rauletorresc deleted the raultorres/correct_root_folder branch August 29, 2024 15:54
vincentmr pushed a commit that referenced this pull request Aug 29, 2024
…ation folder (#874)

**Context:** `configure_pyproject_toml.py` assumes it is being invoked
from the root directory of Lightning. But the reality is that it can be
invoked from anywhere else.

**Description of the Change:** Calculate safely the root folder by
traversing back the folder structure starting from the current file
location.

**Benefits:** The file can be invoked from any place.

---------

Co-authored-by: ringo-but-quantum <github-ringo-but-quantum@xanadu.ai>
multiphaseCFD pushed a commit that referenced this pull request Sep 8, 2024
…ation folder (#874)

**Context:** `configure_pyproject_toml.py` assumes it is being invoked
from the root directory of Lightning. But the reality is that it can be
invoked from anywhere else.

**Description of the Change:** Calculate safely the root folder by
traversing back the folder structure starting from the current file
location.

**Benefits:** The file can be invoked from any place.

---------

Co-authored-by: ringo-but-quantum <github-ringo-but-quantum@xanadu.ai>
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.

5 participants