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

Allow relative paths for sources #229

Closed
riccardoporreca opened this issue Aug 9, 2022 · 4 comments
Closed

Allow relative paths for sources #229

riccardoporreca opened this issue Aug 9, 2022 · 4 comments

Comments

@riccardoporreca
Copy link
Contributor

Since #189, paths stored in the lockfile are stored as absolute, to address the issue in #175 where the lockfile and the sources are not on the same drive.

However, there was probably a point in relative paths and the change has its drawback for other (more common?). Consider sources and lockfiles maintained under version control in the same repo: one wouldn't want to produce and push lockfiles containing references to the absolute path of the local checkout.

I think using absolute paths should be opt-in, or used in case the construction of relative paths does not work.

@riccardoporreca
Copy link
Contributor Author

A sensible approach might be to restore the old behavior unless the source path is absolute, so absolute source paths (possibly including the drive) would stay as absolute. This should still address #175 but keep the (more sensible?) behavior for the other cases

@riccardoporreca
Copy link
Contributor Author

Actually, #189 might have introduced an inconsistency with the logic (from df566dc) for reconstructing the source file path from the lock file itself if not specified

https://github.com/conda-incubator/conda-lock/blob/7d9bd6d67d59fdd30d92a2ace3ee344aafa6a2b1/conda_lock/conda_lock.py#L920-L932

which is probably broken: I haven't tested it, but I assume "reconstruct native paths" would fail for absolute paths in lock_content.metadata.sources.

I think the "sensible approach" hinted above would be easily to mirror in a consistent way in this logic as well. I will try to draft a PR.

riccardoporreca added a commit to riccardoporreca/conda-lock that referenced this issue Aug 10, 2022
riccardoporreca added a commit to riccardoporreca/conda-lock that referenced this issue Aug 10, 2022
* Addressing the inconsistency with the absolute source paths introduced in conda#175 and noticed in conda#229.
@JessicaS11
Copy link

Just wanted to leave a note that I support an opt-in (or at the very least optional) use of absolute paths. In our use case, we have multiple contributors who might update the lock files locally, and with absolute paths conda-lock.yml lists each person's local path as source (rather than just the shared environment.yml). Thanks for working on an update for this!

riccardoporreca added a commit to riccardoporreca/conda-lock that referenced this issue Feb 4, 2023
* This was broken in conda#189, which introduced absolute source paths, and will be handled in conda#229.
riccardoporreca added a commit to riccardoporreca/conda-lock that referenced this issue Feb 4, 2023
* Fixes conda#229, relying on what introduced in conda#204 for the input metadata, by explicitly handling only the case of different drives for keeping absolute paths, addressing conda#175.
riccardoporreca added a commit to riccardoporreca/conda-lock that referenced this issue Feb 4, 2023
* Addressing the inconsistency with the absolute source paths introduced in conda#175 and noticed in conda#229.
maresb pushed a commit that referenced this issue Feb 25, 2023
* This was broken in #189, which introduced absolute source paths, and will be handled in #229.
@maresb maresb closed this as completed in d6b450c Feb 25, 2023
maresb pushed a commit that referenced this issue Feb 25, 2023
* Addressing the inconsistency with the absolute source paths introduced in #175 and noticed in #229.
@maresb
Copy link
Contributor

maresb commented Mar 15, 2023

@JessicaS11 I'm curious about your use case for opt-in of absolute paths. Would you want the path to the source file environment.yml to be absolute, or the conda-lock.yml in the comment header, or both?

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 a pull request may close this issue.

3 participants