Key Point of ‘develop’ command

When reading the code, the key points of things to do should be noted. In fact, I should do this work at a very beginning time, but now I just can remind myself to do it.

Basic requirements of ‘develop’ command:

Requirement 1: ‘develop’ should be a kind of Command

In setuptools, ‘develop’ is just a kind of ‘easy_install’ command, which means ‘develop’ class derives from ‘easy_install’ class. While in packaging module, there is not such kind of ‘easy_install’ class, so some changes should be considered.

Requirement 2: ‘develop’ should support several useful options

In setuptools, ‘develop’ not only has its specific options, but also supports all of ‘easy_install’ options. It maybe just necessary to implement its specific options in packaging module, but I’m not sure. So, I write these here just for future possible reason.

What does ‘develop’ do in distutils(Not compelte though; what just I know and  can remember)?

Does 1: Create egg_info files and build extensions if necessary

Because packaing uses .dist-info directory to hold metadata instead of egg_info,  new apis from packaging should be adopted in develop class.

Does 2: Add an entry in easy_install.pth to let anyone can import it just like it’s installed

In packaing module, there isn’t easy_install.pth in site-packages directory, so to let anyone can import it, it’s still necessary add a .pth file in site-packages, but we can improve – .pth file created by ‘packaging’ module should not contain magic words in the form of ‘import’ keywords. We can also add the Tarek’s consideration to implement it in a perfect way (see previous MLs).

Does 3: Create a wrapper script

It’s easy, and also easy to implement with new apis offered by ‘packaing’ module.

Does 4: Create an .egg-link file

It is just used to let setuptools know this tool has been installed on this computer now. But it seems that ‘packaging’ has a more advanced solution, so it maybe easy to implement.

 

Anyway, the above is all I can remember from days’ studying and reading, and I think more new content will be added in future, but it’s a very good way to help promote future coding.

 

Advertisements
This entry was posted in Distutils2, Python. Bookmark the permalink.

3 Responses to Key Point of ‘develop’ command

  1. Éric Araujo says:

    > In setuptools, ‘develop’ is just a kind of ‘easy_install’ command, which
    > means ‘develop’ class derives from ‘easy_install’ class.

    Really? Not setuptools.cmd.Command?

    For packaging, look at existing commands (for example install_distinfo) to see how it’s done.

    > Because packaing uses .dist-info directory to hold metadata instead of
    > egg_info, new apis from packaging should be adopted in develop class.

    The install_distinfo command creates the directory in the install location. It should be separated into a build_distinfo and an install_distinfo command to let you implement develop.

    For the .pth file, you should read about the site module and PEP 370. Putting it in the user site-packages may be better than using the system site-packages. (I use “may” because I really don’t know; you have to think about it and propose what you think best 🙂

    > Does 3: Create a wrapper script
    > It’s easy, and also easy to implement with new apis offered by ‘packaing’
    > module.

    If you write them, sure 🙂

    > Does 4: Create an .egg-link file

    If you read more about this, I’ll be interested. I don’t remember what it does, so I can’t say if it will be needed for us.

    Keep going! 🙂

    • higery says:

      > Really? Not setuptools.cmd.Command?
      Both. easy_install a subclass of setuptools.cmd.Command, so I’m not sure if there are extra things should be done in packaging.
      See code :
      class develop(easy_install):
      """Set up package for development"""

  2. Éric Araujo says:

    Okay. The key point is that commands subclass cmd.Command.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s