Skip to content

[BUG] Legacy Example DATA_PATH Fix#2088

Open
kushvinth wants to merge 2 commits intosktime:mainfrom
kushvinth:main
Open

[BUG] Legacy Example DATA_PATH Fix#2088
kushvinth wants to merge 2 commits intosktime:mainfrom
kushvinth:main

Conversation

@kushvinth
Copy link

Reference Issues/PRs

Fixes #1703

What does this implement/fix? Explain your changes.

The DATA_PATH in pytorch_forecasting/data/examples.py was set to Path(__file__).parent, which points to the package installation directory (e.g., site-packages). This caused issues when the library was installed via pip, as:

  1. The site-packages directory may not be writable
  2. Downloaded data files would be stored in an unexpected location

Fix:

  • Changed DATA_PATH to use ~/.pytorch-forecasting/data/ as the default location
  • Added support for PTF_DATA_DIR environment variable for user customization
  • Directory is auto-created if it doesn't exist

What should a reviewer concentrate their feedback on?

  • Is ~/.pytorch-forecasting/data/ an appropriate default location?
  • Should the environment variable be named differently?
  • Any platform-specific considerations (Windows/Linux/macOS)?

Did you add any tests for the change?

No tests added yet. The issue is difficult to test in CI since it manifests when the library is pip-installed vs run from source. A test could verify that _get_data_path() returns a writable directory.

Any other comments?

This fix ensures the library works correctly whether installed via pip or run from a cloned repository.

PR checklist

  • The PR title starts with either [ENH], [MNT], [DOC], or [BUG]. [BUG] - bugfix, [MNT] - CI, test framework, [ENH] - adding or improving code, [DOC] - writing or improving documentation or docstrings.
  • Added/modified tests
  • Used pre-commit hooks when committing to ensure that code is compliant with hooks. Install hooks with pre-commit install.
    To run hooks independent of commit, execute pre-commit run --all-files

@codecov
Copy link

codecov bot commented Feb 23, 2026

Codecov Report

❌ Patch coverage is 88.88889% with 1 line in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (main@c0598aa). Learn more about missing BASE report.

Files with missing lines Patch % Lines
pytorch_forecasting/data/examples.py 88.88% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2088   +/-   ##
=======================================
  Coverage        ?   86.63%           
=======================================
  Files           ?      165           
  Lines           ?     9740           
  Branches        ?        0           
=======================================
  Hits            ?     8438           
  Misses          ?     1302           
  Partials        ?        0           
Flag Coverage Δ
cpu 86.63% <88.88%> (?)
pytest 86.63% <88.88%> (?)

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

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@kushvinth
Copy link
Author

@benHeid @fkiraly @fnhirwa @jdb78 @phoeenniixx @PranavBhatP @yarnabrina

Hi all, I’ve addressed the feedback and updated the PR accordingly.
Could you please take a look and share your review when you have time? Thanks in advance!

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.

[BUG] Example.py has wrong DATA_PATH

1 participant