Skip to content

Commit

Permalink
Use singleton package manager for global API (#141)
Browse files Browse the repository at this point in the history
* Use singleton package manager for global apis

* import name

* Fix test

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Fix type

* Fix another test

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Fix parameter order

* Rename

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
ryanking13 and pre-commit-ci[bot] authored Nov 1, 2024
1 parent f03b08c commit d4847f6
Show file tree
Hide file tree
Showing 14 changed files with 220 additions and 308 deletions.
23 changes: 14 additions & 9 deletions micropip/__init__.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,24 @@
from ._commands.freeze import freeze
from ._commands.index_urls import set_index_urls
from ._commands.install import install
from ._commands.list import _list as list
from ._commands.mock_package import (
add_mock_package,
list_mock_packages,
remove_mock_package,
)
from ._commands.uninstall import uninstall
from .package_manager import PackageManager

try:
from ._version import __version__
except ImportError:
pass

_package_manager_singleton = PackageManager()

install = _package_manager_singleton.install
set_index_urls = _package_manager_singleton.set_index_urls
list = _package_manager_singleton.list
freeze = _package_manager_singleton.freeze
add_mock_package = _package_manager_singleton.add_mock_package
list_mock_packages = _package_manager_singleton.list_mock_packages
remove_mock_package = _package_manager_singleton.remove_mock_package

# TODO: port uninstall
# uninstall = _package_manager_singleton.uninstall

__all__ = [
"install",
"list",
Expand Down
7 changes: 0 additions & 7 deletions micropip/_commands/freeze.py

This file was deleted.

27 changes: 0 additions & 27 deletions micropip/_commands/index_urls.py

This file was deleted.

21 changes: 0 additions & 21 deletions micropip/_commands/install.py

This file was deleted.

7 changes: 0 additions & 7 deletions micropip/_commands/list.py

This file was deleted.

191 changes: 0 additions & 191 deletions micropip/_commands/mock_package.py

This file was deleted.

Loading

0 comments on commit d4847f6

Please sign in to comment.