Skip to content

Commit

Permalink
Deprecate pydicom module, prep for release (#59)
Browse files Browse the repository at this point in the history
  • Loading branch information
scaramallion authored Apr 11, 2021
1 parent fdc6e98 commit bc205ea
Show file tree
Hide file tree
Showing 15 changed files with 123 additions and 389 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/pytest-builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: [3.6, 3.7, 3.8]
python-version: [3.6, 3.7, 3.8, 3.9]

steps:
- uses: actions/checkout@v2
Expand All @@ -25,6 +25,7 @@ jobs:
- name: Install package and dependencies
run: |
python -m pip install -U pip
python -m pip install wheel
python -m pip install .
python -m pip uninstall -y pylibjpeg-openjpeg
python -m pip install git+https://github.com/pydicom/pylibjpeg-data
Expand Down
41 changes: 41 additions & 0 deletions .github/workflows/release-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Build package and deploy to PyPI

on:
release:
types: [ published ]

jobs:
build_deploy:
name: Build and deploy
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
with:
submodules: true

- uses: actions/setup-python@v2
name: Install Python
with:
python-version: 3.9

- name: Install requirements

run: |
python -m pip install -U pip
python -m pip install twine wheel
- name: Build wheels and sdist
run: |
python setup.py sdist bdist_wheel
- uses: actions/upload-artifact@v2
with:
name: wheels
path: ./dist

- name: Publish package to PyPi
uses: pypa/gh-action-pypi-publish@master
with:
user: __token__
password: ${{ secrets.PYPI_PASSWORD }}
8 changes: 2 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,15 +64,12 @@ determined with:

### Usage
#### With pydicom
Assuming you already have *pydicom* v1.4+ and suitable plugins installed:
Assuming you already have *pydicom* v2.1+ and suitable plugins installed:

```python
from pydicom import dcmread
from pydicom.data import get_testdata_file

# Importing the package adds the pixel data handler to pydicom
import pylibjpeg

# With the pylibjpeg-libjpeg plugin
ds = dcmread(get_testdata_file('JPEG-LL.dcm'))
jpg_arr = ds.pixel_array
Expand All @@ -88,8 +85,7 @@ function:
```python
from pydicom import dcmread
from pydicom.data import get_testdata_file

from pylibjpeg import generate_frames
from pydicom.pixel_data_handlers.pylibjpeg_handler import generate_frames

ds = dcmread(get_testdata_file('color3d_jpeg_baseline.dcm'))
frames = generate_frames(ds)
Expand Down
File renamed without changes.
File renamed without changes.
11 changes: 11 additions & 0 deletions docs/changes/v1.2.0.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
.. _v1.2.0:

1.2.0
=====

* Added support for Python 3.9
* Removed standalone pydicom pixel data handler
* ``The pylibjpeg.pydicom`` module is deprecated and will be removed in v2.0,
use pydicom instead.
* ``get_pixel_data_decoders`` moved from ``pylibjpeg.pydicom.utils`` to
```pylibjpeg.utils``
22 changes: 3 additions & 19 deletions pylibjpeg/__init__.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
"""Set package shortcuts."""

import logging
import sys


from ._version import __version__
from .utils import decode, add_handler
from pylibjpeg._version import __version__
from pylibjpeg.pydicom.utils import generate_frames # deprecated
from pylibjpeg.utils import decode


# Setup default logging
Expand All @@ -23,18 +22,3 @@ def debug_logger():
formatter = logging.Formatter('%(levelname).1s: %(message)s')
handler.setFormatter(formatter)
logger.addHandler(handler)


try:
import pydicom
_logger.debug('pydicom module loaded')
from pylibjpeg.pydicom.utils import generate_frames

# We only add a handler if pydicom doesn't already have one
try:
import pydicom.pixel_data_handlers.pylibjpeg_handler
except ImportError:
add_handler()

except ImportError:
pass
2 changes: 1 addition & 1 deletion pylibjpeg/_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import re


__version__ = '1.2.0.dev0'
__version__ = '1.2.0'


VERSION_PATTERN = r"""
Expand Down
192 changes: 0 additions & 192 deletions pylibjpeg/pydicom/pixel_data_handler.py

This file was deleted.

Loading

0 comments on commit bc205ea

Please sign in to comment.