OpenAdaptAI / OpenAdapt

Open Source Generative Process Automation (i.e. Generative RPA). AI-First Process Automation with Large ([Language (LLMs) / Action (LAMs) / Multimodal (LMMs)] / Visual Language (VLMs)) Models
https://www.OpenAdapt.AI
MIT License
969 stars 133 forks source link

Fix pytest warnings #322

Closed abrichr closed 1 year ago

abrichr commented 1 year ago

Feature request

@0dm to paste

Motivation

No response

0dm commented 1 year ago

sample

openadapt on  feature/record_pb [$!] is 📦 v0.1.0 via 🐍 v3.10.12 (openadapt-py3.10) took 31s 
λ pytest
============================================================== test session starts ===============================================================
platform darwin -- Python 3.10.12, pytest-7.1.3, pluggy-1.2.0
rootdir: /Users/aaron/Documents/GitHub/OpenAdapt
plugins: anyio-3.7.0
collected 25 items                                                                                                                               

tests/openadapt/test_crop.py .                                                                                                             [  4%]
tests/openadapt/test_events.py .......                                                                                                     [ 32%]
tests/openadapt/test_scrub.py ...............                                                                                              [ 92%]
tests/openadapt/test_summary.py ..                                                                                                         [100%]

================================================================ warnings summary ================================================================
../../../Library/Caches/pypoetry/virtualenvs/openadapt-OrpD_qgG-py3.10/lib/python3.10/site-packages/accelerate/utils/torch_xla.py:18
  /Users/aaron/Library/Caches/pypoetry/virtualenvs/openadapt-OrpD_qgG-py3.10/lib/python3.10/site-packages/accelerate/utils/torch_xla.py:18: DeprecationWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html
    import pkg_resources

../../../Library/Caches/pypoetry/virtualenvs/openadapt-OrpD_qgG-py3.10/lib/python3.10/site-packages/pkg_resources/__init__.py:2871
  /Users/aaron/Library/Caches/pypoetry/virtualenvs/openadapt-OrpD_qgG-py3.10/lib/python3.10/site-packages/pkg_resources/__init__.py:2871: DeprecationWarning: Deprecated call to `pkg_resources.declare_namespace('mpl_toolkits')`.
  Implementing implicit namespace packages (as specified in PEP 420) is preferred to `pkg_resources.declare_namespace`. See https://setuptools.pypa.io/en/latest/references/keywords.html#keyword-namespace-packages
    declare_namespace(pkg)

../../../Library/Caches/pypoetry/virtualenvs/openadapt-OrpD_qgG-py3.10/lib/python3.10/site-packages/pkg_resources/__init__.py:2871
../../../Library/Caches/pypoetry/virtualenvs/openadapt-OrpD_qgG-py3.10/lib/python3.10/site-packages/pkg_resources/__init__.py:2871
../../../Library/Caches/pypoetry/virtualenvs/openadapt-OrpD_qgG-py3.10/lib/python3.10/site-packages/pkg_resources/__init__.py:2871
../../../Library/Caches/pypoetry/virtualenvs/openadapt-OrpD_qgG-py3.10/lib/python3.10/site-packages/pkg_resources/__init__.py:2871
  /Users/aaron/Library/Caches/pypoetry/virtualenvs/openadapt-OrpD_qgG-py3.10/lib/python3.10/site-packages/pkg_resources/__init__.py:2871: DeprecationWarning: Deprecated call to `pkg_resources.declare_namespace('sphinxcontrib')`.
  Implementing implicit namespace packages (as specified in PEP 420) is preferred to `pkg_resources.declare_namespace`. See https://setuptools.pypa.io/en/latest/references/keywords.html#keyword-namespace-packages
    declare_namespace(pkg)

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
========================================================= 25 passed, 6 warnings in 8.56s =========================================================
FFFiend commented 1 year ago

https://github.com/matplotlib/matplotlib/issues/25244 https://github.com/pypa/setuptools/issues/1111 Relevant discussions, setuptools seems to be the culprit.

KrishPatel13 commented 1 year ago

