Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move to pyproject.toml #260

Open
wants to merge 49 commits into
base: develop
Choose a base branch
from
Open

Move to pyproject.toml #260

wants to merge 49 commits into from

Conversation

suvayu
Copy link
Collaborator

@suvayu suvayu commented Jul 31, 2024

  • handle versioning from Git tags (setuptools_scm)
  • dev dependencies included as optional dependency "dev"
  • Tests passing
  • Lint passing
  • Docs building
  • Consider using tox-conda for compatibility testing
  • conda-build step is partial
  • include R packaging (for conda)

Build with python -m build .

$ unzip -l dist/cvasl-0.0.4.dev28+geba2ba7.d20240731-py3-none-any.whl 
Archive:  dist/cvasl-0.0.4.dev28+geba2ba7.d20240731-py3-none-any.whl
  Length      Date    Time    Name
---------  ---------- -----   ----
       24  06-18-2024 09:42   cvasl/__init__.py
       90  06-18-2024 09:42   cvasl/__main__.py
      467  07-31-2024 15:32   cvasl/_version.py
    20746  06-18-2024 09:42   cvasl/carve.py
     8292  06-18-2024 09:42   cvasl/cli.py
    11509  06-18-2024 09:42   cvasl/file_handler.py
    13391  07-31-2024 11:24   cvasl/harmony.py
     6500  06-18-2024 09:42   cvasl/mold.py
    37581  07-10-2024 09:23   cvasl/seperated.py
       24  06-18-2024 09:42   cvasl/vendor/__init__.py
     2791  06-18-2024 09:42   cvasl/vendor/ComBat++/README.md
      244  06-18-2024 09:42   cvasl/vendor/ComBat++/Renvironment.yml
     2054  06-18-2024 09:42   cvasl/vendor/ComBat++/Untitled.ipynb
     5785  06-18-2024 09:42   cvasl/vendor/ComBat++/combatPP.R
     3837  06-18-2024 09:42   cvasl/vendor/ComBat++/utils.R
     6148  07-10-2024 09:23   cvasl/vendor/RELIEF/.DS_Store
       28  07-10-2024 09:23   cvasl/vendor/RELIEF/.Rbuildignore
       40  07-10-2024 09:23   cvasl/vendor/RELIEF/.gitignore
      278  07-10-2024 09:23   cvasl/vendor/RELIEF/DESCRIPTION
       71  07-10-2024 09:23   cvasl/vendor/RELIEF/NAMESPACE
     2398  07-10-2024 09:23   cvasl/vendor/RELIEF/README.md
     4087  07-10-2024 09:23   cvasl/vendor/RELIEF/RELIEF.R
      300  07-31-2024 11:24   cvasl/vendor/RELIEF/relief_environment.yaml
    11356  06-18-2024 09:42   cvasl/vendor/comscan/LICENSE
     3394  06-18-2024 09:42   cvasl/vendor/comscan/README.rst
       57  07-31-2024 11:24   cvasl/vendor/comscan/__init__.py
    33465  07-31-2024 11:24   cvasl/vendor/comscan/clustering.py
      810  07-16-2024 15:08   cvasl/vendor/comscan/comscan_environment.yml
      810  07-31-2024 11:24   cvasl/vendor/comscan/looser_comscan.yml
    57365  07-31-2024 11:24   cvasl/vendor/comscan/neurocombat.py
     4969  07-31-2024 11:24   cvasl/vendor/comscan/nifti.py
    12533  07-31-2024 11:24   cvasl/vendor/comscan/utils.py
     2487  06-18-2024 09:42   cvasl/vendor/covbat/README.md
    13566  06-18-2024 09:42   cvasl/vendor/covbat/covbat.py
      389  06-18-2024 09:42   cvasl/vendor/covbat/covbat_environment.yml
     1089  06-18-2024 09:42   cvasl/vendor/neurocombat/LICENSE
     2892  06-18-2024 09:42   cvasl/vendor/neurocombat/README.md
       24  06-18-2024 09:42   cvasl/vendor/neurocombat/__init__.py
    18724  06-18-2024 09:42   cvasl/vendor/neurocombat/neurocombat.py
     1069  06-18-2024 09:42   cvasl/vendor/open_nested_combat/LICENSE
     1400  06-18-2024 09:42   cvasl/vendor/open_nested_combat/README.md
       24  06-18-2024 09:42   cvasl/vendor/open_nested_combat/__init__.py
    11082  06-18-2024 09:42   cvasl/vendor/open_nested_combat/nest.py
      124  06-18-2024 09:42   cvasl/vendor/open_nested_combat/requirements.txt
    11376  07-31-2024 15:32   cvasl-0.0.4.dev28+geba2ba7.d20240731.dist-info/LICENSE
    11440  07-31-2024 15:32   cvasl-0.0.4.dev28+geba2ba7.d20240731.dist-info/METADATA
      394  07-31-2024 15:32   cvasl-0.0.4.dev28+geba2ba7.d20240731.dist-info/NOTICE.md
       91  07-31-2024 15:32   cvasl-0.0.4.dev28+geba2ba7.d20240731.dist-info/WHEEL
        6  07-31-2024 15:32   cvasl-0.0.4.dev28+geba2ba7.d20240731.dist-info/top_level.txt
     4446  07-31-2024 15:32   cvasl-0.0.4.dev28+geba2ba7.d20240731.dist-info/RECORD
---------                     -------
   332067                     50 files

@suvayu suvayu requested a review from egpbos July 31, 2024 15:43
@suvayu suvayu marked this pull request as ready for review July 31, 2024 15:43
@suvayu suvayu changed the base branch from main to develop July 31, 2024 15:44
@suvayu
Copy link
Collaborator Author

