amol- / dukpy

Simple JavaScript interpreter for Python

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Better packaging

webknjaz opened this issue · comments

Hi,

There's a few ways of improving this distribution package:

  • integrate setuptools_scm into setup.py to enable version guessing via git tag — you'll never need to hardcode the version in Python files;
  • enable automatic deployment of the package to PYPI via TravisCI on git tag created.

Would you accept my help with this?

automatic release to PyPi through travis seems a good idea, but I'm a bit concerned by setuptools_scm. As it's a setup_requires does it mean that every person that installs the package through sources will need it?

It's handled automatically by setuptools+pip

Well that's the purpose of setup_requires but one of the foundations of dukpy is to keep its install phase dependencies less ( no libraries required apart cpython ) and I would really prefer to avoid adding one just for that.

It would make more sense to have something that does that at sdist phase instead of doing that on PC on user installing the package

Well, I need to check this, because it is not listed among downloaded packages when I spawn pip install. It was just my guess.

@amol- alright, I've checked this on the Internet and tested with pip install command and now I'm sure that this is a dependency only for the build environment.

Note that you won't see the downloaded package because it's not downloaded by pip as a dependency, it's actually downloaded by setuptools when egg_info is performed by pip to install it. Also it's downloaded in .eggs so it's not visibile by default.

You will notice that if you run:

$ pip install sshuttle -v --no-cache-dir --no-clean --no-binary :all:

And you stop it (CTRL+Z) right after Running setup.py (path:/tmp/pip-build-Gzd6Su/sshuttle/setup.py) egg_info for package sshuttle phrase (I'm not aware of any way to prevent pip from deleting the packages build dir after it installs them) you will find setuptools_scm in /tmp/pip-build-Gzd6Su/sshuttle/.eggs which means that setuptools downloaded the package through easy_install and made it available to the setup phase.

99% of the times this won't be an issue, especially since people will install wheels, but I'm not sure it makes sense to face the 1% issues just to avoid the effort of manually updating the version :D

Kajiki for example achieves a similar result through https://github.com/nandoflorestan/kajiki/blob/master/release_new_version.py which takes care of tagging the repository and setting the version automatically without the need to extend the setup script.