PMXBOT Log file Viewer

Help | Karma | Search:

#pypa-dev logs for Thursday the 12th of February, 2015

(Back to #pypa-dev overview) (Back to channel listing) (Animate logs)
[18:54:38] <ionelmc> dstufft: what's the deal with the __about__ module?
[18:57:08] <dstufft> ionelmc: makes it easy to fetch the metadata inside of the setup.py without resorting to crap like regexes or importing the module directly
[18:59:21] <ionelmc> dstufft: isn't setup.py supposed to be just that? (the information display options, or egg_info)
[19:00:07] <ionelmc> all the repetition really irks me
[19:00:24] <sigmavirus24> ionelmc: people use many different ways of organizing the data they shove into the setup.py
[19:00:36] <sigmavirus24> Keeping it in a module like that makes it easy to import and use
[19:01:09] <sigmavirus24> Also means you can perform introspection on a package you're using without using pkgutil some other library or shelling out to pip
[19:01:12] <dstufft> ionelmc: how do I determine, give I have a module foo that I've imported, what version and of what distribution that is?
[19:01:40] <dstufft> at the very best if you already know the distribution name, you can determine what version has installed metadata for it
[19:01:49] <dstufft> but that's not always going to be the version you're importing
[19:02:06] <ionelmc> dstufft: import it, thething.__version__
[19:02:12] <ionelmc> what's the big deal about that?
[19:02:20] <dstufft> ionelmc: which is exactly what __about__ is, it's a place for that stuff to live
[19:02:20] <sigmavirus24> ionelmc: that's a fraction of the information
[19:02:37] <dstufft> except you don't want to define it in __init__, because __init__ might import things
[19:02:52] <dstufft> so you split it off into __about__.py which doesn't import anything, and just stores the data
[19:02:58] <ionelmc> i'm just saying, separating it in a __about__ module still makes the package's __init__.py execute
[19:03:05] <dstufft> no it doesn't
[19:03:09] <sigmavirus24> lolol
[19:03:13] <Alex_Gaynor> no it doesn't
[19:03:41] <dstufft> https://github.com/pypa/warehouse/blob/master/setup.py#L32-L34
[19:04:36] <ionelmc> lel
[19:04:45] <ionelmc> https://www.irccloud.com/pastebin/NFiFt6ik
[19:05:02] <ionelmc> Alex_Gaynor: say again?
[19:05:40] <dstufft> you don't actually import the __about__ module in a context where you care if __init__ is executed
[19:05:41] <Alex_Gaynor> the point is setup.py doesn't import it, it's able to just exec it because it's standalone
[19:05:42] <dstufft> you open it an exec it
[19:06:03] <dstufft> which you can only do because it's stand alone and has no dependencies, it's just some basic assignment
[19:07:00] <dstufft> this actually reduces duplication, you define your verison and such in one place, the __about__.py, everyone else is derrived from that, your setup.py and your docs/conf.py can open() that file and exec it, your __init__.py can import it
[19:10:53] <ionelmc> dstufft: mkay, what's the point of having __all__ in __about__.py?
[19:10:58] <ionelmc> seems unnecessary
[19:11:53] <dstufft> Explicit is better than implicit and thus flake8 complains about unused variables/imports unless they are "exported" via __all__
[19:16:23] <ionelmc> dstufft: flake8 doesn't compain on that
[19:16:32] <ionelmc> you meant pylint?
[19:16:37] <sigmavirus24> ionelmc: no flake8 will
[19:16:53] <ionelmc> sigmavirus24: try it
[19:16:56] <sigmavirus24> Check your global flake8 config to see if you have it silenced, it should be a F-class warning
[19:17:07] <sigmavirus24> ionelmc: it won't complain /now/ because __all__ is defined. Without __all__ it will
[19:17:28] <ionelmc> sigmavirus24: try it
[19:17:35] <ionelmc> i don't have any ~/.flake*
[19:17:37] <sigmavirus24> ionelmc: I also don't sit on IRC to amuse you or do your bidding
[19:18:18] <ionelmc> sigmavirus24: ok that's kinda rude
[19:18:37] <sigmavirus24> ionelmc: pestering this channel and insisting people do exactly what you want is rude
[19:18:44] <sigmavirus24> telling you I won't do it, isn't rude
[19:18:51] <ionelmc> i've removed __all__ and got no warning
[19:19:35] <ionelmc> sigmavirus24: i didn't insist to do anything specific, i just asked some questions about why some stuff is the way it is
[19:20:36] <sigmavirus24> ionelmc: "try it" is a command. It's an imperative sentence. You're insisting I drop what I'm currently doing to do what you say
[19:20:41] <dstufft> flake8 at least used to complain about it, if it doesn't now i dunno. but I still think explicit is better than explicit
[19:21:43] <sigmavirus24> dstufft: that's either a problem with flake8 or pyflakes then
[19:21:44] <ionelmc> sigmavirus24: lol, relax dude, just close the windows
[19:22:02] <sigmavirus24> dstufft: file a bug on flake8 and I'll investigatae it
[19:22:08] <sigmavirus24> ionelmc: still ordering me around eh?
[19:22:26] <sigmavirus24> ionelmc: learn to stop telling people what to do.
[19:24:05] <ionelmc> sigmavirus24: lol, who's ordering people around again?
[19:24:14] <ionelmc> real mature
[19:25:55] <sigmavirus24> ionelmc: can't accept others returning your behaviour to you in kind?
[19:27:07] <ionelmc> sigmavirus24: nah, i'm just pointing out your hypocrisy
[19:27:36] <ionelmc> i always enjoy a free lesson in manners, thanks a bunch
[19:54:48] <carljm> ionelmc: flake8 definitely complains about unused vars/imports, I rely on that daily.
[19:55:22] <carljm> I have flake8 hooked up directly to my editor, that's the only way I ever notice unused vars or imports.
[19:57:30] <ionelmc> carljm: it was about the missing __all__
[19:58:24] <ionelmc> maybe flake8 changed this
[20:00:31] <tomprince> pyflakes/flake8 picks up things that are imported, not used, and not in __all__. But not things that are defined but not in __all__. I think.
[20:00:54] <sigmavirus24> tomprince: assignments to unused variables are detected
[20:01:14] <sigmavirus24> i.e., a = 1 and then you never use a again will be reported
[20:01:43] <sigmavirus24> s/i.e./e.g./
[20:04:07] <tomprince> sigmavirus24: Not at the top-level, I don't think.
[20:04:48] <sigmavirus24> tomprince: pyflakes may have cut a new release where it doesn't do that any longer but I'm rather certain it used to until very recently
[20:08:50] <ionelmc> sigmavirus24: must be a bug then
[20:09:16] <sigmavirus24> bugs.launchpad.net/pyflakes
[20:09:24] <ionelmc> meh
[20:09:33] <ionelmc> logged in flake8
[20:10:04] <sigmavirus24> flake8 doesn't accept bugs for other projects
[20:10:34] <tomprince> hasn't pyflakes moved to github?
[20:10:45] <sigmavirus24> tomprince: I think they still track bugs on launchpad
[20:10:53] <sigmavirus24> Development is there though and they accept PRs there
[20:17:03] <carljm> oh yeah, flake8 doesn't complain about module-level unused vars (at least not that I've ever seen), even without __all__
[20:17:22] <carljm> I always figured that's because it assumed they could be constants meant for import elsewhere