Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion src/python_inspector/utils_pypi.py
Original file line number Diff line number Diff line change
Expand Up @@ -1694,7 +1694,14 @@ async def get(
cached = os.path.join(self.directory, cache_key)
lock_file = f"{cached}.lockfile"

if force or not os.path.exists(cached):
cache_valid = os.path.exists(cached) and os.path.getsize(cached) > 0

if force or not cache_valid:
if not cache_valid and os.path.exists(cached):
if TRACE_DEEP:
print(f" FILE CACHE INVALID (empty file): {path_or_url}")
os.remove(cached)

if TRACE_DEEP:
print(f" FILE CACHE MISS: {path_or_url}")
content = await get_file_content(
Expand Down
18 changes: 9 additions & 9 deletions tests/data/azure-devops.req-310-expected.json

Large diffs are not rendered by default.

18 changes: 9 additions & 9 deletions tests/data/azure-devops.req-312-expected.json

Large diffs are not rendered by default.

18 changes: 9 additions & 9 deletions tests/data/azure-devops.req-313-expected.json

Large diffs are not rendered by default.

20 changes: 10 additions & 10 deletions tests/data/test-api-with-requirement-file.json
Original file line number Diff line number Diff line change
Expand Up @@ -3727,12 +3727,12 @@
"type": "pypi",
"namespace": null,
"name": "pip",
"version": "25.2",
"version": "25.3",
"qualifiers": {},
"subpath": null,
"primary_language": "Python",
"description": "The PyPA recommended tool for installing Python packages.\npip - The Python Package Installer\n==================================\n\n.. |pypi-version| image:: https://img.shields.io/pypi/v/pip.svg\n :target: https://pypi.org/project/pip/\n :alt: PyPI\n\n.. |python-versions| image:: https://img.shields.io/pypi/pyversions/pip\n :target: https://pypi.org/project/pip\n :alt: PyPI - Python Version\n\n.. |docs-badge| image:: https://readthedocs.org/projects/pip/badge/?version=latest\n :target: https://pip.pypa.io/en/latest\n :alt: Documentation\n\n|pypi-version| |python-versions| |docs-badge|\n\npip is the `package installer`_ for Python. You can use pip to install packages from the `Python Package Index`_ and other indexes.\n\nPlease take a look at our documentation for how to install and use pip:\n\n* `Installation`_\n* `Usage`_\n\nWe release updates regularly, with a new version every 3 months. Find more details in our documentation:\n\n* `Release notes`_\n* `Release process`_\n\nIf you find bugs, need help, or want to talk to the developers, please use our mailing lists or chat rooms:\n\n* `Issue tracking`_\n* `Discourse channel`_\n* `User IRC`_\n\nIf you want to get involved head over to GitHub to get the source code, look at our development documentation and feel free to jump on the developer mailing lists and chat rooms:\n\n* `GitHub page`_\n* `Development documentation`_\n* `Development IRC`_\n\nCode of Conduct\n---------------\n\nEveryone interacting in the pip project's codebases, issue trackers, chat\nrooms, and mailing lists is expected to follow the `PSF Code of Conduct`_.\n\n.. _package installer: https://packaging.python.org/guides/tool-recommendations/\n.. _Python Package Index: https://pypi.org\n.. _Installation: https://pip.pypa.io/en/stable/installation/\n.. _Usage: https://pip.pypa.io/en/stable/\n.. _Release notes: https://pip.pypa.io/en/stable/news.html\n.. _Release process: https://pip.pypa.io/en/latest/development/release-process/\n.. _GitHub page: https://github.com/pypa/pip\n.. _Development documentation: https://pip.pypa.io/en/latest/development\n.. _Issue tracking: https://github.com/pypa/pip/issues\n.. _Discourse channel: https://discuss.python.org/c/packaging\n.. _User IRC: https://kiwiirc.com/nextclient/#ircs://irc.libera.chat:+6697/pypa\n.. _Development IRC: https://kiwiirc.com/nextclient/#ircs://irc.libera.chat:+6697/pypa-dev\n.. _PSF Code of Conduct: https://github.com/pypa/.github/blob/main/CODE_OF_CONDUCT.md",
"release_date": "2025-07-30T21:50:13",
"release_date": "2025-10-25T00:55:39",
"parties": [
{
"type": "person",
Expand All @@ -3759,11 +3759,11 @@
"Topic :: Software Development :: Build Tools"
],
"homepage_url": null,
"download_url": "https://files.pythonhosted.org/packages/b7/3f/945ef7ab14dc4f9d7f40288d2df998d1837ee0888ec3659c813487572faa/pip-25.2-py3-none-any.whl",
"size": 1752557,
"download_url": "https://files.pythonhosted.org/packages/44/3c/d717024885424591d5376220b5e836c2d5293ce2011523c9de23ff7bf068/pip-25.3-py3-none-any.whl",
"size": 1778622,
"sha1": null,
"md5": "52af72c263169cc46cc32bed310a5eab",
"sha256": "6d67a2b4e7f14d8b31b8b52648866fa717f45a1eb70e83002f4331d07e953717",
"md5": "4bbbf9f0745c4117c8ecc77c561ef74b",
"sha256": "9655943313a94722b7774661c21049070f6bbb0a1516bf02f7c8d5d9201514cd",
"sha512": null,
"bug_tracking_url": null,
"code_view_url": "https://github.com/pypa/pip",
Expand All @@ -3778,9 +3778,9 @@
"dependencies": [],
"repository_homepage_url": null,
"repository_download_url": null,
"api_data_url": "https://pypi.org/pypi/pip/25.2/json",
"api_data_url": "https://pypi.org/pypi/pip/25.3/json",
"datasource_id": null,
"purl": "pkg:pypi/pip@25.2"
"purl": "pkg:pypi/pip@25.3"
},
{
"type": "pypi",
Expand Down Expand Up @@ -6158,13 +6158,13 @@
]
},
{
"package": "pkg:pypi/pip@25.2",
"package": "pkg:pypi/pip@25.3",
"dependencies": []
},
{
"package": "pkg:pypi/pipdeptree@2.2.1",
"dependencies": [
"pkg:pypi/pip@25.2"
"pkg:pypi/pip@25.3"
]
},
{
Expand Down