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

19 pkg resources deprecation warning #165

Draft
wants to merge 11 commits into
base: dev
Choose a base branch
from

Conversation

r-leyshon
Copy link
Contributor

@r-leyshon r-leyshon commented Oct 5, 2023

Description

Following our discussion about upgrading to python 3.11.x with a stripped back requirements.txt today, I went ahead and decided to implement things. A few things to note here:

  • A new explicit dependency as suggested by pipdeptools is munkres which seems to be a python internal for resource partition.
  • install -e . removed from reqs
  • Python needs major minor patch to match in pyproject.toml, environment.yml & installs in CI runners
  • Local install (not in editable mode) of transport-performance added to all runners
  • This approach would tolerate pkg_resource deprecation warnings
  • A deprecation warning originating from kaleido is introduced

Fixes None

Motivation and Context

Reference for deprecation and future warnings associated with upgrading to python 3.11.6

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Housekeeping

How Has This Been Tested?

Test configuration details:

  • OS: macos
  • Python version: 3.11.6
  • Java version: NA
  • Python management system: pip

Advice for reviewer

Warnings introduced on pytest are as follows, some of which originate in our source code:

================================================================ warnings summary =================================================================
../../../../opt/anaconda3/envs/transport-performance/lib/python3.11/site-packages/pycountry/__init__.py:10
  /opt/anaconda3/envs/transport-performance/lib/python3.11/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

../../../../opt/anaconda3/envs/transport-performance/lib/python3.11/site-packages/pkg_resources/__init__.py:2871
  /opt/anaconda3/envs/transport-performance/lib/python3.11/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/gtfs/test_validation.py::TestGtfsInstance::test__plot_summary_on_pass
  /opt/anaconda3/envs/transport-performance/lib/python3.11/site-packages/kaleido/scopes/base.py:188: DeprecationWarning:
  
  setDaemon() is deprecated, set the daemon attribute instead

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html

...

tests/gtfs/test_validation.py::TestGtfsInstance::test__plot_summary_on_pass
  /opt/anaconda3/envs/foobar-tp/lib/python3.11/site-packages/kaleido/scopes/base.py:188: DeprecationWarning:
  
  setDaemon() is deprecated, set the daemon attribute instead

tests/urban_centres/test_urban_centres.py::test_final_output
  /Users/richardleyshon/Documents/transport-network-performance/tests/urban_centres/test_urban_centres.py:554: FutureWarning:
  
  Series.__getitem__ treating keys as positions is deprecated. In a future version, integer keys will always be treated as labels (consistent with DataFrame behavior). To access a value by position, use `ser.iloc[pos]`

tests/urban_centres/test_urban_centres.py::test_final_output
  /Users/richardleyshon/Documents/transport-network-performance/tests/urban_centres/test_urban_centres.py:564: FutureWarning:
  
  Series.__getitem__ treating keys as positions is deprecated. In a future version, integer keys will always be treated as labels (consistent with DataFrame behavior). To access a value by position, use `ser.iloc[pos]`

Checklist:

  • My code follows the intended structure of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings See point above
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

Additional comments

@r-leyshon r-leyshon linked an issue Oct 5, 2023 that may be closed by this pull request
@r-leyshon r-leyshon added the discussion Further agreement is necessary label Oct 5, 2023
@codecov-commenter
Copy link

codecov-commenter commented Oct 5, 2023

Codecov Report

All modified lines are covered by tests ✅

Comparison is base (d230227) 96.80% compared to head (b0d6c61) 0.00%.

Additional details and impacted files
@@            Coverage Diff             @@
##              dev    #165       +/-   ##
==========================================
- Coverage   96.80%   0.00%   -96.80%     
==========================================
  Files          11       8        -3     
  Lines        1000     792      -208     
==========================================
- Hits          968       0      -968     
- Misses         32     792      +760     
Flag Coverage Δ
unittests 0.00% <ø> (-96.80%) ⬇️

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

Files Coverage Δ
src/transport_performance/gtfs/routes.py 0.00% <ø> (-95.17%) ⬇️

... and 10 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@r-leyshon r-leyshon marked this pull request as draft October 5, 2023 12:26
@r-leyshon r-leyshon added this to the sprint 4 End milestone Oct 9, 2023
@r-leyshon r-leyshon removed this from the sprint 4 End milestone Nov 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discussion Further agreement is necessary
Projects
None yet
Development

Successfully merging this pull request may close these issues.

pkg_resources deprecation warning
2 participants