Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #27045
| Path | csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!feeder2.ecngs.de!ecngs!feeder.ecngs.de!xlned.com!feeder7.xlned.com!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <prvs=5664759f3=jeanmichel@sequans.com> |
| 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; 'example:': 0.03; 'url:pypi': 0.03; 'value,': 0.03; '"""': 0.05; 'modify': 0.05; '%s"': 0.07; 'distributing': 0.07; 'exit': 0.07; 'subject:code': 0.07; 'tests,': 0.07; 'type,': 0.07; 'python': 0.09; '"""create': 0.09; 'broken.': 0.09; 'domains,': 0.09; 'cc:addr:python-list': 0.10; 'def': 0.10; 'url:)': 0.13; 'properly': 0.15; "api's": 0.16; 'perforce': 0.16; 'subject:between': 0.16; 'subject:projects': 0.16; 'temp': 0.16; 'wrote:': 0.17; 'copied': 0.17; 'pieces': 0.17; 'projects,': 0.17; 'switched': 0.17; 'module': 0.19; 'code.': 0.20; 'cc:2**0': 0.23; 'project,': 0.24; 'cc:addr:python.org': 0.25; 'header:In-Reply-To:1': 0.25; 'header :User-Agent:1': 0.26; 'looks': 0.26; 'wondering': 0.26; '(we': 0.27; 'experiences': 0.27; 'this?': 0.28; 'skip:_ 10': 0.29; 'class': 0.29; "i'm": 0.29; 'on,': 0.30; 'sense': 0.31; 'code': 0.31; 'url:python': 0.32; 'could': 0.32; 'problem': 0.33; 'anyone': 0.33; 'project': 0.34; 'server': 0.35; 'announcement': 0.35; 'subject:?': 0.35; 'there': 0.35; 'really': 0.36; 'ability': 0.36; 'except': 0.36; 'but': 0.36; 'url:org': 0.36; 'useful': 0.36; "i'll": 0.36; 'should': 0.36; 'moment': 0.37; 'subject:: ': 0.38; 'skip:l 20': 0.38; 'some': 0.38; 'things': 0.38; 'where': 0.40; 'think': 0.40; 'your': 0.60; 'link': 0.60; 'remove': 0.61; 'real': 0.61; 'share': 0.61; 'received:194': 0.61; 'first': 0.61; 'back': 0.62; 'situation': 0.62; 'between': 0.63; 'different': 0.63; 'world': 0.63; 'burden': 0.65; 'potentially': 0.66; 'andrea': 0.84; 'runnning': 0.84 |
| X-IronPort-AV | E=Sophos;i="4.77,767,1336341600"; d="scan'208";a="653863" |
| X-Virus-Scanned | amavisd-new at zimbra.sequans.com |
| Date | Tue, 14 Aug 2012 16:34:23 +0200 |
| From | Jean-Michel Pichavant <jeanmichel@sequans.com> |
| User-Agent | Mozilla-Thunderbird 2.0.0.24 (X11/20100328) |
| MIME-Version | 1.0 |
| To | andrea crotti <andrea.crotti.0@gmail.com> |
| Subject | Re: Sharing code between different projects? |
| References | <CAF_E5JZ82ar7sWi5eOWe46N2wXVAX2QYUb5F9==0dxRbYMsEhg@mail.gmail.com> |
| In-Reply-To | <CAF_E5JZ82ar7sWi5eOWe46N2wXVAX2QYUb5F9==0dxRbYMsEhg@mail.gmail.com> |
| Content-Type | text/plain; charset=ISO-8859-1; format=flowed |
| Content-Transfer-Encoding | 7bit |
| Cc | python-list <python-list@python.org> |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.12 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <http://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 | <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.3278.1344954871.4697.python-list@python.org> (permalink) |
| Lines | 61 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1344954871 news.xs4all.nl 6977 [2001:888:2000:d::a6]:41238 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:27045 |
Show key headers only | View raw
andrea crotti wrote:
> I am in the situation where I am working on different projects that
> might potentially share a lot of code.
>
> I started to work on project A, then switched completely to project B
> and in the transiction I copied over a lot of code with the
> corresponding tests, and I started to modify it.
>
> Now it's time to work again on project A, but I don't want to copy
> things over again.
>
> I would like to design a simple and nice way to share between projects,
> where the things I want to share are simple but useful things as for
> example:
>
> class TempDirectory:
> """Create a temporary directory and cd to it on enter, cd back to
> the original position and remove it on exit
> """
> def __init__(self):
> self.oldcwd = getcwd()
> self.temp_dir = mkdtemp()
>
> def __enter__(self):
> logger.debug("create and move to temp directory %s" % self.temp_dir)
> return self.temp_dir
>
> def __exit__(self, type, value, traceback):
> # I first have to move out
> chdir(self.oldcwd)
> logger.debug("removing the temporary directory and go back to
> the original position %s" % self.temp_dir)
> rmtree(self.temp_dir)
>
>
> The problem is that there are functions/classes from many domains, so it
> would not make much sense to create a real project, and the only name I
> could give might be "utils or utilities"..
>
> In plus the moment the code is shared I must take care of versioning and
> how to link different pieces together (we use perforce by the way).
>
> If then someone else except me will want to use these functions then of
> course I'll have to be extra careful, designing really good API's and so
> on, so I'm wondering where I should set the trade-off between ability to
> share and burden to maintain..
>
> Anyone has suggestions/real world experiences about this?
>
I can think of logilab-common (http://www.logilab.org/848/)
Having a company-wide python module properly distributed is one to
achieve your goal. Without distributing your module to the public,
there's a way to have a pypi-like server runnning on your private network :
http://pypi.python.org/pypi/pypiserver/
JM
Note : looks like pypi.python.org is having some trouble, the above link is broken. Search for recent announcement about pypiserver.
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: Sharing code between different projects? Jean-Michel Pichavant <jeanmichel@sequans.com> - 2012-08-14 16:34 +0200
csiph-web