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

Moving msgs to pypit/__init__.py #308

Closed
kbwestfall opened this issue Mar 22, 2018 · 4 comments
Closed

Moving msgs to pypit/__init__.py #308

kbwestfall opened this issue Mar 22, 2018 · 4 comments

Comments

@kbwestfall
Copy link
Collaborator

X and I talked about restructuring the front end of pypit to make it more clear and to hopefully remove some of the difficulties with the global objects.

First, I'm going to start a branch that will move the creation of the logger into the pypit/init.py file so that it's immediately available within the package. A main goal is to hopefully remove the requirement on the order in which the logger and other modules are imported. One subtlety it to make sure that the log file is correctly defined at the relevant locations.

The effect of this will touch many files, but I'm aiming that the only visible difference will be that:

from pypit import armsgs
msgs = armsgs.get_logger()

should just become:

from pypit import msgs

For an example, see here:

https://github.com/sdss/marvin/blob/master/python/marvin/__init__.py

Because log is defined at line 45, it's immediately available in the package by just saying:

from marvin import log

I'm hoping that something similar can be done with settings. But first things first ...

@rcooke-ast
Copy link
Collaborator

This all sounds like a good idea to me! I tried to think of ways to do something similar, but this is very simple and clean - I like it 👍

@kbwestfall
Copy link
Collaborator Author

I actually finished getting this working this morning. All the tests in the dev suite are passed. I'll submit a PR once my other one gets approved :)

@rcooke-ast
Copy link
Collaborator

Great - I'll check out the PR on Monday - thanks!!

@kbwestfall
Copy link
Collaborator Author

Closing this. See PR #310 .

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

2 participants