Pip Create

  |   Source

A long time without news

Since Last post lots of things happend, I had 2 pull requests on github to fix some typos on previous posts (now updated). We had yet another Jupyter/IPython developper meeting in Berkeley. By the way, part of IPython will be renamed Jupyter. See Fernando Perez Slides and Talk. I got my PhD on my spare time when not workin on IPython. Went to EuroSciPy, hacked in London In Bloomberg Headquarters for a week-end organized by BloomberLab, got a Post Doc at Berkeley BIDS under the direction of above cited IPython BDFL and is about to move almost 9000 km from my current location to spen a year working on improving your everyday scientific workflow from the West of United-States, I think that's not too bad.

Since I got a little more time than usual to do some python everyday since this is officially my day job I was confronted to a few pyton problems, and also sa some amazing stuff.

Eg, James Powel Ast Expression hack of CPyhton: (original tweet)

>>> e = $(x+y) * w * x
>>> e(x = $z+10, w = 20)(30, 40)
(×, [(×, [(+, [(+, [40, 10]), 30]), 20]), (+, [40, 10])])
>>> _()

Give you unbound python expression that you can manipulate as you like. Pretty awesome, and would allow some neat meta programming. Woudl be nice if he could release his patch so that we could play with it.

A discussion with Olivier Grisel (sikit-learn) raised the point that a good package to deal with deprecation would be nice. Not just deprecation warning, but a decorator/context manager that takes as parameter the version of the software at which point a feature is removed and warn you that you have soem code you can clean.

Using grep to find deprecation warning don't always work, and sometime you would like a flag to just raise instead of printing a deprecation warning, or even do nothing when you are developpin aginst dev library.

And on the code side ?

Jupyter/IPython 3.0 is on its way. Slowly, we are late as usual.Recap will come at the right time.

I am working on integratin with Google Drive, and will try to add real-time synchronisation to Jupyter 1.0/IPython 4.0. IWe plan on addin other Operational Transform library backend, but workin on Google drive first got me my post doc. (Yes Google signed a Check to UC Berkeley)

Of course new project mean more packagin, and as you all know Python packaging is painfull. Especially when starting a new project you need to get all the basic files...etc.

Of course you can use project like audrayr/cookiecutter, but the you stil have the hassle to :

  • set up the GitHub repository,
  • Find a name
  • Hook Travis-CI find the annoyin setting that let you trigger build.
  • Hook up Readthedoc,
  • ... [1]
  • And so on and so forth

[1] add everything that every project should do.

I stronly believe that intelligence shoudl be in the package-manager, not the packager, and my few experiences with julia Pgk, and a small adventure with nodejs npm convinced me that there is really something wrong with Python packagin.

I'm not for a complete rewrite of it, and I completly understand the need for really custom setup script, but the complexity just to create a python package is too high. SO as a week-end hack introducing...

Pip Create

So yes I know that cookiecutter as pre- and post- hooks that might allow you to do that, but that's not the point. I just want a (few) simple command I can remember and which can do most of the heavy liftin for me.

I shamelessly call it PipCreate, because I hope that at some point in the future you will be able to just do a $pip create to enerate a new package.

So to work beyond dependencies, it just need a GitHub Private token (and maybe that you once loin to TravisCI, but haven't tested). The best thin is, if you don't have github token availlble, it will even open the browser for you at the right page. Here are teh step:

$ python3 -m pipcreate # need to create a real executable in future

Now either it grabs the github token from your keychain, or ask you for it and then does all the rest for you:

$ python3 -m pipcreate
will use target dir /Users/bussonniermatthias/eraseme
Comparing "SoftLilly" to other existing package name...
SoftLilly seem to have a sufficiently specific name
Logged in on GitHub as  Matthias Bussonnier
Workin with repository Carreau/SoftLilly
Clonning github repository locally
Cloning into 'SoftLilly'...
warning: You appear to have cloned an empty repository.
Checking connectivity... done.
I am now in  /Users/bussonniermatthias/eraseme/SoftLilly
Travis user: Matthias Bussonnier
syncing Travis with Github, this can take a while...
syncing done
Enabling travis hooks for this repository
Travis hook for this repository are now enabled.
Continuous interation test shoudl be triggerd everytime you push code to github
[master (root-commit) f4a9a5d] 'initial commit of SoftLilly'
 28 files changed, 1167 insertions(+)
 create mode 100644 .editorconfig
 create mode 100644 .gitignore
 create mode 100644 .travis.yml
 create mode 100644 AUTHORS.rst
 create mode 100644 CONTRIBUTING.rst
 create mode 100644 HISTORY.rst
 create mode 100644 LICENSE
 create mode 100644 MANIFEST.in
 create mode 100644 Makefile
 create mode 100644 README.rst
 create mode 100644 docs/Makefile
 create mode 100644 docs/authors.rst
 create mode 100755 docs/conf.py
 create mode 100644 docs/contributing.rst
 create mode 100644 docs/history.rst
 create mode 100644 docs/index.rst
 create mode 100644 docs/installation.rst
 create mode 100644 docs/make.bat
 create mode 100644 docs/readme.rst
 create mode 100644 docs/usage.rst
 create mode 100644 requirements.txt
 create mode 100644 setup.cfg
 create mode 100755 setup.py
 create mode 100755 softlilly/__init__.py
 create mode 100755 softlilly/softlilly.py
 create mode 100755 tests/__init__.py
 create mode 100755 tests/test_softlilly.py
 create mode 100644 tox.ini
Counting objects: 32, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (25/25), done.
Writing objects: 100% (32/32), 13.41 KiB | 0 bytes/s, done.
Total 32 (delta 0), reused 0 (delta 0)
To git@github.com:Carreau/SoftLilly.git
 * [new branch]      master -> master

It finishes up by openin travis on the test page after a push so that you can see the first test passin after a few seconds.

Hope that will give you soem ideas and patch welcomes.

Anyway, late now, Have fun, PR if you see typos are welcommed too.