Deprecate version_filter from python_requirement

Review Request #3545 — Created March 8, 2016 and submitted

peiyu
pants
3019
3494
pants-reviews
kwlzn, patricklaw, stuhood

I ran into this long time TODO while working on the new engine: lambda is not picklable.

Discussed with group, looks like we can deprecate version_filter field.
The alternative to keep the option and parse the format using Interpreter.matches is
also discussed, but we don't find a compelling reason to continue support this rarely
used field. Given our interpreter_requirement=CPython>=2.7,<3, the only use case about
unittest2 is assumed.

Ideally we want to follow the similar deprecation cycle we have for cmdline options, I
am not sure how to do this for an optional field.

https://travis-ci.org/peiyuwang/pants/builds/114402900 passed
https://travis-ci.org/pantsbuild/pants/builds/114429073 passed

  • 0
  • 0
  • 1
  • 0
  • 1
Description From Last Updated
ST
  1. 
      
  2. src/python/pants/backend/python/python_requirement.py (Diff revision 1)
     
     
     
     
     
     
     
     
     
     
     
     
     

    This is removal rather than deprecation.

    To deprecate this, you'd use https://github.com/pantsbuild/pants/blob/master/src/python/pants/base/deprecated.py#L62 with a check that the argument is None.

    1. Added deprecated_conditional and tested with adding a version_filter to 3rdparty/python/BUILD, verified saw

      tw-mbp-peiyu:pants peiyu$ ./pants list 3rdparty/python::
      WARN] While parsing BuildFile(3rdparty/python/BUILD, FileSystemProjectTree(/Users/peiyu/github/pants)):
         15:     #   see also: tests/python/pants_test/backend/python/test_python_chroot.py
         16:     python_requirement('antlr_python_runtime==3.1.3',
         17:                        repository='http://www.antlr3.org/download/Python/',
      *  18:                        version_filter=lambda py, pl: True)
              DeprecationWarning: 
      version_filter using lambda function is no longer supported.
      Will be removed in version 0.0.79.
      
         19:   ]
         20: )
         21: 
      
      INFO] Detected git repository at /Users/peiyu/github/pants on branch peiyu/deprecate-version-filter-from-python-requirement
      3rdparty/python:pep8
      3rdparty/python:pywatchman
      ...
      
  3. 
      
KW
  1. 
      
  2. nice find here re: "There was a separate version of unittest2 for Python 3. This is no longer needed, but still exists on PyPI. This had the project name “unittest2py3k” but uses the same package name (“unittest2”)."

    it would probably make sense to constrain the unittest2 dep to the version in which unittest2py3k was superceded tho.

    according to the changelog it looks like that was 0.6.0, so something like this should work:

    unittest2>=0.6.0,<=1.9.0
    
    1. good call, changed to PythonRequirement('unittest2>=0.6.0,<=1.9.0')

  3. 
      
PE
ST
  1. 
      
  2. This can't actually be removed until the deprecation cycle has finished. Please add a top-level function that does the same thing for now.

    1. add version_filter back, but removed the other internal usages (unittest2 and the unit test for fingerprinting), next time we just need to clean up python_requirement.

  3. 
      
PE
PE
ST
  1. 
      
  2. Prefix with _ to signal that this is private to the module.

  3. 
      
PE
PA
  1. Ship It!
  2. 
      
PE
Review request changed

Status: Closed (submitted)

Change Summary:

Submitted as 7893d541b857d0fe9d57b904421b51cce937da6f

Loading...