fsspec / fsspec/filesystem_spec

Simplify AbstractFileSystem.__init__

Open
#178 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
1.4k
Forks
490
Avg merge
2d 3h
Merged PRs (30d)
38

Description

I'd like to simplify AbstractFileSystem.__init__ in a few ways.

  1. Remove dynamically modifed docstrings

See https://github.com/intake/filesystem_spec/pull/177.

  1. Remove dynamically added methods.

Right now we dynamically add methods for the aliases. I think we should either move those to an AliasMixin class, or just make them part of the interface. Is there anybody using add_aliases=False?

  1. Rework _transaction and transaction.
  2. Remove the _singleton list
  3. (maybe) Switch to using a metaclass for caching instances of AbstractFileSystem. Right now, the classes __init__ method is always run, even if we're returning the cached version. I need to investigate this further.

Items 2, 3, and 4 create circular references to instances of AbstractFileSystem, so that they're never actually deleted unless the cache is manually emptied.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading AbstractFileSystem.init and the linked pull request 177, then trace the alias methods, transaction handling, singleton list, and instance caching described in the issue. The work is done when the proposed initialization and lifecycle simplifications are resolved without the reported circular references, with the relevant existing behavior preserved.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.