Feel free to remove the following 2 lines of code (1: https://github.com/MLDSAI/OpenAdapt/blob/main/tests/openadapt/test_scrub.py#L5C11-L5C11, 2: https://github.com/MLDSAI/OpenAdapt/blob/main/tests/openadapt/test_scrub.py#L29C2-L29C2) from test_scrub.py, and that will give you 8 Warning now:

(openadapt-py3.10) PS P:\OpenAdapt AI - MLDS AI\cloned_repo\OpenAdapt> pytest
========================================================================================== test session starts ===========================================================================================        
platform win32 -- Python 3.10.11, pytest-7.1.3, pluggy-1.2.0
rootdir: P:\OpenAdapt AI - MLDS AI\cloned_repo\OpenAdapt
plugins: anyio-3.7.0
collected 25 items                                                                                                                                                                                                

tests\openadapt\test_crop.py .                                                                                                                                                                             [  4%]
tests\openadapt\test_events.py .......                                                                                                                                                                     [ 32%]
tests\openadapt\test_scrub.py ...............                                                                                                                                                              [ 92%]
tests\openadapt\test_summary.py ..                                                                                                                                                                         [100%]

=============================================================================================== warnings summary ================================================================================================
C:\Users\Krish Patel\AppData\Local\pypoetry\Cache\virtualenvs\openadapt-NIwuSzHt-py3.10\lib\site-packages\pycountry\__init__.py:10
  C:\Users\Krish Patel\AppData\Local\pypoetry\Cache\virtualenvs\openadapt-NIwuSzHt-py3.10\lib\site-packages\pycountry\__init__.py:10: DeprecationWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html
    import pkg_resources

C:\Users\Krish Patel\AppData\Local\pypoetry\Cache\virtualenvs\openadapt-NIwuSzHt-py3.10\lib\site-packages\pkg_resources\__init__.py:2871
  C:\Users\Krish Patel\AppData\Local\pypoetry\Cache\virtualenvs\openadapt-NIwuSzHt-py3.10\lib\site-packages\pkg_resources\__init__.py:2871: DeprecationWarning: Deprecated call to `pkg_resources.declare_namespace('mpl_toolkits')`.
  Implementing implicit namespace packages (as specified in PEP 420) is preferred to `pkg_resources.declare_namespace`. See https://setuptools.pypa.io/en/latest/references/keywords.html#keyword-namespace-packages
    declare_namespace(pkg)

C:\Users\Krish Patel\AppData\Local\pypoetry\Cache\virtualenvs\openadapt-NIwuSzHt-py3.10\lib\site-packages\pkg_resources\__init__.py:2871
C:\Users\Krish Patel\AppData\Local\pypoetry\Cache\virtualenvs\openadapt-NIwuSzHt-py3.10\lib\site-packages\pkg_resources\__init__.py:2871
C:\Users\Krish Patel\AppData\Local\pypoetry\Cache\virtualenvs\openadapt-NIwuSzHt-py3.10\lib\site-packages\pkg_resources\__init__.py:2871
C:\Users\Krish Patel\AppData\Local\pypoetry\Cache\virtualenvs\openadapt-NIwuSzHt-py3.10\lib\site-packages\pkg_resources\__init__.py:2871
  C:\Users\Krish Patel\AppData\Local\pypoetry\Cache\virtualenvs\openadapt-NIwuSzHt-py3.10\lib\site-packages\pkg_resources\__init__.py:2871: DeprecationWarning: Deprecated call to `pkg_resources.declare_namespace('sphinxcontrib')`.
  Implementing implicit namespace packages (as specified in PEP 420) is preferred to `pkg_resources.declare_namespace`. See https://setuptools.pypa.io/en/latest/references/keywords.html#keyword-namespace-packages
    declare_namespace(pkg)

tests/openadapt/test_scrub.py::test_scrub_image
  C:\Users\Krish Patel\AppData\Local\pypoetry\Cache\virtualenvs\openadapt-NIwuSzHt-py3.10\lib\site-packages\pytesseract\pytesseract.py:382: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
    return LooseVersion(

tests/openadapt/test_scrub.py::test_scrub_image
  C:\Users\Krish Patel\AppData\Local\pypoetry\Cache\virtualenvs\openadapt-NIwuSzHt-py3.10\lib\site-packages\setuptools\_distutils\version.py:345: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
    other = LooseVersion(other)

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
======================================================================================== 25 passed, 8 warnings in 18.53s ======================================================================================== 
(openadapt-py3.10) PS P:\OpenAdapt AI - MLDS AI\cloned_repo\OpenAdapt> |
ayewo commented 1 year ago

Thanks for your inputs @FFFiend and @KrishPatel13 🙏! Based on your links, there are two ways to fix the issue in pyproject.toml: