Re: Sharing code between different projects?

Discussion in 'Python' started by andrea crotti, Aug 15, 2012.

  1. 2012/8/14 Cameron Simpson <>:
    >
    > Having just skimmed this thread, one thing I haven't quite seen suggested is
    > this:
    >
    > Really do make a third "utilities" project, and treat "the project" and
    > "deploy" as separate notions. So to actually run/deploy project A's code
    > you'd have a short script that copied project A and the utilities project
    > code into a tree and ran off that. Or even a simple process/script to
    > update the copy of "utilities" in "project A"'s area.
    >
    > So you don't "share" code on an even handed basis but import the
    > "utilities" library into each project as needed.
    >
    > I do this (one my own very small scale) in one of two ways:
    >
    > - as needed, copy the desired revision of utilities into the project's
    > library space and do perforce's equivalent of Mercurial's addremove
    > on that library tree (comment "update utilities to revision X").
    >
    > - keep a perforce work area for the utilities in your project A area,
    > where your working project A can hook into it with a symlink or some
    > deploy/copy procedure as suggested above.
    > With this latter one you can push back into the utilities library
    > from your "live" project, because you have a real checkout. So:
    >
    > projectAdir
    > projectA-perforce-checkout
    > utilities-perforce-checkout
    > projectBdir
    > projectB-perforce-checkout
    > utilities-perforce-checkout
    >


    Thanks, is more or less what I was going to do.. But I would not use
    symlinks and similar things, because then every user should set it up
    accordingly.

    Potentially we could instead use the perforce API to change the
    workspace mappings at run-time, and thus "force" perforce to checkout
    the files in the right place..

    There is still the problem that people should checkout things from two
    places all the time instead of one..

    > Personally I become more and more resistent to cut/paste even for small
    > things as soon as multiple people use it; you will never get to backport
    > updates to even trivial code to all the copies.
    >
    > Cheers,



    Well sure, but on the other end as soon as multiple people use it you
    can't change any of the public functions signatures without being
    afraid that you'll break something..
     
    andrea crotti, Aug 15, 2012
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. andrea crotti

    Sharing code between different projects?

    andrea crotti, Aug 13, 2012, in forum: Python
    Replies:
    1
    Views:
    116
    Steven D'Aprano
    Aug 14, 2012
  2. Chris Angelico
    Replies:
    0
    Views:
    157
    Chris Angelico
    Aug 13, 2012
  3. andrea crotti
    Replies:
    2
    Views:
    136
    Miki Tebeka
    Aug 15, 2012
  4. Jean-Michel Pichavant

    Re: Sharing code between different projects?

    Jean-Michel Pichavant, Aug 14, 2012, in forum: Python
    Replies:
    0
    Views:
    141
    Jean-Michel Pichavant
    Aug 14, 2012
  5. Cameron Simpson

    Re: Sharing code between different projects?

    Cameron Simpson, Aug 14, 2012, in forum: Python
    Replies:
    0
    Views:
    178
    Cameron Simpson
    Aug 14, 2012
Loading...

Share This Page