Skip to content

Commit

Permalink
refactor: add version() function
Browse files Browse the repository at this point in the history
  • Loading branch information
jjjermiah committed Jan 29, 2024
1 parent bb0e687 commit ad549dc
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 9 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ jobs:
# test image with latest tag
docker run --rm \
${{ secrets.DOCKERHUB_USERNAME }}/nbiatoolkit:${LATEST_TAG} \
python -c "import nbiatoolkit; print(nbiatoolkit.__version__)"
NBIAToolkit
test_image_with_latest_tag:
Expand All @@ -222,4 +222,4 @@ jobs:
run: |
docker run --rm \
${{ secrets.DOCKERHUB_USERNAME }}/nbiatoolkit:latest \
python -c "import nbiatoolkit; print(nbiatoolkit.__version__)"
NBIAToolkit
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ LABEL maintainer="Jermiah Joseph"
# install the dependencies
RUN python -m pip install nbiatoolkit

RUN python -c 'import nbiatoolkit; print(nbiatoolkit.__version__)'
RUN python -c 'import nbiatoolkit; print(nbiatoolkit.version())'

# On run, open a bash shell
CMD ["/bin/bash"]
Expand Down
10 changes: 5 additions & 5 deletions docs/Tutorial.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
},
{
"cell_type": "code",
"execution_count": 5,
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -68,23 +68,23 @@
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": 3,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"'0.10.9'"
"'NBIAToolkit version: 0.12.1'"
]
},
"execution_count": 6,
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# import nbiatoolkit \n",
"nbiatoolkit.__version__"
"nbiatoolkit.version()"
]
},
{
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ readme = "README.md"

[tool.poetry.scripts]
DICOMSorter = "nbiatoolkit.dicomsort:DICOMSorter_cli"
NBIAToolkit = "nbiatoolkit:version"

[tool.poetry.dependencies]
python = ">=3.11 || 3.12"
Expand Down
5 changes: 4 additions & 1 deletion src/nbiatoolkit/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,14 @@
# set __version__ variable
__version__ = "0.12.1"

def version():
return "NBIAToolkit version: {}".format(__version__)

# import the modules
from .nbia import NBIAClient
from .auth import OAuth2
from .logger.logger import setup_logger
from .utils.nbia_endpoints import NBIA_ENDPOINTS

# define the __all__ variable
__all__ = ["NBIAClient", "OAuth2", "setup_logger", "NBIA_ENDPOINTS", "__version__"]
__all__ = ["NBIAClient", "OAuth2", "setup_logger", "NBIA_ENDPOINTS", "version"]
1 change: 1 addition & 0 deletions src/nbiatoolkit/nbia.py
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,7 @@ def parsePARAMS(self, params: dict) -> dict:
return PARAMS



# main
if __name__ == "__main__":
from pprint import pprint
Expand Down

0 comments on commit ad549dc

Please sign in to comment.