-
Notifications
You must be signed in to change notification settings - Fork 412
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
cleans up imports, removes circular import #869
Conversation
a-tal
commented
Dec 2, 2016
- generally, the order is std lib, 3rd party, 1st party
- fixed line endings in a couple files
- random linting fixes
- adds package import tests
- generally, the order is std lib, 3rd party, 1st party - fixed line endings in a couple files - random linting fixes - adds package import tests
I had to add an empty Since you removed the third partying of
Not sure how to solve this, but tempted to just merge the files.... This doesn't work when patched against the cap sim branch I'm running into this issue on. Based on the stack trace, I'm 92% sure it won't work against master either. Looking deeper at
The lines that use Going to nuke and retest. Test seems to have worked, but not out of the woods yet! In
It's used by
Same thing for Because
Screw it, too many files with 1 change. Massive patch file incoming.... Note to follow up on this: Under Commented out the import/export code that exists in |
Note to self to follow up on this. In Only problem is....there is no |
So it took just a wee bit to get Pyfa to run again. But good news! Not only does it run, but I tested it again the Gnosis service code, no more import errors! \o/ @a-tal I think I did this right. If you merge the PR hopefully it gets updated here. Do you think you could re-go over the imports once you merge that (and confirm that this PR updates)? . @blitzmann couple lessons learned here, and a few things we need to do.
|
Haven't read much of this yet because :verbosity and time:, but:
|
The problem is that we have cyclical imports. Here is an example after you strip away it being hidden in
The imports were so fragile that simple dropping
Take this code snippet for example (this is just psuedo code but it's uncomfortably close to real code):
Which In TBH, the current code should not work. And, it might not, depending on the platform, version of python, phase of the moon, etc. Between the cyclical imports, re-definitions, and shadowing, it's shocking to me that you can just do Here's the reasons why we should merge this change (and continue burning this out with fire):
Okay, bring solutions not problems.
Finally, remember this? A lot of that will get cleaned up, and it should make a lot more sense. Your profiler also probably won't hurrrrr as much. :) And, with any luck, most of those self referencing loops will go away. |
Except for 1 (clipboardXML), same number of lines of code in mainFrame, lots of code gone from fit, and no more complicated. Also spotted an import reference that got missed.
Took care of the exports. That was easy, there was literally no need for them to call The imports and backups are a bit harder. Those should also be moved to |
Cleaning up the circular imports out of service, got the import/export stuff moved over from fit.py to port.py. Now:
le sigh |
you can now use this to check your code for obvious errors:
I'd highly recommend using that flake8 command (or pep8 if you prefer) in your CI somewhere |
… Ebag333-MakeItRunAgain2
Travis errors out when using "service"
I keep seeing notifications about this PR. Is this finalized or not? |
Not even close. 😣 |
What still needs to be done? Please provide a todo list and mark off what exactly has happened here along with what needs to be done. I want to keep abreast of it since this PR is quickly becoming unmanageable form a review perspective. Once this todo list reach 100%, I will assume it is finished and finalize review We may even need to consider breaking this up if possible. This started out as an import clean up, and has morphed into a complete rewrite of our mappings, and thensome |
Continue the discussion from #895... I am reluctant about switching over to declarative, especially if the reason is simply something didn't import correctly. There's always a proper fix for that; changing the underlying database structure is not proper IMO. It's also not simply a different style; IIRC it has certain implications (that I've long forgotten - was a couple years ago I looked into switching it myself). Not only that, but we're not even using it correctly as it stands in that pull request from what I can see - I can't test as it crashes for me. What were you working on when you were trying to do the import that was failing? Which commit was that? |
Also finally getting around to reading the stuff here.
I would much prefer this PR being solely of imports. After evaluating them and making sure they work, any additional changes can be evaluated.
I agree, however it seems that was lumped into this one.
I agree we need unique class names. I frankly don't care if it's through aliasing or if the class themselves are renamed, though I prefer for the classes themselves to be renamed. So, (and I think I've said this somewhere), for service classes,
I am in support generally. I am concerned that you are taking generalized "don't do this" recommendations (like pep8) and following them without question. There are legitimate reasons to use locally scoped imports (just like there's legitimate reasons to use |
So this thing quickly got out of hand. sigh Okay, here's what I'd like to do. Go all the way back to d963327 (or perhaps when it was merged) and get that cleaned up. Get Travis, Tox, and the pep8 stuff it complains about fixed, so that we're good there. We might need to pull some changes after that (like renaming That will largely refactor For Eos, that's going to take some really careful refactoring because it is super ugly. I think it can be done, but it's going to be easier to do by doing it one little bit at a time rather than shotgun blasting it. (Sorry @a-tal , I know you wanted to fix all the problems at once, but I just don't think it's possible.) We can leave the @a-tal branch open so we can reference it, there's a lot of good information about how we can refactor the various imports there. I feel like the @a-tal branch isn't actually that far away from being functional again, but I don't know enough about sqlAlchemy and getting the environment setup to get it going again. Too much stuff got ripped out, so it'd take a lot of building up from scratch (not necessarily a bad thing, just beyond my ken). |
See #907 |
Closing this as it will be broken into smaller PRs. :) |