sbi icon indicating copy to clipboard operation
sbi copied to clipboard

Added Apache License reference comments to source files + CI bash script check

Open nMaax opened this issue 7 months ago • 4 comments

Several sbi source-code files were found missing the disclaimer of sbi's Apache Licence.

# This file is part of sbi, a toolkit for simulation-based inference. sbi is licensed
# under the Apache License Version 2.0, see <https://www.apache.org/licenses/>

This PR simply adds these two commented lines at the very start of all python files who were missing them, specifically all python files under tests/ and sbi/ directories.

I hope opening a PR directly rather than passing through an Issue was the right choice, as the modifications are trivial.

I also assume this was a desired feature: if there was a specific reason why these files did not report those two commented lines, I can close the PR without affecting the codebase.

I've also run a [fast, CPU-only] pytest locally to double-check everything is still working. No fails arised (except of expected fails XFAIL).

Edit: Furthermore, a bash script, which checks if effectively these two lines are reported as headers of all python files, was inserted in the CI workflow for GitHub. The script run just before setting up Python for pytests (took here as reference as advised by @michaeldeistler ).

nMaax avatar May 21 '25 15:05 nMaax

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Please upload report for BASE (main@196c106). Learn more about missing BASE report. Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1599   +/-   ##
=======================================
  Coverage        ?   82.27%           
=======================================
  Files           ?      134           
  Lines           ?    10756           
  Branches        ?        0           
=======================================
  Hits            ?     8849           
  Misses          ?     1907           
  Partials        ?        0           
Flag Coverage Δ
unittests 82.27% <ø> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
sbi/__init__.py 100.00% <ø> (ø)
sbi/analysis/__init__.py 100.00% <ø> (ø)
sbi/diagnostics/__init__.py 100.00% <ø> (ø)
sbi/diagnostics/tarp.py 81.81% <ø> (ø)
sbi/inference/__init__.py 100.00% <ø> (ø)
sbi/inference/abc/__init__.py 100.00% <ø> (ø)
sbi/inference/posteriors/__init__.py 100.00% <ø> (ø)
sbi/inference/potentials/__init__.py 100.00% <ø> (ø)
.../inference/potentials/posterior_based_potential.py 84.00% <ø> (ø)
sbi/inference/potentials/score_fn_iid.py 88.62% <ø> (ø)
... and 36 more

codecov[bot] avatar May 21 '25 15:05 codecov[bot]

Cool! We could also have a github workflow that checks this, as, for example, here.

michaeldeistler avatar May 21 '25 16:05 michaeldeistler

Cool! We could also have a github workflow that checks this, as, for example, here.

@nMaax would you be up for adding something like this to the sbi CI workflow, or create an issue for it?

janfb avatar May 23 '25 10:05 janfb

@janfb yep sure :+1:, will do it asap when I am able to open my laptop, so most probably this evening or tomorrow

nMaax avatar May 23 '25 12:05 nMaax

Hi @janfb sorry for responding so late, found just now tho the task was actually fast to solve. Hope it is ok now, let me know! :)

nMaax avatar Jul 17 '25 18:07 nMaax