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

Resolve symlinks from path to environment for setting path #5704

Merged
merged 1 commit into from
Apr 12, 2023

Conversation

Czaki
Copy link
Collaborator

@Czaki Czaki commented Apr 8, 2023

Description

I have observed that when using pyenv to manage python environments, depending on way to run napari I got different settings path.

$ python -m napari 
/home/czaki/.pyenv/versions/napari 
...
$ napari           
/home/czaki/.pyenv/versions/3.8.3/envs/napari
...

but it is the fact this was the path to the same env, but one of them uses symlinks.

lrwxrwxrwx  1 czaki grzegorz   45 lip  9  2020  napari -> /home/czaki/.pyenv/versions/3.8.3/envs/napari

So I add the step of resolving the path to get the full path without symlinks.

References

Type of change

  • Bug-fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How has this been tested?

  • example: the test suite for my feature covers cases x, y, and z
  • example: all tests pass with my change
  • example: I check if my changes works with both PySide and PyQt backends
    as there are small differences between the two Qt bindings.

Final checklist:

  • My PR is the minimum possible work for the desired functionality
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works
  • If I included new strings, I have used trans. to make them localizable.
    For more information see our translations guide.

@codecov
Copy link

codecov bot commented Apr 8, 2023

Codecov Report

Merging #5704 (7be6502) into main (e12acd8) will increase coverage by 0.00%.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##             main    #5704   +/-   ##
=======================================
  Coverage   89.84%   89.84%           
=======================================
  Files         608      608           
  Lines       51693    51694    +1     
=======================================
+ Hits        46441    46446    +5     
+ Misses       5252     5248    -4     
Impacted Files Coverage Δ
napari/utils/_appdirs.py 76.66% <100.00%> (+0.80%) ⬆️

... and 3 files with indirect coverage changes

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

Copy link
Member

@andy-sweet andy-sweet left a comment

Choose a reason for hiding this comment

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

Good catch and thanks for the quick fix!

@Czaki Czaki added the ready to merge Last chance for comments! Will be merged in ~24h label Apr 10, 2023
@Czaki Czaki merged commit 66df74d into napari:main Apr 12, 2023
@Czaki Czaki deleted the fix_settings_path branch April 12, 2023 22:41
@Czaki Czaki added bugfix PR with bugfix and removed ready to merge Last chance for comments! Will be merged in ~24h labels Apr 13, 2023
@Czaki Czaki mentioned this pull request Jun 7, 2023
@psobolewskiPhD psobolewskiPhD added this to the 0.4.18 milestone Jun 8, 2023
Czaki added a commit that referenced this pull request Jun 19, 2023
<!-- What does this pull request (PR) do? Why is it necessary? -->
<!-- Tell us about your new feature, improvement, or fix! -->
<!-- If your change includes user interface changes, please add an
image, or an animation "An image is worth a thousand words!" -->
<!-- You can use https://www.cockos.com/licecap/ or similar to create
animations -->

I have observed that when using `pyenv` to manage python environments,
depending on way to run napari I got different settings path.

```
$ python -m napari
/home/czaki/.pyenv/versions/napari
...
$ napari
/home/czaki/.pyenv/versions/3.8.3/envs/napari
...
```

but it is the fact this was the path to the same env, but one of them
uses symlinks.
```
lrwxrwxrwx  1 czaki grzegorz   45 lip  9  2020  napari -> /home/czaki/.pyenv/versions/3.8.3/envs/napari
```

So I add the step of resolving the path to get the full path without
symlinks.

<!-- What resources, documentation, and guides were used in the creation
of this PR? -->

<!-- Please delete options that are not relevant. -->
- [x] Bug-fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing
functionality to not work as expected)
- [ ] This change requires a documentation update

<!-- Please describe the tests that you ran to verify your changes. -->
- [ ] example: the test suite for my feature covers cases x, y, and z
- [ ] example: all tests pass with my change
- [ ] example: I check if my changes works with both PySide and PyQt
backends
      as there are small differences between the two Qt bindings.

- [ ] My PR is the minimum possible work for the desired functionality
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] I have made corresponding changes to the documentation
- [ ] I have added tests that prove my fix is effective or that my
feature works
- [ ] If I included new strings, I have used `trans.` to make them
localizable.
For more information see our [translations
guide](https://napari.org/developers/translations.html).
Czaki added a commit that referenced this pull request Jun 21, 2023
<!-- What does this pull request (PR) do? Why is it necessary? -->
<!-- Tell us about your new feature, improvement, or fix! -->
<!-- If your change includes user interface changes, please add an
image, or an animation "An image is worth a thousand words!" -->
<!-- You can use https://www.cockos.com/licecap/ or similar to create
animations -->

I have observed that when using `pyenv` to manage python environments,
depending on way to run napari I got different settings path.

```
$ python -m napari
/home/czaki/.pyenv/versions/napari
...
$ napari
/home/czaki/.pyenv/versions/3.8.3/envs/napari
...
```

but it is the fact this was the path to the same env, but one of them
uses symlinks.
```
lrwxrwxrwx  1 czaki grzegorz   45 lip  9  2020  napari -> /home/czaki/.pyenv/versions/3.8.3/envs/napari
```

So I add the step of resolving the path to get the full path without
symlinks.

<!-- What resources, documentation, and guides were used in the creation
of this PR? -->

<!-- Please delete options that are not relevant. -->
- [x] Bug-fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing
functionality to not work as expected)
- [ ] This change requires a documentation update

<!-- Please describe the tests that you ran to verify your changes. -->
- [ ] example: the test suite for my feature covers cases x, y, and z
- [ ] example: all tests pass with my change
- [ ] example: I check if my changes works with both PySide and PyQt
backends
      as there are small differences between the two Qt bindings.

- [ ] My PR is the minimum possible work for the desired functionality
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] I have made corresponding changes to the documentation
- [ ] I have added tests that prove my fix is effective or that my
feature works
- [ ] If I included new strings, I have used `trans.` to make them
localizable.
For more information see our [translations
guide](https://napari.org/developers/translations.html).
Czaki added a commit that referenced this pull request Jun 21, 2023
<!-- What does this pull request (PR) do? Why is it necessary? -->
<!-- Tell us about your new feature, improvement, or fix! -->
<!-- If your change includes user interface changes, please add an
image, or an animation "An image is worth a thousand words!" -->
<!-- You can use https://www.cockos.com/licecap/ or similar to create
animations -->

I have observed that when using `pyenv` to manage python environments,
depending on way to run napari I got different settings path.

```
$ python -m napari
/home/czaki/.pyenv/versions/napari
...
$ napari
/home/czaki/.pyenv/versions/3.8.3/envs/napari
...
```

but it is the fact this was the path to the same env, but one of them
uses symlinks.
```
lrwxrwxrwx  1 czaki grzegorz   45 lip  9  2020  napari -> /home/czaki/.pyenv/versions/3.8.3/envs/napari
```

So I add the step of resolving the path to get the full path without
symlinks.

<!-- What resources, documentation, and guides were used in the creation
of this PR? -->

<!-- Please delete options that are not relevant. -->
- [x] Bug-fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing
functionality to not work as expected)
- [ ] This change requires a documentation update

<!-- Please describe the tests that you ran to verify your changes. -->
- [ ] example: the test suite for my feature covers cases x, y, and z
- [ ] example: all tests pass with my change
- [ ] example: I check if my changes works with both PySide and PyQt
backends
      as there are small differences between the two Qt bindings.

- [ ] My PR is the minimum possible work for the desired functionality
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] I have made corresponding changes to the documentation
- [ ] I have added tests that prove my fix is effective or that my
feature works
- [ ] If I included new strings, I have used `trans.` to make them
localizable.
For more information see our [translations
guide](https://napari.org/developers/translations.html).
Czaki added a commit that referenced this pull request Jun 21, 2023
# Description
<!-- What does this pull request (PR) do? Why is it necessary? -->
<!-- Tell us about your new feature, improvement, or fix! -->
<!-- If your change includes user interface changes, please add an
image, or an animation "An image is worth a thousand words!" -->
<!-- You can use https://www.cockos.com/licecap/ or similar to create
animations -->

I have observed that when using `pyenv` to manage python environments,
depending on way to run napari I got different settings path.

```
$ python -m napari 
/home/czaki/.pyenv/versions/napari 
...
$ napari           
/home/czaki/.pyenv/versions/3.8.3/envs/napari
...
```

but it is the fact this was the path to the same env, but one of them
uses symlinks.
```
lrwxrwxrwx  1 czaki grzegorz   45 lip  9  2020  napari -> /home/czaki/.pyenv/versions/3.8.3/envs/napari
```

So I add the step of resolving the path to get the full path without
symlinks.

# References
<!-- What resources, documentation, and guides were used in the creation
of this PR? -->

## Type of change
<!-- Please delete options that are not relevant. -->
- [x] Bug-fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing
functionality to not work as expected)
- [ ] This change requires a documentation update

# How has this been tested?
<!-- Please describe the tests that you ran to verify your changes. -->
- [ ] example: the test suite for my feature covers cases x, y, and z
- [ ] example: all tests pass with my change
- [ ] example: I check if my changes works with both PySide and PyQt
backends
      as there are small differences between the two Qt bindings.  

## Final checklist:
- [ ] My PR is the minimum possible work for the desired functionality
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] I have made corresponding changes to the documentation
- [ ] I have added tests that prove my fix is effective or that my
feature works
- [ ] If I included new strings, I have used `trans.` to make them
localizable.
For more information see our [translations
guide](https://napari.org/developers/translations.html).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugfix PR with bugfix
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants