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

MRG: support proper manifest creation with --relpath for sig check and sig collect #3054

Merged
merged 31 commits into from
Mar 8, 2024
Merged
Changes from 1 commit
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
5f6ef82
load manifest paths relative to cwd
ctb Mar 1, 2024
2405e9d
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Mar 1, 2024
df87087
more better tests
ctb Mar 1, 2024
d7da0aa
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Mar 1, 2024
0caee7f
implement --abspath, --relpath for sig check
ctb Mar 2, 2024
1fba4ee
clean up relpath a bit
ctb Mar 2, 2024
f3079b9
add --relpath to sig collect
ctb Mar 2, 2024
b17cd4f
implement --relpath for sig collect too
ctb Mar 3, 2024
72a9062
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Mar 3, 2024
5cf4749
straighten out tests
ctb Mar 3, 2024
d6dfe35
add abspath/relpath to sig collect tests
ctb Mar 3, 2024
da3f165
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Mar 3, 2024
b185be9
add abspath/relpath tests for sig collect
ctb Mar 3, 2024
9d2018c
Merge branch 'manifest_relpath' of https://github.com/sourmash-bio/so…
ctb Mar 3, 2024
28e0a5b
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Mar 3, 2024
e9b9a34
fix/update comments
ctb Mar 3, 2024
f88c662
update docs for sig check and sig collect
ctb Mar 3, 2024
4e10802
add in some documentation about relpath in sourmash internals
ctb Mar 3, 2024
6dd3e3a
path rewriting tests for sig check
ctb Mar 3, 2024
e3bb509
update docs
ctb Mar 3, 2024
703585c
add --relpath tests for sig collect
ctb Mar 3, 2024
346ed82
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Mar 3, 2024
637b1fc
a few more tests
ctb Mar 3, 2024
8b1bc2c
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Mar 3, 2024
3e41cdb
Merge branch 'latest' of https://github.com/sourmash-bio/sourmash int…
ctb Mar 5, 2024
1ade436
upd with warning when abspath given with --relpath
ctb Mar 5, 2024
6ef3d88
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Mar 5, 2024
afde775
Merge branch 'latest' into manifest_relpath
ctb Mar 6, 2024
0c1aa27
Merge branch 'latest' of https://github.com/sourmash-bio/sourmash int…
ctb Mar 7, 2024
27e8c32
Merge branch 'manifest_relpath' of https://github.com/sourmash-bio/so…
ctb Mar 7, 2024
1e3688a
update docstring for StandaloneManifestIndex
ctb Mar 7, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
pre-commit-ci[bot] committed Mar 3, 2024
commit da3f16586503f990f4124e67d2fbff2639978fea
1 change: 1 addition & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
@@ -95,6 +95,7 @@ def sig_save_extension_abund(request):
def abspath_or_relpath(request):
return request.param


# this will fail if subdirs used; see #3008. but ths ensures v4 behavior of
# sig collect/sig check works, where manifest paths interpreted relative
# to cwd.
52 changes: 44 additions & 8 deletions tests/test_cmd_signature_collect.py
Original file line number Diff line number Diff line change
@@ -19,7 +19,15 @@ def test_sig_collect_0_nothing(runtmp, manifest_db_format, abspath_relpath_v4):
if manifest_db_format != "sql":
return

runtmp.sourmash("sig", "collect", "-o", f"mf.{ext}", "-F", manifest_db_format, abspath_relpath_v4)
runtmp.sourmash(
"sig",
"collect",
"-o",
f"mf.{ext}",
"-F",
manifest_db_format,
abspath_relpath_v4,
)

manifest_fn = runtmp.output(f"mf.{ext}")
manifest = BaseCollectionManifest.load_from_filename(manifest_fn)
@@ -34,7 +42,14 @@ def test_sig_collect_1_zipfile(runtmp, manifest_db_format, abspath_relpath_v4):
ext = "sqlmf" if manifest_db_format == "sql" else "csv"

