Re: [Distutils] How to eliminate on part of a package?
If you're lazy, you could distribute the server package to everyone and just make sure that if someone tries to import it on python 2 then they get a useful error. On Thu, Apr 26, 2018 at 9:17 AM, Skip Montanaro wrote: > Yeah, splitting client and server packages is on my to-do list. Was > just hoping to keep Python2 users from shooting themselves in the foot > with a server subpackage which wouldn't work. > > S > > On Thu, Apr 26, 2018 at 10:59 AM, Chris Barker wrote: >> frankly, I'd give up n find_packages -- it's not that magic, it's just a >> convenience function so you don't need to hand-specify them. >> >> But in this case, you're doing something weird, so I"d just be explicit. >> >> Though what I'd probably really do is make the client and server completely >> separate packages. After all, you say your users only want the client side >> anyway. >> >> and if the server depends on the client (which I"d hope it doesn't!) then >> you can simply make it a dependency. >> >> -CHB >> >> >> >> >> On Wed, Apr 25, 2018 at 1:28 PM, Skip Montanaro >> wrote: >>> >>> > >>> > If by "top/server tree" you mean that there are more subpackages under >>> > top.server (not just a server.py file as your diagram shows), then you >>> > need >>> > to filter out all of those subpackages as well, e.g.: >>> > >>> > packages = setuptools.find_packages() >>> > if sys.version_info.major < 3: >>> > packages = [ >>> > pkg for pkg in packages >>> > if pkg != "top.server" and not >>> > pkg.startswith("top.server.") >>> > ] >>> >>> Thanks, yes, there is another subpackage within top/server, but I >>> eliminated it as well. I was simplifying for the email. The raw >>> find_packages() output looks like this: >>> >>> ['tests', 'top', 'tests.python', 'top.client', 'top.server', >>> 'top.server.db'] >>> >>> I was excising the last two elements from the returned list, so the >>> argument of the packages keyword looked like this: >>> >>> ['tests', 'top', 'tests.python', 'top.client'] >>> >>> Does the presence of 'top' in the list imply everything under it will >>> be copied (I do want 'top', as that's the top level package, not just >>> a directory in my repo.) >>> >>> I'll keep messing with it. >>> >>> Skip >>> ___ >>> Distutils-SIG maillist - Distutils-SIG@python.org >>> https://mail.python.org/mailman/listinfo/distutils-sig >> >> >> >> >> -- >> >> Christopher Barker, Ph.D. >> Oceanographer >> >> Emergency Response Division >> NOAA/NOS/OR&R(206) 526-6959 voice >> 7600 Sand Point Way NE (206) 526-6329 fax >> Seattle, WA 98115 (206) 526-6317 main reception >> >> chris.bar...@noaa.gov > ___ > Distutils-SIG maillist - Distutils-SIG@python.org > https://mail.python.org/mailman/listinfo/distutils-sig -- Nathaniel J. Smith -- https://vorpus.org ___ Distutils-SIG maillist - Distutils-SIG@python.org https://mail.python.org/mailman/listinfo/distutils-sig
Re: [Distutils] How to eliminate on part of a package?
Yeah, splitting client and server packages is on my to-do list. Was just hoping to keep Python2 users from shooting themselves in the foot with a server subpackage which wouldn't work. S On Thu, Apr 26, 2018 at 10:59 AM, Chris Barker wrote: > frankly, I'd give up n find_packages -- it's not that magic, it's just a > convenience function so you don't need to hand-specify them. > > But in this case, you're doing something weird, so I"d just be explicit. > > Though what I'd probably really do is make the client and server completely > separate packages. After all, you say your users only want the client side > anyway. > > and if the server depends on the client (which I"d hope it doesn't!) then > you can simply make it a dependency. > > -CHB > > > > > On Wed, Apr 25, 2018 at 1:28 PM, Skip Montanaro > wrote: >> >> > >> > If by "top/server tree" you mean that there are more subpackages under >> > top.server (not just a server.py file as your diagram shows), then you need >> > to filter out all of those subpackages as well, e.g.: >> > >> > packages = setuptools.find_packages() >> > if sys.version_info.major < 3: >> > packages = [ >> > pkg for pkg in packages >> > if pkg != "top.server" and not >> > pkg.startswith("top.server.") >> > ] >> >> Thanks, yes, there is another subpackage within top/server, but I >> eliminated it as well. I was simplifying for the email. The raw >> find_packages() output looks like this: >> >> ['tests', 'top', 'tests.python', 'top.client', 'top.server', >> 'top.server.db'] >> >> I was excising the last two elements from the returned list, so the >> argument of the packages keyword looked like this: >> >> ['tests', 'top', 'tests.python', 'top.client'] >> >> Does the presence of 'top' in the list imply everything under it will >> be copied (I do want 'top', as that's the top level package, not just >> a directory in my repo.) >> >> I'll keep messing with it. >> >> Skip >> ___ >> Distutils-SIG maillist - Distutils-SIG@python.org >> https://mail.python.org/mailman/listinfo/distutils-sig > > > > > -- > > Christopher Barker, Ph.D. > Oceanographer > > Emergency Response Division > NOAA/NOS/OR&R(206) 526-6959 voice > 7600 Sand Point Way NE (206) 526-6329 fax > Seattle, WA 98115 (206) 526-6317 main reception > > chris.bar...@noaa.gov ___ Distutils-SIG maillist - Distutils-SIG@python.org https://mail.python.org/mailman/listinfo/distutils-sig
Re: [Distutils] How to eliminate on part of a package?
frankly, I'd give up n find_packages -- it's not that magic, it's just a convenience function so you don't need to hand-specify them. But in this case, you're doing something weird, so I"d just be explicit. Though what I'd probably really do is make the client and server completely separate packages. After all, you say your users only want the client side anyway. and if the server depends on the client (which I"d hope it doesn't!) then you can simply make it a dependency. -CHB On Wed, Apr 25, 2018 at 1:28 PM, Skip Montanaro wrote: > > > > If by "top/server tree" you mean that there are more subpackages under > top.server (not just a server.py file as your diagram shows), then you need > to filter out all of those subpackages as well, e.g.: > > > > packages = setuptools.find_packages() > > if sys.version_info.major < 3: > > packages = [ > > pkg for pkg in packages > > if pkg != "top.server" and not > pkg.startswith("top.server.") > > ] > > Thanks, yes, there is another subpackage within top/server, but I > eliminated it as well. I was simplifying for the email. The raw > find_packages() output looks like this: > > ['tests', 'top', 'tests.python', 'top.client', 'top.server', > 'top.server.db'] > > I was excising the last two elements from the returned list, so the > argument of the packages keyword looked like this: > > ['tests', 'top', 'tests.python', 'top.client'] > > Does the presence of 'top' in the list imply everything under it will > be copied (I do want 'top', as that's the top level package, not just > a directory in my repo.) > > I'll keep messing with it. > > Skip > ___ > Distutils-SIG maillist - Distutils-SIG@python.org > https://mail.python.org/mailman/listinfo/distutils-sig > -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/OR&R(206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception chris.bar...@noaa.gov ___ Distutils-SIG maillist - Distutils-SIG@python.org https://mail.python.org/mailman/listinfo/distutils-sig