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


Groups > comp.lang.python > #60155

Re: how to deal with deprecating API functionality in python module?

Path csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <python-python-list@m.gmane.org>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.002
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'python,': 0.02; 'third- party': 0.04; 'run-time': 0.05; 'attribute': 0.07; 'apis': 0.09; 'feature.': 0.09; 'integers': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'subject:module': 0.09; 'subject:skip:f 10': 0.09; 'python': 0.11; 'changes': 0.15; 'finney': 0.16; 'ideally,': 0.16; 'libraries.': 0.16; 'needless': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'subject:API': 0.16; 'tuple': 0.16; 'subject:python': 0.16; 'library': 0.18; 'module': 0.19; 'trying': 0.19; 'deployment': 0.19; 'appears': 0.22; 'code,': 0.22; 'import': 0.22; 'install': 0.23; 'header:User-Agent:1': 0.23; 'versions': 0.24; 'equivalent': 0.26; 'header:X-Complaints-To:1': 0.27; 'installed': 0.27; 'chris': 0.29; "doesn't": 0.30; "i'm": 0.30; 'that.': 0.31; 'so- called': 0.31; 'writes:': 0.31; 'probably': 0.32; 'figure': 0.32; 'supposed': 0.32; 'trouble': 0.34; 'subject:with': 0.35; 'advice': 0.35; 'something': 0.35; 'but': 0.35; 'version': 0.36; 'subject:?': 0.36; 'level': 0.37; 'ben': 0.38; 'to:addr:python- list': 0.38; 'rather': 0.38; 'short': 0.38; 'does': 0.39; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'how': 0.40; '8bit%:29': 0.60; 'full': 0.61; 'new': 0.61; "you'll": 0.62; 'name': 0.63; 'choose': 0.64; 'skip:\xe2 10': 0.65; 'world': 0.66; 'receive': 0.70; 'intelligent': 0.74; '\xe2\x80\x93': 0.77; 'lack': 0.78; 'potentially': 0.81; 'application?': 0.84; 'blowing': 0.84; 'divergent': 0.84; 'duplication': 0.84; 'expose': 0.84; 'russell': 0.84; '\xe2\x80\x9cthe': 0.91
X-Injected-Via-Gmane http://gmane.org/
To python-list@python.org
From Ben Finney <ben+python@benfinney.id.au>
Subject Re: how to deal with deprecating API functionality in python module?
Date Thu, 21 Nov 2013 15:23:41 +1100
References <528D4D96.6010301@windriver.com>
Mime-Version 1.0
Content-Type text/plain; charset=utf-8
Content-Transfer-Encoding 8bit
X-Gmane-NNTP-Posting-Host rasputin.madmonks.org
X-Public-Key-ID 0xAC128405
X-Public-Key-Fingerprint 517C F14B B2F3 98B0 CB35 4855 B8B2 4C06 AC12 8405
X-Public-Key-URL http://www.benfinney.id.au/contact/bfinney-gpg.asc
X-Post-From Ben Finney <bignose+hates-spam@benfinney.id.au>
User-Agent Gnus/5.13 (Gnus v5.13) Emacs/23.4 (gnu/linux)
Cancel-Lock sha1:kmBgKsjESk4UmAZ6tpbpJmUSjAs=
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
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>
Newsgroups comp.lang.python
Message-ID <mailman.3001.1385007836.18130.python-list@python.org> (permalink)
Lines 39
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1385007836 news.xs4all.nl 15934 [2001:888:2000:d::a6]:43190
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:60155

Show key headers only | View raw


Chris Friesen <chris.friesen@windriver.com> writes:

> I'm pretty new to python, I'm trying to figure out how a python module
> is supposed to make non-backwards-compatible changes without blowing
> up the applications that use it.

The short answer is that Python doesn't have a library linker, so we do
it through co-operative APIs and bundled third-party libraries, rather
than versioned linking to shared libraries.

> How would something like this work in a python application?  I don't
> see any way to do the equivalent of
>
> import foo version X

You can have the library expose a ‘foo.version’ attribute (or,
sometimes, a ‘foo.__version__’ attribute) and have the library user
check for that. Ideally, make its value a tuple of integers (as Python
does for its run-time version) so the library user can choose the level
of precision it will match.

Sadly, there's no way to have multiple versions of a library with the
same name installed and available to the same application.

You'll probably receive advice to install all your application's
dependencies together in a so-called “virtualenv” with the application.

This is dreadful practice – it ignores the OS package managed libraries,
it requires every deployment to manage dependencies separately, it
promotes needless duplication and potentially divergent code, it makes
security updates a nightmare, etc. – but it appears to be the best
Python has for this, given the lack of a versioned linking feature.

-- 
 \     “The trouble with the world is that the stupid are cocksure and |
  `\             the intelligent are full of doubt.” —Bertrand Russell |
_o__)                                                                  |
Ben Finney

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


Thread

Re: how to deal with deprecating API functionality in python module? Ben Finney <ben+python@benfinney.id.au> - 2013-11-21 15:23 +1100

csiph-web