Skip to content

Remove PyFilesystem2 dependency @W-21244194#3923

Merged
jstvz merged 2 commits intomainfrom
remove-fs-module
Feb 19, 2026
Merged

Remove PyFilesystem2 dependency @W-21244194#3923
jstvz merged 2 commits intomainfrom
remove-fs-module

Conversation

@jstvz
Copy link
Copy Markdown
Contributor

@jstvz jstvz commented Sep 4, 2025

This PR removes PyFilesystem2. Importing fs emits a pkg_resources deprecation warning (see
pyfilesystem2#597). There are also open questions about the project’s maintenance status (see
pyfilesystem2#571). As far as I can tell, CumulusCI only relied on a small, local subset of functionality. That subset maps cleanly to Python’s standard library.

This PR introduces a local-only FSResource and open_fs_resource implemented with pathlib, os, and shutil. file:// URLs are supported for absolute and relative paths, and non-file schemes are rejected. All fs imports were removed and tests updated to expect FileExistsError instead of fs.errors.DirectoryExists.

@jstvz jstvz marked this pull request as ready for review October 7, 2025 20:15
@jstvz jstvz requested a review from a team as a code owner October 7, 2025 20:15
@robertbwatson
Copy link
Copy Markdown

@jstvz will this fix #3907?

@davisagli
Copy link
Copy Markdown
Contributor

@robertbwatson This doesn't look related to the pkg_resources namespace package that is the problem in #3907

@BrandonEnclude
Copy link
Copy Markdown

@robertbwatson This doesn't look related to the pkg_resources namespace package that is the problem in #3907

Are you sure? The dependency using pkg_resources is PyFileSystem2, so removing that dependency will solve the issue, won't it?

Here's my stack trace:

C:\Users\Me>cci version
Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "c:\users\Me\.local\bin\cci.exe\__main__.py", line 2, in <module>
    from cumulusci.cli.cci import main
  File "C:\Users\Me\pipx\venvs\cumulusci\Lib\site-packages\cumulusci\cli\cci.py", line 21, in <module>
    from .error import error
  File "C:\Users\Me\pipx\venvs\cumulusci\Lib\site-packages\cumulusci\cli\error.py", line 11, in <module>
    from cumulusci.cli.utils import warn_if_no_long_paths, win32_long_paths_enabled
  File "C:\Users\Me\pipx\venvs\cumulusci\Lib\site-packages\cumulusci\cli\utils.py", line 14, in <module>
    from cumulusci.core.config import UniversalConfig
  File "C:\Users\Me\pipx\venvs\cumulusci\Lib\site-packages\cumulusci\core\config\__init__.py", line 8, in <module>
    from cumulusci.core.utils import import_global
  File "C:\Users\Me\pipx\venvs\cumulusci\Lib\site-packages\cumulusci\core\utils.py", line 21, in <module>
    from cumulusci.utils.options import parse_list_of_pairs_dict_arg
  File "C:\Users\Me\pipx\venvs\cumulusci\Lib\site-packages\cumulusci\utils\options.py", line 8, in <module>
    from cumulusci.utils.yaml.model_parser import CCIDictModel
  File "C:\Users\Me\pipx\venvs\cumulusci\Lib\site-packages\cumulusci\utils\yaml\model_parser.py", line 7, in <module>
    from cumulusci.utils.yaml.safer_loader import load_from_source, load_yaml_data
  File "C:\Users\Me\pipx\venvs\cumulusci\Lib\site-packages\cumulusci\utils\yaml\safer_loader.py", line 11, in <module>
    from cumulusci.utils.fileutils import FSResource, load_from_source
  File "C:\Users\Me\pipx\venvs\cumulusci\Lib\site-packages\cumulusci\utils\fileutils.py", line 10, in <module>
    from fs import base, copy, open_fs
  File "C:\Users\Me\pipx\venvs\cumulusci\Lib\site-packages\fs\__init__.py", line 4, in <module>
    __import__("pkg_resources").declare_namespace(__name__)  # type: ignore
    ~~~~~~~~~~^^^^^^^^^^^^^^^^^
ModuleNotFoundError: No module named 'pkg_resources'

The crash happens in site-packages\fs which is PyFileSystem2, isn't it?

@davisagli
Copy link
Copy Markdown
Contributor

@BrandonEnclude Oh, I see. I was remembering that cumulusci.tasks was also a pkg_resources namespace package, but it looks like that was updated several years ago. So this could help, as long as there are not other dependency packages with the same problem.

This commit removes `PyFilesystem2`. Importing `fs` emits a
`pkg_resources` deprecation warning (see
[pyfilesystem2#597](PyFilesystem/pyfilesystem2#597)).
There are also open questions about the project’s maintenance status
(see
[pyfilesystem2#571](PyFilesystem/pyfilesystem2#571)).
As far as I can tell, CumulusCI only relied on a small, local subset of functionality. That
subset maps cleanly to Python’s standard library.

This commit introduces a local-only `FSResource` and `open_fs_resource`
implemented with `pathlib`, `os`, and `shutil`. `file://` URLs are
supported for absolute and relative paths, and non-file schemes are
rejected. All `fs` imports were removed and tests updated to expect
`FileExistsError` instead of `fs.errors.DirectoryExists`.
@jstvz jstvz removed the request for review from arvindbhamidipati February 11, 2026 21:55
@jstvz jstvz changed the title Remove PyFilesystem2 dependency Remove PyFilesystem2 dependency @W-21244194 Feb 11, 2026
@yippie
Copy link
Copy Markdown
Contributor

yippie commented Feb 17, 2026

This needs to get merged like, last week.

@jstvz
Copy link
Copy Markdown
Contributor Author

jstvz commented Feb 17, 2026

@vsbharath You still have write access to this repo. Can you review this PR?

@jstvz jstvz merged commit 000d441 into main Feb 19, 2026
23 of 26 checks passed
@jstvz jstvz deleted the remove-fs-module branch February 19, 2026 22:02
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.

6 participants