bitprophet / releases

A powerful Sphinx changelog-generating extension.
http://releases.readthedocs.io/
BSD 2-Clause "Simplified" License
176 stars 41 forks source link

Breaks with new semantic-version package #84

Closed LefterisJP closed 4 years ago

LefterisJP commented 5 years ago

Hello,

It seems that you need to either pin to semantic-version==2.6.0 or try to upgrade the code for the new semantic-version.

Traceback (most recent call last):                                                                                                                                                                                                                                               
  File "/home/lefteris/.virtualenvs/rotkehlchen/lib/python3.7/site-packages/sphinx/cmdline.py", line 304, in main                                                                                                                                                                
    app.build(args.force_all, filenames)                                                                                                                                                                                                                                         
  File "/home/lefteris/.virtualenvs/rotkehlchen/lib/python3.7/site-packages/sphinx/application.py", line 331, in build                                                                                                                                                           
    self.builder.build_update()                                                                                                                                                                                                                                                  
  File "/home/lefteris/.virtualenvs/rotkehlchen/lib/python3.7/site-packages/sphinx/builders/__init__.py", line 342, in build_update                                                                                                                                              
    'out of date' % len(to_build))                                                                                                                                                                                                                                               
  File "/home/lefteris/.virtualenvs/rotkehlchen/lib/python3.7/site-packages/sphinx/builders/__init__.py", line 355, in build                                                                                                                                                     
    updated_docnames = set(self.env.update(self.config, self.srcdir, self.doctreedir))                                                                                                                                                                                           
  File "/home/lefteris/.virtualenvs/rotkehlchen/lib/python3.7/site-packages/sphinx/environment/__init__.py", line 568, in update                                                                                                                                                 
    self._read_serial(docnames, self.app)                                                                                                                                                                                                                                        
  File "/home/lefteris/.virtualenvs/rotkehlchen/lib/python3.7/site-packages/sphinx/environment/__init__.py", line 587, in _read_serial                                                                                                                                           
    self.read_doc(docname, app)                                                                                                                                                                                                                                                  
  File "/home/lefteris/.virtualenvs/rotkehlchen/lib/python3.7/site-packages/sphinx/environment/__init__.py", line 670, in read_doc                                                                                                                                               
    app.emit('doctree-read', doctree)                                                                                                                                                                                                                                            
  File "/home/lefteris/.virtualenvs/rotkehlchen/lib/python3.7/site-packages/sphinx/application.py", line 444, in emit                                                                                                                                                            
    return self.events.emit(event, self, *args)                                                                                         
  File "/home/lefteris/.virtualenvs/rotkehlchen/lib/python3.7/site-packages/sphinx/events.py", line 79, in emit                                                                                                                                                                  
    results.append(callback(*args))                                                                                                                                                                                                                                              
  File "/home/lefteris/.virtualenvs/rotkehlchen/lib/python3.7/site-packages/releases/__init__.py", line 612, in generate_changelog      
    doctree.walk(changelog_visitor)                                                                                                     
  File "/home/lefteris/.virtualenvs/rotkehlchen/lib/python3.7/site-packages/docutils/nodes.py", line 142, in walk                                                                                                                                                                
    if child.walk(visitor):                                                                                                                                                                                                                                                      
  File "/home/lefteris/.virtualenvs/rotkehlchen/lib/python3.7/site-packages/docutils/nodes.py", line 142, in walk                                                                                                                                                                
    if child.walk(visitor):                                                                                                                                                                                                                                                      
  File "/home/lefteris/.virtualenvs/rotkehlchen/lib/python3.7/site-packages/docutils/nodes.py", line 134, in walk                                                                                                                                                                
    visitor.dispatch_visit(self)                                                                                                                                                                                                                                                 
  File "/home/lefteris/.virtualenvs/rotkehlchen/lib/python3.7/site-packages/docutils/nodes.py", line 1912, in dispatch_visit                                                                                                                                                     
    return method(node)                                                                                                                                                                                                                                                          
  File "/home/lefteris/.virtualenvs/rotkehlchen/lib/python3.7/site-packages/releases/__init__.py", line 595, in visit_bullet_list                                                                                                                                                
    releases, _ = construct_releases(node.children, self.app)                                                                                                                                                                                                                    
  File "/home/lefteris/.virtualenvs/rotkehlchen/lib/python3.7/site-packages/releases/__init__.py", line 502, in construct_releases                                                                                                                                               
    stripped_entries[index + 1:], manager                                                                                                                                                                                                                                        
  File "/home/lefteris/.virtualenvs/rotkehlchen/lib/python3.7/site-packages/releases/__init__.py", line 429, in handle_upcoming_major_release                                                                                                                                    
    version = Version(obj.number)                                                                                                       
  File "/home/lefteris/.virtualenvs/rotkehlchen/lib/python3.7/site-packages/releases/models.py", line 14, in __init__                                                                                                                                                            
    super(Version, self).__init__(version_string, partial)                                                                                                                                                                                                                       
  File "/home/lefteris/.virtualenvs/rotkehlchen/lib/python3.7/site-packages/semantic_version/base.py", line 102, in __init__                                                                                                                                                     
    raise ValueError("Call either Version('1.2.3') or Version(major=1, ...).")                                                                                                                                                                                                   
ValueError: Call either Version('1.2.3') or Version(major=1, ...).       

The problem is (also according to their changelog) that you need to change the way you call Version().

From their changelog:

  • Use SimpleSpec instead of Spec
  • Replace calls to Version('1.2', partial=True) with SimpleSpec('~1.2')
  • iter(some_spec) is deprecated.

I tried to do the change myself in the relevant part of the code:

https://github.com/bitprophet/releases/blob/97a763e41bbe7374106a1c648b89346a0d935429/releases/models.py#L9-L14

    def __init__(self, version_string, partial=True):
        dots_num = version_string.count('.')
        if dots_num != 2:
            given_str = '~' + version_string
            partial = True
        else:
            given_str = version_string
            partial = False

        super(Version, self).__init__(given_str, partial=partial)

But I got numerous errors. First if it's not a partial version it does not accept a ~ prefix, which is why I ended up counting the dots above.

But then with the above code I start getting other errors in the semantic version package and I did not have the time to look further.

bitprophet commented 4 years ago

Thanks for reporting this, I see there's a couple of PRs open too (some a bit larger than I was expecting for this issue). I'll try to look those over sometime this week around the holiday and get something merged/released.

There's a chance I may opt to just say we tweak our compatibility to be with semantic-version<2.7 (as recommended; probably not an explicit pin on 2.6.0, we've worked with much older versions for a while I believe) as I can't imagine we need anything in 2.7.

bitprophet commented 4 years ago

Releases 1.5.2, 1.6.2 are en route to PyPI now.

LefterisJP commented 4 years ago

Thank you!