suvayu commented Jul 31, 2024

I guess I should exclude the notebooks, and yaml files?

@egpbos
Copy link
Collaborator

egpbos commented Aug 1, 2024

Looking great so far!

The doc building should be minor, the workflow is still trying to run setup.py, so just replace that with a default sphinx build command, see e.g. the template workflow: https://github.com/NLeSC/python-template/blob/main/%7B%7Bcookiecutter.directory_name%7D%7D/.github/workflows/documentation.yml To copy-paste (almost) that whole workflow, you also need to add a doc group under [project.optional-dependencies], see here.

Btw, I think the conda package wasn't built for a while already, so not sure whether that stuff is still necessary, but were you planning on porting that still as well? If not, we can always do it later, probably not a priority right now.

@suvayu
Copy link
Collaborator Author

suvayu commented Aug 11, 2024

I'm a bit confused & unsure about the mixed conda + pip setup. Conda doesn't respect pyproject.toml at all. And to generate the docs, building and installing with (build) and pip seems to work.

This mixed setup leads to a lot of duplication of dependency specification; environment.yml, pyproject.toml, workflow yamls.

@suvayu
Copy link
Collaborator Author

suvayu commented Aug 11, 2024

cvasl.vendor.rst:document isn't included in any toctree

@drcandacemakedamoore do you want to generate the docs for the vendored libraries as well? I'm inclined towards yes, since they are not really maintained upstream.

@suvayu
Copy link
Collaborator Author

suvayu commented Aug 11, 2024

Warning, treated as error:
/home/runner/work/cvasl/cvasl/cvasl/vendor/comscan/clustering.py:docstring of sklearn.utils._metadata_requests.RequestMethod.get..func:3:undefined label: 'metadata_routing' [ref.ref]

Ok docs build except for this really odd error. I could only find one import from sklearn.utils:
https://github.com/brainspinner/cvasl/blob/24e44e70373de04f341353c74b0c3a874c175080/cvasl/vendor/comscan/neurocombat.py#L27

and it is not even referenced in any docstring (I was expecting something like :ref:<imported-name>).

@egpbos
Copy link
Collaborator

egpbos commented Aug 30, 2024

Can you ignore imports (or just that one) in the docs config?

Copy link
Collaborator

@drcandacemakedamoore drcandacemakedamoore left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the pyproject toml you set Python to 3.10, but then in github actions you use 3.11, I don't think 3.10 will work, but I will try to run some checks later

Copy link
Collaborator

@drcandacemakedamoore drcandacemakedamoore left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also this then has no conda build, and this needs discussion with tech lead @egpbos

@brainspinner
Copy link
Collaborator

In the pyproject toml you set Python to 3.10, but then in github actions you use 3.11, I don't think 3.10 will work, but I will try to run some checks later

Never mind about this....

pytest==8.1 was yanked because of wide incompatibilities.  Since then
there has been multiple new releases, and the '<8.1' restriction is
not required.
TODO: not tested extensively
Copy link
Collaborator

@egpbos egpbos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR looks good to merge to me. It's possible that some former functionality will no longer work, but it's hard to tell. A coordinated moment to merge and deal with possible breakages immediately and to determine follow-up action points (for instance, for adding a CI test for conda building and installing) is advised.

@drcandacemakedamoore
Copy link
Collaborator

drcandacemakedamoore commented Oct 7, 2024

The base tests are passing. There are a few junk notebooks like (cvasl\vendor\ComBat++\Untitled.ipynb) that can come off on a subsequent commit. However, the main issue is that you deleted setup.py, and this will make the on-tag workflow fail. There are also some issues if conda-build will be supported. I can therefore not merge this without a bit more investigation.

…nding is the issue of passing the site parameters in autocombat. runharmonize is updated. data classes now accept several csv files to accomodate topmri
…ealized that the autocombat implementation which was refactored from the notebooks into the current structure actually runs the Combat class of comscan, not AutoCombat. For AutoCombat, we need to not provide the site designations for the datasets and let the algorithm run its own clustering method. Thus, in this commit I have renamed the AutoCombat into ComScanNeuroCombat for backward compatibility. The class AutoCombat will be implemented separately using the AutoCombat class of comscan
…Ive not given used access to the <site> parameter, as to not bypass autocombat and run neurocombat by mistake
…ackages will be installed automatically. The original RELIEF R package threw an error related to svd. The problem was they were scaling the input matrix and in some cases it would result in NaN, which subsequently lead to svd failing. A common solution to this problem is to replace the NaN values with zero. To achieve this, I've modified the RELIEF.R file from the original package and now we're using CVASK_RELIEF.R. In this one I've modified the softsvd function and copied the function estim_sigma originally belonging denoiseR so I can modify it. All this is handled in the code. For now I'm assuming the driver runharmonize.py is run from the same folder as mriharmonize.py. I'll handle the file location dependency after I'm done with the harmonizations and ml, alongside docstrings, optimization of the code, etc.
…y. current version can be improved, especially at the end, but I'll push this for now in the interest of handing over the code faster for the paper
…o the driver. added summary statistics calculation funcrtion to the base data class.
… with make_topper function, now fixed. also check all the available methods for this problem
…en for the same column each dataset contains only one value as in sex is only male in dataset A and only female in dataset B. Previously, both would be mapped to zero because each was mapped separately. Now we are using the encode_cat_features function. Driver is updated to reflect the changes
…nctions that are not directly called by user. fixed the reverse mapping function. updated the driver with the proper parameters
…t which lead to an error every time we provided discrete_cluster_features
…eadout results in a singular matrix which crashes the harmonization process
…eadout results in a singular matrix which crashes the harmonization process
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants