Skip to content

Commit

Permalink
Add pyproject.toml, typing, remove pydicom module (#74)
Browse files Browse the repository at this point in the history
  • Loading branch information
scaramallion authored Jan 2, 2024
1 parent bc25035 commit 23d43be
Show file tree
Hide file tree
Showing 24 changed files with 390 additions and 1,140 deletions.
2 changes: 1 addition & 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.7', '3.8', '3.9', '3.10']
python-version: ['3.10', '3.11', '3.12']

steps:
- uses: actions/checkout@v2
Expand Down
2 changes: 1 addition & 1 deletion LICENCE.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2020 scaramallion and pylibjpeg contributors
Copyright (c) 2020-2024 scaramallion and pylibjpeg contributors

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

## pylibjpeg

A Python 3.7+ framework for decoding JPEG images and decoding/encoding RLE datasets, with a focus on providing support for [pydicom](https://github.com/pydicom/pydicom).
A Python 3.10+ framework for decoding JPEG images and decoding/encoding RLE datasets, with a focus on providing support for [pydicom](https://github.com/pydicom/pydicom).


### Installation
Expand Down
11 changes: 5 additions & 6 deletions pylibjpeg/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,18 @@
import logging

from pylibjpeg._version import __version__
from pylibjpeg.pydicom.utils import generate_frames # deprecated
from pylibjpeg.utils import decode
from pylibjpeg.utils import decode # noqa: F401


# Setup default logging
_logger = logging.getLogger("pylibjpeg")
_logger = logging.getLogger(__name__)
_logger.addHandler(logging.NullHandler())
_logger.debug("pylibjpeg v{}".format(__version__))
_logger.debug(f"pylibjpeg v{__version__}")


def debug_logger():
def debug_logger() -> None:
"""Setup the logging for debugging."""
logger = logging.getLogger("pylibjpeg")
logger = logging.getLogger(__name__)
logger.handlers = []
handler = logging.StreamHandler()
logger.setLevel(logging.DEBUG)
Expand Down
54 changes: 2 additions & 52 deletions pylibjpeg/_version.py
Original file line number Diff line number Diff line change
@@ -1,55 +1,5 @@
"""Version information for pylibjpeg based on PEP396 and 440."""

import re
from importlib.metadata import version


__version__ = "1.4.0"


VERSION_PATTERN = r"""
v?
(?:
(?:(?P<epoch>[0-9]+)!)? # epoch
(?P<release>[0-9]+(?:\.[0-9]+)*) # release segment
(?P<pre> # pre-release
[-_\.]?
(?P<pre_l>(a|b|c|rc|alpha|beta|pre|preview))
[-_\.]?
(?P<pre_n>[0-9]+)?
)?
(?P<post> # post release
(?:-(?P<post_n1>[0-9]+))
|
(?:
[-_\.]?
(?P<post_l>post|rev|r)
[-_\.]?
(?P<post_n2>[0-9]+)?
)
)?
(?P<dev> # dev release
[-_\.]?
(?P<dev_l>dev)
[-_\.]?
(?P<dev_n>[0-9]+)?
)?
)
(?:\+(?P<local>[a-z0-9]+(?:[-_\.][a-z0-9]+)*))? # local version
"""


def is_canonical(version):
"""Return True if `version` is a PEP440 conformant version."""
match = re.match(
r"^([1-9]\d*!)?(0|[1-9]\d*)"
r"(\.(0|[1-9]\d*))"
r"*((a|b|rc)(0|[1-9]\d*))"
r"?(\.post(0|[1-9]\d*))"
r"?(\.dev(0|[1-9]\d*))?$",
version,
)

return match is not None


assert is_canonical(__version__)
__version__: str = version("pylibjpeg")
File renamed without changes.
209 changes: 0 additions & 209 deletions pylibjpeg/pydicom/utils.py

This file was deleted.

Loading

0 comments on commit 23d43be

Please sign in to comment.