From 86aa95c5dfe721ce98dca3ba811a7fa22466bfa6 Mon Sep 17 00:00:00 2001 From: ue-sho Date: Tue, 7 May 2024 16:14:03 +0900 Subject: [PATCH 1/3] Rename tester.yml to ci.yml --- .github/workflows/{tester.yml => ci.yml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .github/workflows/{tester.yml => ci.yml} (100%) diff --git a/.github/workflows/tester.yml b/.github/workflows/ci.yml similarity index 100% rename from .github/workflows/tester.yml rename to .github/workflows/ci.yml From a2b356284b973b4f50932ef8da34828133afeea8 Mon Sep 17 00:00:00 2001 From: ue-sho Date: Tue, 14 May 2024 18:14:39 +0900 Subject: [PATCH 2/3] Define the dependencies in only one place using setup.py --- Pipfile | 15 --------------- pyproject.toml | 43 ------------------------------------------- setup.py | 28 +++++++++++++++++++++++++++- 3 files changed, 27 insertions(+), 59 deletions(-) delete mode 100644 Pipfile delete mode 100644 pyproject.toml diff --git a/Pipfile b/Pipfile deleted file mode 100644 index 4a1d299..0000000 --- a/Pipfile +++ /dev/null @@ -1,15 +0,0 @@ - -# pipenv is useful for developing local package in -# editable mode. See https://pypi.org/project/pipenv/ - -[[source]] -url = "https://pypi.org/simple" -verify_ssl = true -name = "pypi" - -[packages] -dicom-anonymizer = {file = ".", editable = true} - -[dev-packages] -pytest = "*" -setuptools = "*" diff --git a/pyproject.toml b/pyproject.toml deleted file mode 100644 index 6f2a918..0000000 --- a/pyproject.toml +++ /dev/null @@ -1,43 +0,0 @@ -[project] -name = "dicom_anonymizer" -version = "1.0.12" -authors = [ - { name="Laurenn Lam", email="laurenn.lam@kitware.com" }, -] -description = "Program to anonymize dicom files with default and custom rules" -readme = "README.md" -requires-python = ">=3.6" -classifiers = [ - "Development Status :: 3 - Alpha", - "Intended Audience :: Science/Research", - "Topic :: Software Development :: Build Tools", - "License :: OSI Approved :: BSD License", - "Natural Language :: English", - "Programming Language :: Python" -] -keywords = ["dicom", "anonymizer" , "medical"] - -dependencies = [ - "pydicom", - "tqdm", -] - -[project.optional-dependencies] -dev = [ - "pytest", - "setuptools", # Needed to load pydicom's test files - "bs4", - "fire", - "requests" -] - -[project.scripts] -dicom-anonymizer = "dicomanonymizer.anonymizer:main" - -[project.urls] -"Homepage" = "https://github.com/KitwareMedical/dicom-anonymizer" -"Bug Tracker" = "https://github.com/KitwareMedical/dicom-anonymizer/issues" - -[tool.setuptools.packages] -find = {} # Scanning implicit namespaces is active by default - diff --git a/setup.py b/setup.py index 989276a..941e88e 100644 --- a/setup.py +++ b/setup.py @@ -10,6 +10,23 @@ setup( name='dicom_anonymizer', # Required version='1.0.12', # Required + author='Laurenn Lam', + author_email='laurenn.lam@kitware.com', + description="Program to anonymize dicom files with default and custom rules", + url="https://github.com/KitwareMedical/dicom-anonymizer", + project_urls={ + "Bug Tracker": "https://github.com/KitwareMedical/dicom-anonymizer/issues", + }, + classifiers=[ + "Development Status :: 3 - Alpha", + "Intended Audience :: Science/Research", + "Topic :: Software Development :: Build Tools", + "License :: OSI Approved :: BSD License", + "Natural Language :: English", + "Programming Language :: Python" + ], + keywords=["dicom", "anonymizer", "medical"], + python_requires='>=3.6', packages=find_packages(), # Required @@ -25,6 +42,15 @@ # installed, so they must be valid existing projects. # # For an analysis of "install_requires" vs pip's requirements files see: - # https://packaging.python.org/en/latest/requirements.html + # https://packaging.python.org/en/latest/guides/distributing-packages-using-setuptools/ install_requires=['pydicom', 'tqdm'], # Optional + + extras_require={ + 'dev': [ + "pytest", + "bs4", + "fire", + "requests" + ] + } ) From 0ad9ea4a63d4fcf0b3a191bbccf4e7451d3e2e65 Mon Sep 17 00:00:00 2001 From: ue-sho Date: Tue, 14 May 2024 18:14:56 +0900 Subject: [PATCH 3/3] Refactor CI workflow to improve caching and dependency management --- .github/workflows/ci.yml | 31 ++++++++++++++++++++++++------- 1 file changed, 24 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5791056..41e3295 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,10 +1,13 @@ -name: unit-tests +name: Continuous Integration + on: pull_request: merge_group: + jobs: launch-unit-tests: runs-on: ubuntu-latest + strategy: matrix: # Tracked via issue #77 @@ -16,11 +19,25 @@ jobs: steps: - uses: actions/checkout@v4 - - uses: actions/setup-python@v5 + - name: Set up Python + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - - run: python -m venv env - - run: source env/bin/activate - - run: env/bin/pip install -e . - - run: env/bin/pip install pytest - - run: env/bin/pytest + + - name: Cache Python dependencies + uses: actions/cache@v4 + id: pip-cache + with: + path: ~/.cache/pip + key: pip-${{ matrix.python-version }}-${{ hashFiles('**/setup.py') }} + restore-keys: | + pip-${{ matrix.python-version }}-${{ hashFiles('**/setup.py') }} + + - name: Install python dependencies + if: steps.pip-cache.outputs.cache-hit != 'true' + run: | + python -m pip install --upgrade pip + pip install -e .[dev] + + - name: Run test + run: pytest