Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #102633

Re: Python's import situation has driven me to the brink of imsanity

Path csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail
From Sivan Greenberg <sivan@vitakka.co>
Newsgroups comp.lang.python
Subject Re: Python's import situation has driven me to the brink of imsanity
Date Sun, 7 Feb 2016 18:15:26 +0200
Lines 127
Message-ID <mailman.76.1454861729.2317.python-list@python.org> (permalink)
References <e324ce71-1f90-4727-b7e8-eaa13c4ecc08@googlegroups.com> <CAPTjJmr6771LUFCa5fNwUkLwfBzqGu83anruax705fzhtXQ1hQ@mail.gmail.com> <mailman.61.1454826898.2317.python-list@python.org> <51b52cf3-0b0a-451e-a232-d9a671f7cd20@googlegroups.com> <CAKF=+diR2z2sE9wFt9m5NsD8kOpNtZV8PEwARZiK2QDLU-Rp=Q@mail.gmail.com>
Mime-Version 1.0
Content-Type text/plain; charset=UTF-8
X-Trace news.uni-berlin.de BJNB7o+6M0ejIL2svPDPpA1D92bSx6D+sYj/NSXZyZAg==
Return-Path <sivan@vitakka.co>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.000
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'modify': 0.04; 'subject:Python': 0.05; 'repository': 0.05; 'used.': 0.05; 'cto': 0.07; 'executable': 0.07; 'setup.py': 0.07; 'cc:addr:python-list': 0.09; 'imports': 0.09; 'modifies': 0.09; 'url:blog': 0.10; 'python': 0.10; 'package,': 0.13; 'argument': 0.15; 'importing': 0.15; '2016': 0.16; 'editable': 0.16; 'executable,': 0.16; 'macro': 0.16; 'mistake.': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'setuptools': 0.16; 'structure.': 0.16; 'subject:import': 0.16; 'sys.path': 0.16; 'url:setuptools': 0.16; 'usable)': 0.16; 'wrote:': 0.16; 'first.': 0.18; '&gt;': 0.18; 'email addr:gmail.com&gt;': 0.18; '(not': 0.20; 'cc:addr:python.org': 0.20; 'cc:2**1': 0.22; "aren't": 0.22; 'noted': 0.22; 'file.': 0.22; 'code.': 0.23; 'feb': 0.23; 'kevin': 0.23; 'sat,': 0.23; 'second': 0.24; 'import': 0.24; 'cc:addr:gmail.com': 0.24; 'header:In-Reply-To:1': 0.24; 'script': 0.25; 'install': 0.25; 'developers': 0.26; 'command': 0.26; 'installed': 0.26; 'chris': 0.26; 'points': 0.27; 'packaging': 0.27; 'least': 0.27; 'question': 0.27; 'message- id:@mail.gmail.com': 0.27; '[2]': 0.27; 'package.': 0.27; 'tend': 0.27; 'correct': 0.28; 'function': 0.28; "skip:' 10": 0.28; 'actual': 0.28; 'expose': 0.29; 'mode.': 0.29; 'project?': 0.29; 'usable': 0.29; 'cc:no real name:2**1': 0.29; 'code:': 0.29; 'allows': 0.30; 'url:mailman': 0.30; 'creating': 0.30; 'code': 0.30; 'certainly': 0.30; "i'd": 0.31; 'rules': 0.31; 'entry': 0.31; 'everyone': 0.31; '[1]': 0.32; 'statement': 0.32; 'run': 0.33; 'problem': 0.33; 'url:python': 0.33; 'rule': 0.33; 'though.': 0.33; 'url:listinfo': 0.34; 'running': 0.34; 'advice': 0.35; 'received:google.com': 0.35; 'files,': 0.35; 'question,': 0.35; 'something': 0.35; 'asking': 0.35; 'but': 0.36; 'should': 0.36; 'project': 0.36; 'there': 0.36; 'url:org': 0.36; 'received:209.85': 0.36; 'form,': 0.36; 'founder': 0.36; 'pm,': 0.36; 'subject:: ': 0.37; 'two': 0.37; 'say': 0.37; 'received:209': 0.38; 'stuff': 0.38; 'anything': 0.38; 'files': 0.38; 'url:en': 0.39; 'subject:the': 0.39; 'url:mail': 0.40; 'called': 0.40; 'easy': 0.60; 'your': 0.60; 'hope': 0.61; '&amp;': 0.61; 'reach': 0.61; 'more': 0.63; 'more.': 0.63; 'hear': 0.64; 'within': 0.64; 'it!': 0.64; 'talking': 0.67; 'chrisa': 0.84; 'url:readthedocs': 0.84; '1:47': 0.91; 'url:latest': 0.91; 'luck': 0.95
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=vitakka-co.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=XaY+xC/kcT4bJ7Vh9lDBmMmqeaQxUYYqh+vb4Z3yjsA=; b=qvZhJQm4vXPq3BgJX82nCe9bAOvsphb79POI9sVKZN8u68jkLIjU675EqRfwZp1sCh gIRGwrgOREiFqXD5E5vd10oNpE/HmZ+r6yigByIaDbCGvu1jZbOl1qnXkog0T4VtMq7f 4UZ4jIfcBQTmo4liZUNFE6gVkvC4JftDNgf5Sx9OdjxmxdEY2iYgMAonqeMCAXqOsJta L9mItixGQZLkEPeoDTuK7cWJV77TY3Mk8OR59RSAmjDXOFXP6aje4QproV70RQ9FARVX 5A2jbgdfsPCXEdiBWPa4mkbPU2dMl4TFptWIgVO4TwbH1TOl0y6nh+Dz1aPJ0N5abR6o ZD6g==
X-Google-DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=XaY+xC/kcT4bJ7Vh9lDBmMmqeaQxUYYqh+vb4Z3yjsA=; b=ZFaJps8ZYrTUrhZzHIkALs7erXYYBReNGiGY0LaiaW/soWNXNgVasWUoJ+1azz6X/U jk6HDncs4PqQng3LjxEDthwjVtVlALLY+bPFx40XPCH0CK5fjsSzW8YuNtmtb049RqHc 8oN/G+wkdb4p1V4npTs8fLTtc9oqVdL1/6EqcUOpB7Rfm1cSi+iXMbxPeC7HTMsRHyt/ I7qFbnXEKt+ldO/CAl5yy0+Q8zpFeWTsbnfYTD1QZdUV5R8j6NeToMzBl7/p5S0Ryr33 b+UApxXLGo9QDTvuXFO5tBFU7gtkNVROG9XH0Q8jCpOryOoHcazdN8Ez5l2qtiEAtF5X 0/bA==
X-Gm-Message-State AG10YOTM9PiY1wzT6KeNb8BVFEi06tBuypItWHfm/rkv4oHA/WZVl70Fm5zemXLfM8XWnDCmkPkVPhvcbSRS+w==
X-Received by 10.37.97.210 with SMTP id v201mr12701476ybb.77.1454861726289; Sun, 07 Feb 2016 08:15:26 -0800 (PST)
X-Originating-IP [2.52.35.140]
In-Reply-To <CAKF=+diR2z2sE9wFt9m5NsD8kOpNtZV8PEwARZiK2QDLU-Rp=Q@mail.gmail.com>
X-Content-Filtered-By Mailman/MimeDel 2.1.21rc2
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.21rc2
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Xref csiph.com comp.lang.python:102633

Show key headers only | View raw


I if it's more than few files, I use 'develop' as Kevin noted in the note
before:
- http://www.ewencp.org/blog/a-brief-introduction-to-packaging-python/

Hope this helps..

-Sivan

On Sun, Feb 7, 2016 at 6:09 PM, Kevin Conway <kevinjacobconway@gmail.com>
wrote:

> You can use 'setup.py develop' or 'pip install -e' to install your package
> in editable mode. It makes it so your local code is used. Modifications are
> seen immediately.
>
> On Sun, Feb 7, 2016, 08:16  <dimva13@gmail.com> wrote:
>
> > I see that this would work once you've installed the package, but how do
> > you develop it? Say you are working on a change that modifies both
> email.py
> > and reports.py. Do you run setup.py every time you make a change in
> > email.py?
> >
> > On Sunday, February 7, 2016 at 1:35:15 AM UTC-5, Kevin Conway wrote:
> > > > My question is: is this crazy? Please tell me there's a better way
> and
> > I
> > > just wasted my time creating this package.
> > >
> > > There is a better way and you have wasted your time creating this
> > package.
> > >
> > > I hear your problem statement as asking two questions. The first is:
> What
> > > is the right way to include executable content in my Python project?
> The
> > > second is: How do I expose executable content from a Python project?
> > >
> > > As to the first question, from your project README:
> > > > Say you have a python project (not a package), with the following
> > > structure:
> > >
> > > All Python code that you want to install and make available in any
> form,
> > > import or executable, _must_ be contained within a Python package.
> > > Organizing Python code in any way other than Python packages will
> result
> > in
> > > the challenges you have described. The correct way to include
> executable
> > > content is to place the Python code within the package structure. It
> > should
> > > not be put in other directories within the repository root.
> > >
> > > As to the second question, once all Python code is contained within a
> > > package that can be installed you can use setuptools entry points to
> > expose
> > > the executable code. The setup() function from setuptools that is used
> to
> > > create setup.py files has an argument called 'entry_points' that allows
> > you
> > > to expose executable content over the command line. See [1] and [2] for
> > > more details.
> > >
> > > Feel free to reach out to me off-list if you have a specific project
> you
> > > need advice on. The rules for organizing and packaging Python code
> aren't
> > > complex but they tend to cause new Python developers to stumble at
> > first. A
> > > general rule I give everyone when talking about packaging or importing
> > > code: If you have to modify sys.path to makes something work then you
> > have
> > > most certainly made a mistake.
> > >
> > > [1]
> > >
> >
> https://pythonhosted.org/setuptools/setuptools.html#automatic-script-creation
> > > [2]
> > >
> >
> http://python-packaging.readthedocs.org/en/latest/command-line-scripts.html#the-console-scripts-entry-point
> > >
> > >
> > > On Sat, Feb 6, 2016 at 8:54 PM Chris Angelico <rosuav@gmail.com>
> wrote:
> > >
> > > > On Sun, Feb 7, 2016 at 1:47 PM,  <dimva13@gmail.com> wrote:
> > > > > Imsanity allows you to make imports usable (not ideal, but at least
> > > > usable) for python projects without having to manage PYTHONPATHs or
> do
> > > > whacky stuff like running files with python -m or put even whackier
> > > > boilerplate at the top of every file. And all it requires is 'import
> > > > imsanity' at the top of every file. You can put it in a macro or even
> > just
> > > > type it because it's short and easy to remember.
> > > > >
> > > > > My question is: is this crazy? Please tell me there's a better way
> > and I
> > > > just wasted my time creating this package. There's nothing I'd like
> to
> > hear
> > > > more.
> > > >
> > > > Well, anything that makes you type "import imsanity" at the top of
> > > > every script MUST be crazy. :) I don't know about the actual
> > > > content/purpose though. Good luck with it!
> > > >
> > > > ChrisA
> > > > --
> > > > https://mail.python.org/mailman/listinfo/python-list
> > > >
> >
> > --
> > https://mail.python.org/mailman/listinfo/python-list
> >
> --
> https://mail.python.org/mailman/listinfo/python-list
>



