Skip to content

Commit

Permalink
Merge pull request #27 from niaid/pylibjpeg_as_extra
Browse files Browse the repository at this point in the history
Move pylibjpeg dependecies as extra
  • Loading branch information
blowekamp authored Jun 10, 2022
2 parents a13f975 + b26e3ef commit 3ed5593
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ jobs:
run: |
python -m pip install --upgrade pip
pip install -r requirements-dev.txt
pip install -e .
pip install -e .[pylibjpeg]
- name: Test with pytest
run: |
python -m pytest
Expand Down
3 changes: 3 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ Then running::

Then the `rap_sitkcore` package can be installed if specified in another projects requirements.txt.

For pydicom to support more encodings additional pylibjpeg packages can be install. These dependencies are specified as
extra requirements in the setup.py. Specifying the package a "rap_sitkcore[pylibjpeg]" will install the extra packages.

Github Releases
^^^^^^^^^^^^^^^

Expand Down
7 changes: 7 additions & 0 deletions requirements-pylibjpeg.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# optional/extra packages for pydicom support for additional encodings
pylibjpeg
pylibjpeg-rle

# earlier versions did not correctly represent the version dependency on numpy
pylibjpeg-libjpeg>=1.3.1
pylibjpeg-openjpeg>=1.2.1
6 changes: 0 additions & 6 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,3 @@ requests

# additional packages for pydicom to expand supported files
pillow
pylibjpeg
pylibjpeg-rle
# earlier versions did not correctly represent the version dependecy on numpy
pylibjpeg-libjpeg>=1.3.1
pylibjpeg-openjpeg>=1.2.1

13 changes: 11 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,16 @@
with open("README.rst", "r") as fp:
long_description = fp.read()

with open("requirements.txt", "r") as fp:
requirements = list(filter(bool, (line.strip() for line in fp)))

def parse_requirements_file(filename):
with open(filename, "r", encoding="utf-8") as fp:
req = [line.strip() for line in fp.readlines() if line]
return req


requirements = parse_requirements_file("requirements.txt")

requirements_pylibjpeg = parse_requirements_file("requirements-pylibjpeg.txt")

setup(
name="rap_sitkcore",
Expand All @@ -37,6 +45,7 @@
"License :: OSI Approved :: Apache Software License",
"Operating System :: OS Independent",
],
extras_require={"pylibjpeg": requirements_pylibjpeg},
python_requires=">=3.7",
install_requires=requirements,
)

0 comments on commit 3ed5593

Please sign in to comment.