Spyder: Add simplified Github Issue/PR URL recognition

Created on 29 May 2019  路  7Comments  路  Source: spyder-ide/spyder

Now that we can click on URLs and files we could improve a bit on this and add recognition for a simplified version of github issues and pull requests.

I often use Spyder to develop spyder so this would be really handy, as I often see myself opening a browser tab and opening the referenced issue on sections of code.

Option 1

Simply include full urls to issues on our code base so we can click on them on the spot

Pros: No need to change code, just update the references
Cons: Long urls might crop up in the docstrings and comments

# See: https://github.com/spyder-ide/spyder/issues/NNNN
'''See: https://github.com/spyder-ide/spyder/issues/NNNN'''

Option 2

Add a shorthand syntax for github issues and PRs that makes life easy for us.

Pros: Shorter "links"
Cons: we need to update the code a bit + update the references

# See issue spyder-ide/spyder#NNNN
# See PR spyder-ide/spyder#NNNN
'''See PR spyder-ide/spyder#NNNN'''

This syntax would apply to both issues and PRs, since they are the "same" on github


What do you think @spyder-ide/core-developers ?

Editor Ux-usability Feature Question

Most helpful comment

I also prefer option 2, but it is not me who is going to implement it 馃槃

@jitseniesen The basic machinery is already implemented so, it is just a matter of deciding a format regex and adding a couple of lines of code.


@bcolsen interesting!

Option 3++

# See issue gh:spyder-ide/spyder#NNNN`
# See PR gh:spyder-ide/spyder#NNNN
'''See PR gh:spyder-ide/spyder#NNNN'''

And optional, so we give priority to github if not found

Something like (needs further thinking!)

r'((?:\w\w:)?[\w\-_]*/[\w\-_]*#[\d]*)'

Would match either of these

hello gh:spyder-ide/spyder#1245 hello
hello gl:spyder-ide/spyder#567 hello 
hello bb:spyder-ide/spyder#8995 hello 
hello spyder-ide/spyder#8995 hello   # Default to github

gh -> github
gl: gitlab
bb: bitbucket

All 7 comments

I like option 2 it's shorter and works the same as github markdown

Also consider:

Option 3

# See issue github:spyder-ide/spyder#NNNN`
# See PR github:spyder-ide/spyder#NNNN
'''See PR github:spyder-ide/spyder#NNNN'''

This might be easier to parse with code and could be extended to other code hosting site (like gitlab or bitbucket) if someone was so inclined.

I also prefer option 2, but it is not me who is going to implement it :smile:

Eventually, we can perhaps add a project option so that we can leave out the spyder-ide/spyder and just write issue #9463 in the code.

I also prefer option 2, but it is not me who is going to implement it 馃槃

@jitseniesen The basic machinery is already implemented so, it is just a matter of deciding a format regex and adding a couple of lines of code.


@bcolsen interesting!

Option 3++

# See issue gh:spyder-ide/spyder#NNNN`
# See PR gh:spyder-ide/spyder#NNNN
'''See PR gh:spyder-ide/spyder#NNNN'''

And optional, so we give priority to github if not found

Something like (needs further thinking!)

r'((?:\w\w:)?[\w\-_]*/[\w\-_]*#[\d]*)'

Would match either of these

hello gh:spyder-ide/spyder#1245 hello
hello gl:spyder-ide/spyder#567 hello 
hello bb:spyder-ide/spyder#8995 hello 
hello spyder-ide/spyder#8995 hello   # Default to github

gh -> github
gl: gitlab
bb: bitbucket

Eventually, we can perhaps add a project option so that we can leave out the spyder-ide/spyder and just write issue #9463 in the code.

That could also work.

All these are great ideas! thanks

r'((?:\w\w:)?[\w-_]/[\w-_]#[\d]*)'

This should be r'((?:\w\w:)?[\w\-_]*/[\w\-_]*#\d+)', as empty issue/PR numbers do not exist

Thanks @andfoy

Eventually, we can perhaps add a project option so that we can leave out the spyder-ide/spyder and just write issue #9463 in the code

I agree with this, it'd be really nice!

Was this page helpful?
0 / 5 - 0 ratings