sourmash-bio / sourmash

Quickly search, compare, and analyze genomic and metagenomic data sets.
http://sourmash.readthedocs.io/en/latest/
Other
473 stars 80 forks source link

Idea: imports match CLI? #1112

Open luizirber opened 4 years ago

luizirber commented 4 years ago

So, this occurred to me yesterday: What if we make the Python API look like the CLI?

Let's say I want to call sourmash sig describe <sig> in Python. I'm not even sure how to do it now, but it would be nice to do

import sourmash

sourmash.sig.describe(sig)

Of course, this would mess our current API completely...

Maybe an alternative would be to have a submodule to do that, kinda sorta like matplotlib.pyplot? So we could do

import sourmash.api as sm

sm.sig.describe(sig)

(api and sm up for discussion, obviously).

This would solve #245 too.

ctb commented 4 years ago

I like this, especially the submodule approach. It's actually fairly straightforward given the massive CLI reorganization that @standage did in #785 - note that others have already chosen smash as the import for sourmash 🤷

luizirber commented 4 years ago

I like this, especially the submodule approach. It's actually fairly straightforward given the massive CLI reorganization that @standage did in #785

Yup, thanks again Daniel!

  • note that others have already chosen smash as the import for sourmash shrug

@will-rowe already used that pun, but smash sounds good too =] https://github.com/will-rowe/hulk#quick-start