Skip to content

MRG: Prepare for pydicom 1.0 #379

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Nov 7, 2015
Merged

Conversation

effigies
Copy link
Member

@effigies effigies commented Nov 6, 2015

pydicom 1.0 will change the import name from dicom to pydicom, and move dicom.read_file to pydicom.dicomio.read_file. Adjust imports accordingly, and rename dicom to pydicom, when imported directly.

Closes #351

@effigies
Copy link
Member Author

effigies commented Nov 6, 2015

@ignatenkobrain Do you want to try this branch out?

@bcipolli
Copy link
Contributor

bcipolli commented Nov 6, 2015

This looks ok to me. My concern is: how are we going to test the two codepaths?

@effigies
Copy link
Member Author

effigies commented Nov 6, 2015

Until pydicom 1.0 is actually released, I'm not sure. I don't know if we can set up a Travis test to use a commit off Github. But there is a Travis test using the latest pydicom release, so we'll at least make sure we're not breaking anybody who's not bleeding edge.

I'm also okay with waiting to merge this until the 1.0 release of pydicom, in which case @ignatenkobrain can test this patch (which gives us some assurance that it's correct) and include it in his package. That way the patch is at least the one we expect to go in, so he's not stuck with an orphaned patch.

@arokem
Copy link
Member

arokem commented Nov 6, 2015

Would pip installing from github work for this?

http://stackoverflow.com/questions/13685920/install-specific-git-commit-with-pip

On Fri, Nov 6, 2015 at 7:49 AM, Chris Markiewicz [email protected]
wrote:

Until pydicom 1.0 is actually released, I'm not sure. I don't know if we
can set up a Travis test to use a commit off Github. But there is a Travis
test using the latest pydicom release, so we'll at least make sure we're
not breaking anybody who's not bleeding edge.

I'm also okay with waiting to merge this until the 1.0 release of pydicom,
in which case @ignatenkobrain https://github.com/ignatenkobrain can
test this patch (which gives us some assurance that it's correct) and
include it in his package. That way the patch is at least the one we expect
to go in, so he's not stuck with an orphaned patch.


Reply to this email directly or view it on GitHub
#379 (comment).

@effigies effigies force-pushed the pydicom1.0 branch 2 times, most recently from b4f9c54 to 8efb21e Compare November 6, 2015 16:21
@matthew-brett
Copy link
Member

Some test failures...

@effigies
Copy link
Member Author

effigies commented Nov 6, 2015

Thanks. Scanning today, so intermittent ability to check.

except ImportError:
have_dicom = False
else:
from pydicom.dicomio import read_file
Copy link
Member Author

Choose a reason for hiding this comment

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

This is a little ugly, reflecting the need to discover two different pydicom versions. The try/except/else allows us to detect a failure to import pydicom separately from a failure to find pydicom.dicomio.read_file.

@effigies
Copy link
Member Author

effigies commented Nov 6, 2015

Tests passing. Code review appreciated.

try:
import dicom as pydicom
except ImportError:
import pydicom
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it worth importing InvalidDicomError here, like you did with read_file? I know there's no change in the package path, but would be more consistent with the others (including Dataset)

@bcipolli
Copy link
Contributor

bcipolli commented Nov 6, 2015

LGTM. Essentially all of the try..catch blocks are in test code, and I don't think it's worth any extra effort to try and make things "prettier". I also think there's no need for further code comments; the code is pretty clear about what changed, and the commits/ PR document the time & reason for the change well.

All that to, again, say: LGTM

@ignatenkobrain
Copy link

Hi folks, I want. I will test it during weekend.

@effigies effigies changed the title BF: Prepare for pydicom 1.0 MRG: Prepare for pydicom 1.0 Nov 6, 2015
@ignatenkobrain
Copy link

I have checked this with PR for 2.0.2. Fixes my issue and works perfectly! Would be great if this also will be part of 2.0.2 (but not required, I will backport this patch myself)

@effigies
Copy link
Member Author

effigies commented Nov 7, 2015

I'd like to put this into 2.0.2.

Squashed down to two commits. Ready to merge? @matthew-brett @bcipolli

@bcipolli
Copy link
Contributor

bcipolli commented Nov 7, 2015

👍 Took a final look, happy from my side

@matthew-brett
Copy link
Member

Thanks for this - in it goes.

matthew-brett added a commit that referenced this pull request Nov 7, 2015
MRG: Prepare for pydicom 1.0

pydicom 1.0 will change the import name from dicom to pydicom, and move dicom.read_file to pydicom.dicomio.read_file. Adjust imports accordingly, and rename dicom to pydicom, when imported directly.

Closes #351
@matthew-brett matthew-brett merged commit 668f48b into nipy:master Nov 7, 2015
@effigies effigies deleted the pydicom1.0 branch November 9, 2015 02:17
grlee77 pushed a commit to grlee77/nibabel that referenced this pull request Mar 15, 2016
MRG: Prepare for pydicom 1.0

pydicom 1.0 will change the import name from dicom to pydicom, and move dicom.read_file to pydicom.dicomio.read_file. Adjust imports accordingly, and rename dicom to pydicom, when imported directly.

Closes nipy#351
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants