Skip to content

allow to specify module version doctest-requires sphinx directive#78

Merged
bsipocz merged 4 commits intoscientific-python:masterfrom
vanyakosmos:feature/doctest-requires-with-version
Nov 6, 2019
Merged

allow to specify module version doctest-requires sphinx directive#78
bsipocz merged 4 commits intoscientific-python:masterfrom
vanyakosmos:feature/doctest-requires-with-version

Conversation

@vanyakosmos
Copy link
Contributor

close #57
close #29
close #18

Note 1 - split regex

Old regex \s*,?\s* used in re.split produces ['s', 'y', 's'] from string 'sys'.

New regex \s*[,\s]\s*:

'sys' -> ['sys']
'sys pandas' -> ['sys', 'pandas']
'sys, pandas<=123' -> ['sys', 'pandas<=123']
'sys,pandas' -> ['sys', 'pandas']
'sys , pandas' -> ['sys', 'pandas']

Note 2 - getting package versions

For python3.4+ there is pkg_resources.require to check that package with specified version is available.

For python2 (which should be already dropped) I wrote custom version checker which essentially just pull packages info from pip freeze output and compare versions using distutils.version.LooseVersion.
pip freeze is triggered only for python3.4-.

Copy link
Contributor

@astrofrog astrofrog left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great to me!

Copy link
Member

@bsipocz bsipocz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor nitpicking, otherwise looks like a great improvement!

bsipocz
bsipocz approved these changes Nov 5, 2019
@vanyakosmos vanyakosmos requested a review from bsipocz November 6, 2019 15:15
@bsipocz
Copy link
Member

bsipocz commented Nov 6, 2019

Thank you @vanyakosmos!

@bsipocz bsipocz merged commit 9c92e9c into scientific-python:master Nov 6, 2019
@pllim
Copy link
Contributor

pllim commented Nov 15, 2019

Is there a new release with this patch?

@pllim
Copy link
Contributor

pllim commented Nov 15, 2019

Could use the fix for #29 in astropy/astropy#7928

@bsipocz
Copy link
Member

bsipocz commented Nov 15, 2019

@pllim - I can make a release over the weekend, along with helpers, etc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

4 participants