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

Allow PyOpenWorm to be used from any directory #400

Closed
pgleeson opened this issue May 8, 2019 · 4 comments
Closed

Allow PyOpenWorm to be used from any directory #400

pgleeson opened this issue May 8, 2019 · 4 comments

Comments

@pgleeson
Copy link
Member

pgleeson commented May 8, 2019

Expected behavior

A Python script should be able to be run from any directory and import PyOpenWorm and get access to the default database/configuration without knowing where PyOpenWorm is installed or requiring a local pow clone...

Actual behavior

Relative path to file .pow/pow.conf needs to be set in P.connect(), e.g.

https://github.com/openworm/c302/blob/907aa9de27ddbb3b3d3c1f80971f581da2db0010/c302/OpenWormReader.py#L31

Steps to reproduce the behavior

Run OpenWormReader.py above without .pow subfolder or without setting configFile

@clbarnes
Copy link
Contributor

clbarnes commented May 8, 2019

The default db/config directory, instead of being contained in ./, could be $XDG_CACHE_HOME/pyopenworm/, and whatever its windows equivalent would be. Users with a project-local cache could still specify it as such.

@mwatts15 mwatts15 added feature and removed feature labels May 8, 2019
@mwatts15
Copy link
Contributor

mwatts15 commented May 8, 2019

There are a couple of things going on here. One is that relative paths in the PyOpenWorm config are resolved against the current working directory when they should be resolved against the config file location when there is one. I can fix that in pretty short order.

For retrieving contexts from remote resources without cloning a repo first, that's TODO, but largely spec'd out, though not in Github issues yet. I think what you're calling the "default database" is effectively a cache that would be created for that use case. @clbarnes, I think that's appropriate for this use-case. Just to underscore, what's in that cache is not all of what's in a .pow directory although some files are (worm.db*, DataSource files).

@clbarnes
Copy link
Contributor

clbarnes commented May 8, 2019

It also looks like there's not much of a cross-platform standard when it comes to setting a cache directory, although I suppose so long as it's consistent for POW it's fine. If an OS manufacturer doesn't want to define a standard cache directory, then they can deal with caches in nonstandard places...

@mwatts15
Copy link
Contributor

Added support in config files for referencing files relative to the config file.
cb8cb25
a8a5c03

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants