-
Notifications
You must be signed in to change notification settings - Fork 507
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
Clean makefile, pyproject.toml and CI #229
Conversation
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
"""Check that all tests are called in CI.""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note: another way to be sure of that would simply be to run pytest tests
in the CI instead of calling each one individually. It doesn't look as good in the github report though
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another advantage of running pytest tests
altogether is that if test B fails, then test C will still be triggered. It's not the case when calling tests iteratively.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I also agree: why not just calling pytest tests
?
Thanks a lot @Wauplin for this great work! 😃 Regarding 1.ii: sqlalchemy is used in this example: so it should at least be in the tests. Regarding your points 5.ii and 6, I've set On all your other points, I agree, and it will be a great addition! You said you still planned to do more the dependency groups in point 1, right? So maybe let's wait for that before merging. |
I think it's best to merge this PR (once sqlalchemy is added back + removed the slow test) and open another one for the other dependency groups -typically making gradio optional-. This PR is already big enough and is more focused on cleaning/removing code. I'll address your comments tomorrow! |
@aymeric-roucher PR is ready for review! I've added back And I've also added conditions in the test CI so that all tests are run even if one step has failed. See example here: https://github.com/huggingface/smolagents/actions/runs/12826181114/job/35765597633?pr=229. I do believe that this worflow file could be factorized a bit but out of scope of this PR I believe :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Really good improvements. Thanks.
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
"""Check that all tests are called in CI.""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I also agree: why not just calling pytest tests
?
audio = [ | ||
"soundfile", | ||
] | ||
torch = [ | ||
"torch", | ||
"torchaudio", | ||
"torchvision", | ||
"sqlalchemy", | ||
"accelerate", | ||
"soundfile", | ||
] | ||
litellm = [ | ||
"litellm>=1.55.10", | ||
] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe worth mentioning the new extras (audio, torch, litellm) in the README?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd rather do that in a follow-up PR. At the moment dev
and test
extras are not documented either. I think it's best to settle these groups (including the openai one from #236) and then open a PR only for the documentation part. About docs, I think it'd be beneficial to write a proper Installation page with all options similar to https://huggingface.co/docs/huggingface_hub/installation (also documenting editable install + install from source). And in the README, mention only the main ones + link to the docs. Otherwise the README could become a bit bloated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Associated issue:
Hey there, I've taken a look at the repo structure and made a few changes to the repo settings. I do think these changes are important for a fresh start. I've listed below all the changes I've made. I'm happy to revisit if some of them are not relevant for this repo.
pyproject.toml
:pip install smolagents[litellm]
instead ofpip install litellm
so that we control which version should be installed. In the case here it's>=1.55.10"
. I haven't really completed this part, only started the process to have different groups for different purposes.sqlalchemy
,torchaudio
andtorchvision
. For what I can see with a ctrl+F on the repo, these dependencies are never used in the codebase. I'll still check if the tests pass in the CI. If it turns out we need them (as a dependency in transformers for instance) then I'll add them back.-sv
as before and added--durations=0
. By experience, tracking durations in CI proved useful in huggingface_hub and doesn't add any complexity.module-import-not-at-top-of-file (E402)
error is ignored in theexamples/
folder. Not having all imports at the start of the files make sense in examples.Makefile
:examples src tests utils
as the folders to run code formatters on. Previously it was"."
which means that it would fail if a user has a non-committed local script that they use for testing.extra_quality_checks
command (doesn't seem to refer to any known script)doc-builder style
checks (doesn't seem to have any impact + wasn't checked in CI)test_big_modeling
,test_core
,test_cli
,test_examples
,test_prod
,test_rest
=> these seems to be legacy test (from transformers?). I only kept a basicmake test
that runs the tests. Not the most useful except if some contributors are used to it.README.md
: added some basic commands in the "contributing" section to install deps + run linter/formatter.github/workflows/quality.yml
, I made sure to run exactly the same commands as inmake quality
.github/workflows/tests.yml
:-sv
args from the pytest command since it's not configured in pyproject.tomluv run pytest ./tests/test_all_docs.py
(didn't know if it was missing on purpose). EDIT: test seems to fail 😕utils/check_tests_in_ci.py
that checks all test file under./tests
are accurately called in the CI. This is to prevent forgetting about it when adding a test file in the future. This script is automatically run onmake quality
and in thequality.yml
CI.I think that's mostly it. Other changes comes from the linter. Almost nothing has changed in term of logic / dependencies, just a cleaning of some parts. I hope not to be overstepping here, just want give a hand 🤗