runtmp.sourmash(
"sig", "collect", protzip, "-o", f"mf.{ext}", "-F", manifest_db_format, abspath_relpath_v4
"sig",
"collect",
protzip,
"-o",
f"mf.{ext}",
"-F",
manifest_db_format,
abspath_relpath_v4,
)

manifest_fn = runtmp.output(f"mf.{ext}")
@@ -50,7 +65,9 @@ def test_sig_collect_1_zipfile_csv_gz(runtmp, abspath_relpath_v4):
# collect a manifest from a .zip file, save to csv.gz
protzip = utils.get_test_data("prot/protein.zip")

runtmp.sourmash("sig", "collect", protzip, "-o", "mf.csv.gz", "-F", "csv", abspath_relpath_v4)
runtmp.sourmash(
"sig", "collect", protzip, "-o", "mf.csv.gz", "-F", "csv", abspath_relpath_v4
)

manifest_fn = runtmp.output("mf.csv.gz")

@@ -71,7 +88,9 @@ def test_sig_collect_1_zipfile_csv_gz_roundtrip(runtmp, abspath_relpath_v4):
# collect a manifest from a .zip file, save to csv.gz; then load again
protzip = utils.get_test_data("prot/protein.zip")

runtmp.sourmash("sig", "collect", protzip, "-o", "mf.csv.gz", "-F", "csv", abspath_relpath_v4)
runtmp.sourmash(
"sig", "collect", protzip, "-o", "mf.csv.gz", "-F", "csv", abspath_relpath_v4
)

manifest_fn = runtmp.output("mf.csv.gz")

@@ -133,7 +152,14 @@ def test_sig_collect_2_exists_merge(runtmp, manifest_db_format, abspath_relpath_
ext = "sqlmf" if manifest_db_format == "sql" else "csv"

runtmp.sourmash(
"sig", "collect", protzip, "-o", f"mf.{ext}", "-F", manifest_db_format, abspath_relpath_v4,
"sig",
"collect",
protzip,
"-o",
f"mf.{ext}",
"-F",
manifest_db_format,
abspath_relpath_v4,
)

manifest_fn = runtmp.output(f"mf.{ext}")
@@ -215,7 +241,15 @@ def test_sig_collect_2_no_exists_merge(runtmp, manifest_db_format, abspath_relpa

# run with --merge but no previous:
runtmp.sourmash(
"sig", "collect", allzip, "-o", manifest_fn, "-F", manifest_db_format, "--merge", abspath_relpath_v4,
"sig",
"collect",
allzip,
"-o",
manifest_fn,
"-F",
manifest_db_format,
"--merge",
abspath_relpath_v4,
)

manifest = BaseCollectionManifest.load_from_filename(manifest_fn)
@@ -424,7 +458,9 @@ def test_sig_collect_5_no_manifest_sbt_fail(runtmp, manifest_db_format):
)


def test_sig_collect_5_no_manifest_sbt_succeed(runtmp, manifest_db_format, abspath_relpath_v4):
def test_sig_collect_5_no_manifest_sbt_succeed(
runtmp, manifest_db_format, abspath_relpath_v4
):
# generate a manifest from files that don't have one when --no-require
sbt_zip = utils.get_test_data("v6.sbt.zip")

@@ -439,7 +475,7 @@ def test_sig_collect_5_no_manifest_sbt_succeed(runtmp, manifest_db_format, abspa
f"mf.{ext}",
"-F",
manifest_db_format,
abspath_relpath_v4
abspath_relpath_v4,
)

manifest_fn = runtmp.output(f"mf.{ext}")

Unchanged files with check annotations Beta

# abspath/relpath checks
if args.abspath and args.relpath:
error("** Cannot specify both --abspath and --relpath; pick one!")
sys.exit(-1)

Check warning on line 1441 in src/sourmash/sig/__main__.py

Codecov / codecov/patch

src/sourmash/sig/__main__.py#L1440-L1441

Added lines #L1440 - L1441 were not covered by tests
if args.relpath or args.abspath and not args.save_manifest_matching:
notify(