SynBioDex / pySBOL3

Native python implementation of SBOL 3.0 specification
MIT License
37 stars 16 forks source link

Safe construction of identities #328

Closed jakebeal closed 2 years ago

jakebeal commented 3 years ago

I've run into a number of little bugs involving identity construction, particularly regarding / characters at the end of segments. It would be good to have some helpers that help avoid this, just as os.path has safe helpers for path construction.

Should these go in pySBOL3 or sbol-utilities?

tcmitchell commented 3 years ago

This is a good question, and one we have bumped into before: what is the relationship between pySBOL3 and SBOL-utilties?

We sometimes choose to keep pySBOL3 to the data model itself without the convenience layer built on top. SBOL-utilities has been providing that convenience layer. I like this model. We've also talked about letting features gel in SBOL-utilities and then eventually "promoting" them to pySBOL3, or absorbing them into the core.

On the other hand, sometimes features are core to the use of SBOL3 and should be available in pySBOL3. In these cases we should figure out how to gracefully put them in pySBOL3.

I'm not sure where the identity building utilities should lie. All TopLevel objects need them, and generating anything more than trivial structures means machine generating the identities. So I can see this being handy to have in pySBOL3. But I think of pySBOL3 as mostly the classes, and not too many functions. And through this lens it feels more like SBOL-utilities is a good place to put such functions. In short, I don't know where these would best reside. I could go either way.

Internally, pySBOL3 tries to make use of posixpath to manipulate identities so the slashes go the right way regardless of which OS pySBOL3 is running on. You'll find uses of posixpath.join and posixpath.sep in the source code for manipulating identities.

jakebeal commented 3 years ago

My inclination, given something of ambiguous placement, would be to start with it in SBOL-utilities, as it's easier to promote something to the core than to deprecate it away from the core.

bbartley commented 3 years ago

Would the proposed helpers have utility to pySBOL3 itself? Surely pySBOL is performing similar operations internally to build URIs.

jakebeal commented 2 years ago

As in resolving #343, I think that simply using the proper URL library is the right call here (see: SynBioDex/SBOL-specification/issues/476)