{"action":"created","issue":{"url":"https://api.github.com/repos/vtsuperdarn/davitpy/issues/115","labels_url":"https://api.github.com/repos/vtsuperdarn/davitpy/issues/115/labels{/name}","comments_url":"https://api.github.com/repos/vtsuperdarn/davitpy/issues/115/comments","events_url":"https://api.github.com/repos/vtsuperdarn/davitpy/issues/115/events","html_url":"https://github.com/vtsuperdarn/davitpy/issues/115","id":46064145,"number":115,"title":"davitpyrc","user":{"login":"asreimer","id":4604819,"avatar_url":"https://avatars.githubusercontent.com/u/4604819?v=3","gravatar_id":"","url":"https://api.github.com/users/asreimer","html_url":"https://github.com/asreimer","followers_url":"https://api.github.com/users/asreimer/followers","following_url":"https://api.github.com/users/asreimer/following{/other_user}","gists_url":"https://api.github.com/users/asreimer/gists{/gist_id}","starred_url":"https://api.github.com/users/asreimer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/asreimer/subscriptions","organizations_url":"https://api.github.com/users/asreimer/orgs","repos_url":"https://api.github.com/users/asreimer/repos","events_url":"https://api.github.com/users/asreimer/events{/privacy}","received_events_url":"https://api.github.com/users/asreimer/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/vtsuperdarn/davitpy/labels/enhancement","name":"enhancement","color":"84b6eb"}],"state":"open","locked":false,"assignee":{"login":"asreimer","id":4604819,"avatar_url":"https://avatars.githubusercontent.com/u/4604819?v=3","gravatar_id":"","url":"https://api.github.com/users/asreimer","html_url":"https://github.com/asreimer","followers_url":"https://api.github.com/users/asreimer/followers","following_url":"https://api.github.com/users/asreimer/following{/other_user}","gists_url":"https://api.github.com/users/asreimer/gists{/gist_id}","starred_url":"https://api.github.com/users/asreimer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/asreimer/subscriptions","organizations_url":"https://api.github.com/users/asreimer/orgs","repos_url":"https://api.github.com/users/asreimer/repos","events_url":"https://api.github.com/users/asreimer/events{/privacy}","received_events_url":"https://api.github.com/users/asreimer/received_events","type":"User","site_admin":false},"milestone":null,"comments":4,"created_at":"2014-10-17T05:25:04Z","updated_at":"2015-02-04T07:14:12Z","closed_at":null,"body":"As stated by the wise @jspaleta, chapter vtsuperdarn/davitpy repository, verse https://github.com/vtsuperdarn/davitpy/issues/56 \"we need to move to a pydarnrc file that has all the user configurable environment stuff instead of all the environment shell variables. A real config file for all of pydarn environment configurables will fully solve the problem. Like how the matplotlibrc works. And we need to make use of the XDG environment variables and drop or files into the directories defined via XDG like any other application that needs tmp files or config files and data files. Basically we need to stop re-inventing the wheel. I say that with full knowledge that I've invented several of the oddly shaped wheels in the codebase.\" Seriously though, this is a very good idea and we need to start working on this.\r\n\r\nWe have a bunch of environment variables that are used by `radDataTypes` and `sdDataTypes` and a honestly, the way it is set up is really ugly and messy. A configuration file that handles this would be much cleaner. Also, we have a need for a configuration dictionary for initializing the logging library as discussed in https://github.com/vtsuperdarn/davitpy/pull/109. As we keep developing, I think we will only see an increased demand for an rc file.\r\n\r\nSo let's get working on that. To get the conversation started what is an \"rc file\"? \"rc\" is short for \"Run command\" and you can read more about it here: http://en.wikipedia.org/wiki/Run_commands This might also be interesting and is certainly relevant: http://en.wikipedia.org/wiki/Configuration_file\r\n\r\nHow would it \"look\" if we were to implement a davitpyrc file? For an idea, we can study matplotlib. When we run `from matplotlib import pyplot`, the `pyplot.py` file runs an `import matplotlib`, which in turn executes `__init__.py` here: https://github.com/matplotlib/matplotlib/tree/master/lib/matplotlib\r\n\r\nIn the `__init__.py` file, there is a call to `import matplotlib.rcsetup` (see this line: https://github.com/matplotlib/matplotlib/blob/master/lib/matplotlib/__init__.py#L197).\r\n\r\nSo one potential way to package davitpy is to model it after matplotlib. The basic idea would be to have a root level `__init__.py` in the davitpy directory which is in turn imported by every davitpy module (pydarn, models, etc.). Then an `rcsetup.py` file can be placed in the davitpy directory that handles reading a `.davitpyrc` configuration file and has hardcoded defaults to fall back to. \r\n\r\nHere is the matplotlib `rcsetup.py` for reference: https://github.com/matplotlib/matplotlib/blob/master/lib/matplotlib/rcsetup.py. Of specific interest to us right now is probably the `defaultParams` dictionary found here https://github.com/matplotlib/matplotlib/blob/master/lib/matplotlib/rcsetup.py#L479\r\n\r\nHere's some more useful information about matplotlibrc: http://matplotlib.org/users/customizing.html\r\n\r\nHere's where/how the rcParams dictionary is populated: https://github.com/matplotlib/matplotlib/blob/master/lib/matplotlib/__init__.py#L1079 and https://github.com/matplotlib/matplotlib/blob/master/lib/matplotlib/__init__.py#L923 and https://github.com/matplotlib/matplotlib/blob/master/lib/matplotlib/__init__.py#L833\r\n\r\nSo, let's have a conversation and figure this out. What's the best way to proceed? Do we need to reorganize the way davitpy is currently packaged? Is davitpy supposed to function as a software library, or a framework (with pydarn, models, etc. as libraries)?\r\n"},"comment":{"url":"https://api.github.com/repos/vtsuperdarn/davitpy/issues/comments/72801664","html_url":"https://github.com/vtsuperdarn/davitpy/issues/115#issuecomment-72801664","issue_url":"https://api.github.com/repos/vtsuperdarn/davitpy/issues/115","id":72801664,"user":{"login":"cmeeren","id":7766733,"avatar_url":"https://avatars.githubusercontent.com/u/7766733?v=3","gravatar_id":"","url":"https://api.github.com/users/cmeeren","html_url":"https://github.com/cmeeren","followers_url":"https://api.github.com/users/cmeeren/followers","following_url":"https://api.github.com/users/cmeeren/following{/other_user}","gists_url":"https://api.github.com/users/cmeeren/gists{/gist_id}","starred_url":"https://api.github.com/users/cmeeren/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cmeeren/subscriptions","organizations_url":"https://api.github.com/users/cmeeren/orgs","repos_url":"https://api.github.com/users/cmeeren/repos","events_url":"https://api.github.com/users/cmeeren/events{/privacy}","received_events_url":"https://api.github.com/users/cmeeren/received_events","type":"User","site_admin":false},"created_at":"2015-02-04T07:14:12Z","updated_at":"2015-02-04T07:14:12Z","body":"+1 for everything being inside `davitpy`!"}}