-- 
Sivan Greenberg
Co founder & CTO
Vitakka Consulting

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Python's import situation has driven me to the brink of imsanity dimva13@gmail.com - 2016-02-06 18:47 -0800
  Re: Python's import situation has driven me to the brink of imsanity Chris Angelico <rosuav@gmail.com> - 2016-02-07 13:52 +1100
  Re: Python's import situation has driven me to the brink of imsanity Kevin Conway <kevinjacobconway@gmail.com> - 2016-02-07 06:34 +0000
    Re: Python's import situation has driven me to the brink of imsanity dimva13@gmail.com - 2016-02-07 06:13 -0800
      Re: Python's import situation has driven me to the brink of imsanity Kevin Conway <kevinjacobconway@gmail.com> - 2016-02-07 16:09 +0000
        Re: Python's import situation has driven me to the brink of imsanity dimva13@gmail.com - 2016-02-07 16:38 -0800
          Re: Python's import situation has driven me to the brink of imsanity Oscar Benjamin <oscar.j.benjamin@gmail.com> - 2016-02-10 00:31 +0000
          Re: Python's import situation has driven me to the brink of imsanity Sivan Greenberg <sivan@vitakka.co> - 2016-02-10 21:05 +0200
          Re: Python's import situation has driven me to the brink of imsanity Mark Lawrence <breamoreboy@yahoo.co.uk> - 2016-02-10 21:16 +0000
      Re: Python's import situation has driven me to the brink of imsanity Sivan Greenberg <sivan@vitakka.co> - 2016-02-07 18:15 +0200
  Re: Python's import situation has driven me to the brink of imsanity Sivan Greenberg <sivan@vitakka.co> - 2016-02-07 13:43 +0200

csiph-web