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

Replace bundled conda-index with standalone conda-index package #4690

Closed
wants to merge 30 commits into from

Conversation

dholth
Copy link
Contributor

@dholth dholth commented Jan 4, 2023

Description

Delegate conda-build's conda-index while keeping code for deprecation cycle reasons.

Could we delete the hotfix-source-repo argument as it has been unused for longer than a deprecation cycle?

Fix #4645

We should probably delete the entire test_index.py which is now part of conda-index. Is there any part of index testing that needs to remain here, perhaps the legacy API? Assuming get_build_index is tested as part of all the conda-build invocations done by us.

Checklist - did you ...

  • Add a file to the news directory (using the template) for the next release's release notes?
  • Add / update necessary tests?
  • Add / update outdated documentation?

@conda-bot conda-bot added the cla-signed [bot] added once the contributor has signed the CLA label Jan 4, 2023
@dholth dholth self-assigned this Jan 4, 2023
@dholth dholth added the in-progress issue is actively being worked on label Jan 4, 2023
@dholth dholth requested a review from kenodegard January 4, 2023 21:52
"msys2-conda-epoch": "m2w64",
}
NAMESPACE_PACKAGE_NAMES = frozenset(NAMESPACES_MAP)
NAMESPACES = frozenset(NAMESPACES_MAP.values())
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Is this used?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it wouldn't be surprising if conda.base.constants exists in all conda > 4.7 or the oldest one we can depend on.

# Copyright (C) 2014 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
"""
conda-build's use of conda-index, delegated to now-separate conda-index package.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copied to make keeping track of all the changes easier, and to discourage future conda_build.index imports

Copy link
Member

Choose a reason for hiding this comment

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

To clarify, we couldn't continue to have index.py as the place for this code to live? Or asked differently, the get_build_index function, is that something that we have in conda-index? I'm a little worried we're introducing another place where users will end up importing from :)

Copy link
Contributor Author

@dholth dholth Jan 6, 2023

Choose a reason for hiding this comment

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

get_build_index is only in conda-build. It is mostly about fetching repodata.json instead of generating repodata.json. It would of course be possible to keep it in conda_build.index

Copy link
Contributor Author

Choose a reason for hiding this comment

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

However we might want to raise deprecationwarning when conda_build.index is imported.

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think this submodule should exist.

Plus, all of conda.index should be deprecated with warnings to import from conda-index instead.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Do you mean conda.index or conda_build.index

Reminder that conda-build's get_build_index doesn't belong in conda-index.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@kenodegard @jezdez I moved this module back to conda_build.index

@@ -90,8 +90,8 @@ def execute(args):

api.update_index(args.dir, check_md5=args.check_md5, channel_name=args.channel_name,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Would love to delete this whole file.

conda-index has a nice click CLI, but doesn't take the same arguments.

Copy link
Contributor Author

@dholth dholth Jan 6, 2023

Choose a reason for hiding this comment

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

this might be able to use the non-api update_index, the api version is basically "call update_index for every dir in a list"

channel_urls=channel_urls, debug=debug, verbose=verbose,
locking=locking, timeout=timeout)
bldpkgs_dir = list(bldpkgs_dirs)[0]
index, index_ts, _ = build_index.get_build_index(subdir, bldpkgs_dir, output_folder, False,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

inline function courtesy of pycharm refactor feature


return build_index.update_index(dir_path, check_md5, channel_name, patch_generator, threads,
verbose, progress, hotfix_source_repo, subdirs, warn,
current_index_versions, debug, index_file)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

As of today an unused copy of the full index implementation remains in this file, for deprecation cycle reasons.

Copy link
Member

@jezdez jezdez left a comment

Choose a reason for hiding this comment

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

I have a few questions about the deprecation strategy of this code, and generally think we need to use deprecation warnings here and not only shims around the old code paths.

# Copyright (C) 2014 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
"""
conda-build's use of conda-index, delegated to now-separate conda-index package.
Copy link
Member

Choose a reason for hiding this comment

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

To clarify, we couldn't continue to have index.py as the place for this code to live? Or asked differently, the get_build_index function, is that something that we have in conda-index? I'm a little worried we're introducing another place where users will end up importing from :)

@dholth
Copy link
Contributor Author

dholth commented Jan 6, 2023

I'm still figuring out the best way to do deprecation. The current strategy is to leave the unused methods in, and come back a year later to remove the code. Deprecating the CLI is still an unanswered question. Some of the indexing has changed little enough that the old CLI could be kept in forever, minus the "list of files to re-index" feature.

@dholth
Copy link
Contributor Author

dholth commented Jan 20, 2023

@kenodegard I updated, and tried to keep the main branch's version of the test configs.

@dholth
Copy link
Contributor Author

dholth commented Feb 3, 2023

I've updated this to remove the new build_index.py and copy it over to index.py instead (since the redundant fuctionality in index is in standalone conda-index).

@dholth dholth closed this Feb 4, 2023
@dholth dholth reopened this Feb 4, 2023
Copy link
Contributor

@kenodegard kenodegard left a comment

Choose a reason for hiding this comment

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

Minor edits but is otherwise good to go

@@ -17,7 +17,7 @@
@pytest.mark.parametrize(
"package,license_id,license_family,license_files",
[
("r-rmarkdown", "GPL-3", "GPL3", {"GPL-3"}),
# ("r-rmarkdown", "GPL-3", "GPL3", {"GPL-3"}), # fails with connection error
Copy link
Contributor

Choose a reason for hiding this comment

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

This is a flaky test, not a failing test

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Seems like a pointless test IMO

Copy link
Contributor

Choose a reason for hiding this comment

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

That's fine but let's have that conversation/effort elsewhere, we want to keep PRs as focused as possible

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We constantly face a simple choice between a focused PR and a PR with passing tests.

Comment on lines +11 to +12
* `conda-build index --file` is no longer supported.
* `conda-build index --hotfix-source-repo` is removed.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
* `conda-build index --file` is no longer supported.
* `conda-build index --hotfix-source-repo` is removed.
* `conda-build index --file` is no longer supported and is pending deprecation. (#4690)
* `conda-build index --hotfix-source-repo` is no longer supported and is pending deprecation. (#4690)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Trying to communicate that --file no longer does anything, and --hotfix-source-repo produces an "unknown command line argument" error.

Copy link
Contributor

Choose a reason for hiding this comment

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

Per CEP9 we shouldn't be removing things outright. We should update the code to allow these arguments but raise deprecation warnings with instructions on what to do instead.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Doesn't CEP9 only apply to conda?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This script is probably run in a non-interactive cron job. We could print a warning and fail to do what the user expects, since they are not actually there to observe the deprecation warning. Instead the current code exits.

Co-authored-by: Ken Odegard <kodegard@anaconda.com>
Copy link
Contributor

@kenodegard kenodegard left a comment

Choose a reason for hiding this comment

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

My biggest question is how do we know if the new conda-index works like the old conda-index? Is it possible to get tests/test_index.py to verify the new codes? Or add tests/cli/test_main_index.py?

@dholth
Copy link
Contributor Author

dholth commented Mar 3, 2023

My biggest question is how do we know if the new conda-index works like the old conda-index? Is it possible to get tests/test_index.py to verify the new codes? Or add tests/cli/test_main_index.py?

conda-index has its own pretty good test suite that is based on the old conda-build suite, in the same way that the rest of the conda-index code is based on its counterpart from conda-build. It has also been in production for defaults & conda-forge for 6+ months.

@dholth
Copy link
Contributor Author

dholth commented Mar 3, 2023

This isn't complying with the conda deprecation policy. The index.py module has dramatically changed, and we haven't meticulously gone through to deprecate each individual changed function or provide an alternative; and keeping the unchanged old code around for a deprecation cycle while putting the new code in a separate module also appears to be unacceptable.

@dholth dholth closed this Mar 3, 2023
@github-actions github-actions bot added the locked [bot] locked due to inactivity label Mar 3, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 3, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
cla-signed [bot] added once the contributor has signed the CLA in-progress issue is actively being worked on locked [bot] locked due to inactivity
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Replace conda_build/index.py with standalone conda-index
4 participants