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

establish standard leading __ for virtual packages #8738

Merged
merged 2 commits into from May 30, 2019

Conversation

msarahan
Copy link
Contributor

@msarahan msarahan requested a review from a team as a code owner May 30, 2019 16:31
@msarahan msarahan added this to the 4.7.1 milestone May 30, 2019
@msarahan
Copy link
Contributor Author

msarahan commented May 30, 2019

Note: most of the changes here com from #8689 - I've rebased on that so that I can test this PR with the fixes from #8689 until that PR is merged.

Copy link
Contributor

@kalefranz kalefranz left a comment

Choose a reason for hiding this comment

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

The __ implementation seems fine to me now. Removing all of these solver unit tests seems like a red flag to me, inviting a lot of pain down the road, but up to you I guess.

@@ -249,46 +249,32 @@ def test_prune_1():
specs_to_remove = MatchSpec("numbapro"),
with get_solver(specs_to_remove=specs_to_remove, prefix_records=final_state_1,
history_specs=specs) as solver:
unlink_precs, link_precs = solver.solve_for_diff(prune=False)
Copy link
Contributor

Choose a reason for hiding this comment

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

Between this change and the one on line 345, it looks like there are no longer any tests that verify correct behavior of prune at the unit test level and therefore the --prune flag for the CLI. Is this intentional?

Copy link
Contributor

Choose a reason for hiding this comment

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

For context, the description of prune behavior is

Remove packages that have previously been brought into an environment to satisfy dependencies of user-requested packages, but are no longer needed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think you mean to be commenting on #8689 - I got it wrong on my original comment above.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Prune is the only behavior, as of #8689. Any --prune flag is superfluous. It's actually more of a hybrid, though. It has the --prune behavior for setting up specs_map, more or less, but it will add in other existing specs as long as they don't conflict with any of the explicit specs. Anything that conflicts will be removed. It should be possible, for example, to downgrade a py27 env to a py36 one, and have things like enum34 fall away.

Copy link
Contributor

Choose a reason for hiding this comment

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

and have things like enum34 fall away

That would be more of a "forced" change, to satisfy the specs that the user is requesting in the current operation.

Actually, there are two cases here. Case number one is when enum34 is the traditional conda package tied to a specific python version. Case number two is when enum34 is a noarch python package and is "universal," in that it's designed to work with python =2.7|>=3.3.

The first case would "force" an enum34 removal when switching the environment from python 2.7 to python 3.6, since there would be no enum34 package for python 3.6. The second case could feasibly leave the enum34 package in the environment, even though it wouldn't be used or required by any package in the environment after the change. The solver behavior from 4.4 to 4.6 was designed to make the first case happen automatically, forcing the removal of enum34 if that is what was required to satisfy the specs the user is requesting in the current operation. The --prune flag in 4.4. to 4.6 was designed to address the second case, where the enum34 package would hang around sort of just through "hysteresis," but then provide a way to actually clean up superfluous packages that are no longer a requirement of the full history of user-requested specs.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

With the code as it was, since the entries in specs_map were derived from the prefix records, I found that enum34 couldn't be removed to do the update to python 3.6.

This is more fundamentally a change in how specs_map is constructed. Conflating it with --prune is unavoidable, because it has that effect, but that's not really the goal. The reason for doing this change, first and foremost, is to feed less to the solver. Feeding everything in the env in is bad. Feeding the explicitly requested stuff only is better. Feeding in the explicit stuff plus frozen specs for anything else that doesn't conflict with explicit specs + history is the best I could achieve.

Copy link
Contributor

Choose a reason for hiding this comment

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

I see. So in both cases the enum34 package is removed, and in fact there is no hysteresis like we've had before. Fine with me. Hopefully that's not too much of an issue for the community at large. I think you'll run into an issue on release with conda removing far more packages than users expected (new tickets being filed to that effect). If you're up for handling those, then I like the change.

In fact I think the original solve code in 4.4 was along exactly these lines. We couldn't go with it on a release because very old history files didn't record user-requested specs. There was also an issue of constructor not creating a history file with conda and/or anaconda packages as the first entries for user-requested specs for the Miniconda and Anaconda installers. We might be enough farther along in time now though that those issues won't be as much of a bother. Hopefully that's the case.

Copy link
Contributor

Choose a reason for hiding this comment

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

In this case I'd suggest adding SUPPRESS to the --prune flag so that it can one day be removed from the CLI, and also just removing the context.prune config parameter.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, you left good comments in the code for that, and I learned a lot from them. I don't know about really old history files, but constructor is at least doing the right thing now, and has been for a while.

Fingers crossed that there won't be too many unexpected broken envs from weird histories, but I think this bullet is worth biting.

# 'channel-1::pandas-0.11.0-np16py27_1',
# )
# assert convert_to_dist_str(final_state_2) == order
# assert solver._r.environment_is_consistent(final_state_2)
Copy link
Contributor

Choose a reason for hiding this comment

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

Looks like we've removed a lot of behavior testing/enforcement here too. Just want to make sure that was intentional.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Some of this can/should go back. I'll re-examine it before merging. Thanks for pointing it out.

assert convert_to_dist_str(unlink_precs) == unlink_order
assert convert_to_dist_str(link_precs) == link_order


Copy link
Contributor

Choose a reason for hiding this comment

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

Removing tests that ensure correct feature behavior I guess?

@github-actions
Copy link

Hi there, thank you for your contribution to Conda!

This pull request has been automatically locked since it has not had recent activity after it was closed.

Please open a new issue or pull request if needed.

@github-actions github-actions bot added the locked [bot] locked due to inactivity label Aug 27, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 27, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
locked [bot] locked due to inactivity
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants