diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 061f58d..7428885 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -23,7 +23,7 @@ jobs: cache: true - name: Install Dependencies run: | - pdm sync -dGtest + pdm sync - name: Run Tests run: | - pdm run pytest -v tests + pdm run test diff --git a/README.md b/README.md index 6a2e318..6c69a66 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # onepm -Picks the right package manager for you +Picks the right package manager for you. Don't make me think about which package manager to use when I clone a project from other people. OnePM will pick the right package manager by searching for the lock files and/or the project settings in `pyproject.toml`. diff --git a/packages/onepm-shims/.gitignore b/packages/onepm-shims/.gitignore new file mode 100644 index 0000000..3a8816c --- /dev/null +++ b/packages/onepm-shims/.gitignore @@ -0,0 +1,162 @@ +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +*$py.class + +# C extensions +*.so + +# Distribution / packaging +.Python +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +wheels/ +share/python-wheels/ +*.egg-info/ +.installed.cfg +*.egg +MANIFEST + +# PyInstaller +# Usually these files are written by a python script from a template +# before PyInstaller builds the exe, so as to inject date/other infos into it. +*.manifest +*.spec + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports +htmlcov/ +.tox/ +.nox/ +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*.cover +*.py,cover +.hypothesis/ +.pytest_cache/ +cover/ + +# Translations +*.mo +*.pot + +# Django stuff: +*.log +local_settings.py +db.sqlite3 +db.sqlite3-journal + +# Flask stuff: +instance/ +.webassets-cache + +# Scrapy stuff: +.scrapy + +# Sphinx documentation +docs/_build/ + +# PyBuilder +.pybuilder/ +target/ + +# Jupyter Notebook +.ipynb_checkpoints + +# IPython +profile_default/ +ipython_config.py + +# pyenv +# For a library or package, you might want to ignore these files since the code is +# intended to run in multiple environments; otherwise, check them in: +# .python-version + +# pipenv +# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. +# However, in case of collaboration, if having platform-specific dependencies or dependencies +# having no cross-platform support, pipenv may install dependencies that don't work, or not +# install all needed dependencies. +#Pipfile.lock + +# poetry +# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control. +# This is especially recommended for binary packages to ensure reproducibility, and is more +# commonly ignored for libraries. +# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control +#poetry.lock + +# pdm +# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control. +#pdm.lock +# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it +# in version control. +# https://pdm-project.org/#use-with-ide +.pdm.toml +.pdm-python +.pdm-build/ + +# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm +__pypackages__/ + +# Celery stuff +celerybeat-schedule +celerybeat.pid + +# SageMath parsed files +*.sage.py + +# Environments +.env +.venv +env/ +venv/ +ENV/ +env.bak/ +venv.bak/ + +# Spyder project settings +.spyderproject +.spyproject + +# Rope project settings +.ropeproject + +# mkdocs documentation +/site + +# mypy +.mypy_cache/ +.dmypy.json +dmypy.json + +# Pyre type checker +.pyre/ + +# pytype static type analyzer +.pytype/ + +# Cython debug symbols +cython_debug/ + +# PyCharm +# JetBrains specific template is maintained in a separate JetBrains.gitignore that can +# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore +# and can be added to the global gitignore or merged into this file. For a more nuclear +# option (not recommended) you can uncomment the following to ignore the entire idea folder. +#.idea/ diff --git a/packages/onepm-shims/LICENSE b/packages/onepm-shims/LICENSE new file mode 120000 index 0000000..30cff74 --- /dev/null +++ b/packages/onepm-shims/LICENSE @@ -0,0 +1 @@ +../../LICENSE \ No newline at end of file diff --git a/packages/onepm-shims/README.md b/packages/onepm-shims/README.md new file mode 120000 index 0000000..fe84005 --- /dev/null +++ b/packages/onepm-shims/README.md @@ -0,0 +1 @@ +../../README.md \ No newline at end of file diff --git a/packages/onepm-shims/pyproject.toml b/packages/onepm-shims/pyproject.toml new file mode 100644 index 0000000..50ffd60 --- /dev/null +++ b/packages/onepm-shims/pyproject.toml @@ -0,0 +1,39 @@ +[project] +name = "onepm-shims" +description = "The shims package for onepm" +authors = [ + {name = "Frost Ming", email = "mianghong@gmail.com"}, +] +requires-python = ">=3.10" +dependencies = ["unearth>=0.14.0"] +readme = "README.md" +license = {text = "MIT"} +dynamic = ["version"] +classifiers = [ + "Topic :: Software Development :: Build Tools", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3 :: Only", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", +] + +[project.urls] +Homepage = "https://github.com/frostming/onepm" +Repository = "https://github.com/frostming/onepm" +Changelog = "https://github.com/frostming/onepm/releases" + +[project.scripts] +pdm = "onepm_shims.shims:pdm" +pipenv = "onepm_shims.shims:pipenv" +poetry = "onepm_shims.shims:poetry" + +[build-system] +requires = ["pdm-backend"] +build-backend = "pdm.backend" + +[tool.pdm] +distribution = true + +[tool.pdm.version] +source = "scm" diff --git a/src/onepm/pm/__init__.py b/packages/onepm-shims/src/onepm_shims/__init__.py similarity index 100% rename from src/onepm/pm/__init__.py rename to packages/onepm-shims/src/onepm_shims/__init__.py diff --git a/packages/onepm-shims/src/onepm_shims/shims.py b/packages/onepm-shims/src/onepm_shims/shims.py new file mode 100644 index 0000000..62df67d --- /dev/null +++ b/packages/onepm-shims/src/onepm_shims/shims.py @@ -0,0 +1,19 @@ +from __future__ import annotations + +import sys +from functools import partial +from typing import NoReturn + +from onepm.core import OneManager + + +def shim(package_manager: str, args: list[str] | None = None) -> NoReturn: + if args is None: + args = sys.argv[1:] + pm = OneManager().get_package_manager(package_manager) + pm.execute(*args) + + +pdm = partial(shim, "pdm") +pipenv = partial(shim, "pipenv") +poetry = partial(shim, "poetry") diff --git a/packages/onepm/LICENSE b/packages/onepm/LICENSE new file mode 120000 index 0000000..30cff74 --- /dev/null +++ b/packages/onepm/LICENSE @@ -0,0 +1 @@ +../../LICENSE \ No newline at end of file diff --git a/packages/onepm/README.md b/packages/onepm/README.md new file mode 120000 index 0000000..fe84005 --- /dev/null +++ b/packages/onepm/README.md @@ -0,0 +1 @@ +../../README.md \ No newline at end of file diff --git a/packages/onepm/pyproject.toml b/packages/onepm/pyproject.toml new file mode 100644 index 0000000..b0af4ee --- /dev/null +++ b/packages/onepm/pyproject.toml @@ -0,0 +1,48 @@ +[project] +name = "onepm" +description = "Picks the right package manager for you." +authors = [ + {name = "Frost Ming", email = "mianghong@gmail.com"}, +] +dependencies = [ + "packaging>=22.1", + "tomlkit>=0.12.3", +] +requires-python = ">=3.10" +readme = "README.md" +license = {text = "MIT"} +dynamic = ["version"] +classifiers = [ + "Topic :: Software Development :: Build Tools", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3 :: Only", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", +] + +[project.optional-dependencies] +shims = ["onepm-shims"] + +[project.urls] +Homepage = "https://github.com/frostming/onepm" +Repository = "https://github.com/frostming/onepm" +Changelog = "https://github.com/frostming/onepm/releases" + +[project.scripts] +pi = "onepm:pi" +pu = "onepm:pu" +pr = "onepm:pr" +pun = "onepm:pun" +pa = "onepm:pa" +onepm = "onepm.cli:main" + +[build-system] +requires = ["pdm-backend"] +build-backend = "pdm.backend" + +[tool.pdm] +distribution = true + +[tool.pdm.version] +source = "scm" diff --git a/src/onepm/__init__.py b/packages/onepm/src/onepm/__init__.py similarity index 60% rename from src/onepm/__init__.py rename to packages/onepm/src/onepm/__init__.py index 4812e2c..3f0e3a3 100644 --- a/src/onepm/__init__.py +++ b/packages/onepm/src/onepm/__init__.py @@ -6,13 +6,11 @@ from onepm.core import OneManager -def make_shortcut( - method_name: str, specified: str | None = None -) -> Callable[[list[str] | None], NoReturn]: +def make_shortcut(method_name: str) -> Callable[[list[str] | None], NoReturn]: def main(args: list[str] | None = None) -> NoReturn: # type: ignore[misc] if args is None: args = sys.argv[1:] - package_manager = OneManager().get_package_manager(specified) + package_manager = OneManager().get_package_manager() getattr(package_manager, method_name)(*args) return main @@ -23,6 +21,3 @@ def main(args: list[str] | None = None) -> NoReturn: # type: ignore[misc] pun = make_shortcut("uninstall") pr = make_shortcut("run") pa = make_shortcut("execute") -pdm = make_shortcut("execute", "pdm") -poetry = make_shortcut("execute", "poetry") -pipenv = make_shortcut("execute", "pipenv") diff --git a/src/onepm/cli.py b/packages/onepm/src/onepm/cli.py similarity index 100% rename from src/onepm/cli.py rename to packages/onepm/src/onepm/cli.py diff --git a/src/onepm/core.py b/packages/onepm/src/onepm/core.py similarity index 93% rename from src/onepm/core.py rename to packages/onepm/src/onepm/core.py index e6a3b11..e1e6e9c 100644 --- a/src/onepm/core.py +++ b/packages/onepm/src/onepm/core.py @@ -11,6 +11,7 @@ from pathlib import Path from typing import TYPE_CHECKING, Any +import tomlkit from packaging.requirements import Requirement from packaging.utils import canonicalize_name from packaging.version import Version @@ -24,7 +25,6 @@ if TYPE_CHECKING: from unearth import PackageFinder -import tomlkit PACKAGE_MANAGERS: dict[str, type[PackageManager]] = { p.name: p # type: ignore[type-abstract] @@ -50,8 +50,20 @@ def __init__( self._tool_dir = Path.home() / ".onepm" + def shim_enabled(self) -> bool: + try: + import unearth + except ModuleNotFoundError: + return False + return True + @cached_property def package_finder(self) -> PackageFinder: + if not self.shim_enabled(): + raise ImportError( + "Package manager shims are disabled, please re-install onepm with '[shims]' extra." + ) + import unearth index_urls = [self.index_url] if self.index_url else [] @@ -99,7 +111,7 @@ def get_installations(self, name: str) -> list[Installation]: venvs = self.package_dir(name) if not venvs.exists(): return [] - versions: list[Version] = [] + versions: list[Installation] = [] for venv in venvs.iterdir(): candidate = next( venv.glob(f"lib/**/site-packages/{name}-*.dist-info"), None @@ -124,7 +136,9 @@ def install_tool(self, name: str, requirement: Requirement) -> Installation: version = Version(best_match.version or "") installed_versions = self.get_installations(name) if ( - installed := next((i.version == version for i in installed_versions), None) + installed := next( + (i for i in installed_versions if i.version == version), None + ) ) is not None: return installed diff --git a/src/onepm/py.typed b/packages/onepm/src/onepm/pm/__init__.py similarity index 100% rename from src/onepm/py.typed rename to packages/onepm/src/onepm/pm/__init__.py diff --git a/src/onepm/pm/base.py b/packages/onepm/src/onepm/pm/base.py similarity index 95% rename from src/onepm/pm/base.py rename to packages/onepm/src/onepm/pm/base.py index a3ef994..42c59ec 100644 --- a/src/onepm/pm/base.py +++ b/packages/onepm/src/onepm/pm/base.py @@ -61,24 +61,24 @@ def get_command(self) -> list[str]: @abc.abstractmethod def install(self, *args: str) -> NoReturn: - pass + ... @abc.abstractmethod def uninstall(self, *args: str) -> NoReturn: - pass + ... @abc.abstractmethod def update(self, *args: str) -> NoReturn: - pass + ... @abc.abstractmethod def run(self, *args: str) -> NoReturn: - pass + ... @classmethod @abc.abstractmethod def matches(cls, pyproject: dict[str, Any]) -> bool: - pass + ... @classmethod def get_executable_name(cls) -> str: @@ -87,7 +87,8 @@ def get_executable_name(cls) -> str: @classmethod def ensure_executable(cls, core: OneManager, requirement: Requirement) -> str: name = cls.get_executable_name() - + if not core.shim_enabled(): + return cls.find_executable(name) versions = core.get_installations(cls.name) best_match = next( filter(lambda v: requirement.specifier.contains(v.version), versions), None diff --git a/src/onepm/pm/pdm.py b/packages/onepm/src/onepm/pm/pdm.py similarity index 100% rename from src/onepm/pm/pdm.py rename to packages/onepm/src/onepm/pm/pdm.py diff --git a/src/onepm/pm/pip.py b/packages/onepm/src/onepm/pm/pip.py similarity index 88% rename from src/onepm/pm/pip.py rename to packages/onepm/src/onepm/pm/pip.py index 77b70fc..6bea20d 100644 --- a/src/onepm/pm/pip.py +++ b/packages/onepm/src/onepm/pm/pip.py @@ -2,6 +2,7 @@ import contextlib import os +import subprocess import sys from pathlib import Path from typing import TYPE_CHECKING, Any, NoReturn @@ -36,7 +37,15 @@ def ensure_executable(cls, core: OneManager, requirement: Requirement) -> str: pip_dist = next(lib_dir.glob("**/site-packages/pip-*.dist-info")) dist = Distribution.at(pip_dist) if dist.version not in requirement.specifier: - core._run_pip("install", "-U", str(requirement), venv=venv) + if not core.shim_enabled(): + subprocess.run( + [executable, "-m", "pip", "install", "-U", str(requirement)], + check=True, + stdout=subprocess.DEVNULL, + stderr=subprocess.DEVNULL, + ) + else: + core._run_pip("install", "-U", str(requirement), venv=venv) return executable def _find_requirements_txt(self) -> str | None: diff --git a/src/onepm/pm/pipenv.py b/packages/onepm/src/onepm/pm/pipenv.py similarity index 100% rename from src/onepm/pm/pipenv.py rename to packages/onepm/src/onepm/pm/pipenv.py diff --git a/src/onepm/pm/poetry.py b/packages/onepm/src/onepm/pm/poetry.py similarity index 100% rename from src/onepm/pm/poetry.py rename to packages/onepm/src/onepm/pm/poetry.py diff --git a/packages/onepm/src/onepm/py.typed b/packages/onepm/src/onepm/py.typed new file mode 100644 index 0000000..e69de29 diff --git a/tests/conftest.py b/packages/onepm/tests/conftest.py similarity index 100% rename from tests/conftest.py rename to packages/onepm/tests/conftest.py diff --git a/tests/test_pdm.py b/packages/onepm/tests/test_pdm.py similarity index 100% rename from tests/test_pdm.py rename to packages/onepm/tests/test_pdm.py diff --git a/tests/test_pip.py b/packages/onepm/tests/test_pip.py similarity index 100% rename from tests/test_pip.py rename to packages/onepm/tests/test_pip.py diff --git a/tests/test_pipenv.py b/packages/onepm/tests/test_pipenv.py similarity index 100% rename from tests/test_pipenv.py rename to packages/onepm/tests/test_pipenv.py diff --git a/tests/test_poetry.py b/packages/onepm/tests/test_poetry.py similarity index 100% rename from tests/test_poetry.py rename to packages/onepm/tests/test_poetry.py diff --git a/tests/test_utils.py b/packages/onepm/tests/test_utils.py similarity index 100% rename from tests/test_utils.py rename to packages/onepm/tests/test_utils.py diff --git a/pdm.lock b/pdm.lock index be938e3..d067000 100644 --- a/pdm.lock +++ b/pdm.lock @@ -2,17 +2,17 @@ # It is not intended for manual editing. [metadata] -groups = ["default", "test", "all"] +groups = ["default", "test", "workspace"] strategy = ["cross_platform", "inherit_metadata"] lock_version = "4.4.1" -content_hash = "sha256:f827cf5f6ed71008bcbc1de3363bebc9dca8a360420121917eea336c8124cf2c" +content_hash = "sha256:c0b383a52fd60e759266cce175c1eec609b6757f362959d05f029a41f7c5a6ea" [[package]] name = "certifi" version = "2023.11.17" requires_python = ">=3.6" summary = "Python package for providing Mozilla's CA Bundle." -groups = ["all"] +groups = ["workspace"] files = [ {file = "certifi-2023.11.17-py3-none-any.whl", hash = "sha256:e036ab49d5b79556f99cfc2d9320b34cfbe5be05c5871b51de9329f0603b0474"}, {file = "certifi-2023.11.17.tar.gz", hash = "sha256:9b469f3a900bf28dc19b8cfbf8019bf47f7fdd1a65a1d4ffb98fc14166beb4d1"}, @@ -23,7 +23,7 @@ name = "charset-normalizer" version = "3.3.2" requires_python = ">=3.7.0" summary = "The Real First Universal Charset Detector. Open, modern and actively maintained alternative to Chardet." -groups = ["all"] +groups = ["workspace"] files = [ {file = "charset-normalizer-3.3.2.tar.gz", hash = "sha256:f30c3cb33b24454a82faecaf01b19c18562b1e89558fb6c56de4d9118a032fd5"}, {file = "charset_normalizer-3.3.2-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:25baf083bf6f6b341f4121c2f3c548875ee6f5339300e08be3f2b2ba1721cdd3"}, @@ -76,14 +76,14 @@ files = [ [[package]] name = "colorama" -version = "0.4.5" -requires_python = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*" +version = "0.4.6" +requires_python = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,!=3.6.*,>=2.7" summary = "Cross-platform colored terminal text." groups = ["test"] marker = "sys_platform == \"win32\"" files = [ - {file = "colorama-0.4.5-py2.py3-none-any.whl", hash = "sha256:854bf444933e37f5824ae7bfc1e98d5bce2ebe4160d46b5edf346a89358e99da"}, - {file = "colorama-0.4.5.tar.gz", hash = "sha256:e6c6b4334fc50988a639d9b98aa429a0b57da6e17b9a44f0451f930b6967b7a4"}, + {file = "colorama-0.4.6-py2.py3-none-any.whl", hash = "sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6"}, + {file = "colorama-0.4.6.tar.gz", hash = "sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44"}, ] [[package]] @@ -103,7 +103,7 @@ name = "idna" version = "3.6" requires_python = ">=3.5" summary = "Internationalized Domain Names in Applications (IDNA)" -groups = ["all"] +groups = ["workspace"] files = [ {file = "idna-3.6-py3-none-any.whl", hash = "sha256:c05567e9c24a6b9faaa835c4821bad0590fbb9d5779e7caa6e1cc4978e7eb24f"}, {file = "idna-3.6.tar.gz", hash = "sha256:9ecdbbd083b06798ae1e86adcbfe8ab1479cf864e4ee30fe4e46a003d12491ca"}, @@ -111,12 +111,38 @@ files = [ [[package]] name = "iniconfig" -version = "1.1.1" -summary = "iniconfig: brain-dead simple config-ini parsing" +version = "2.0.0" +requires_python = ">=3.7" +summary = "brain-dead simple config-ini parsing" groups = ["test"] files = [ - {file = "iniconfig-1.1.1-py2.py3-none-any.whl", hash = "sha256:011e24c64b7f47f6ebd835bb12a743f2fbe9a26d4cecaa7f53bc4f35ee9da8b3"}, - {file = "iniconfig-1.1.1.tar.gz", hash = "sha256:bc3af051d7d14b2ee5ef9969666def0cd1a000e121eaea580d4a313df4b37f32"}, + {file = "iniconfig-2.0.0-py3-none-any.whl", hash = "sha256:b6a85871a79d2e3b22d2d1b94ac2824226a63c6b741c88f7ae975f18b6778374"}, + {file = "iniconfig-2.0.0.tar.gz", hash = "sha256:2d91e135bf72d31a410b17c16da610a82cb55f6b0477d1a902134b24a455b8b3"}, +] + +[[package]] +name = "onepm" +version = "0.3.1.dev5" +requires_python = ">=3.10" +editable = true +path = "./packages/onepm" +summary = "Picks the right package manager for you." +groups = ["workspace"] +dependencies = [ + "packaging>=22.1", + "tomlkit>=0.12.3", +] + +[[package]] +name = "onepm-shims" +version = "0.3.1.dev5" +requires_python = ">=3.10" +editable = true +path = "./packages/onepm-shims" +summary = "The shims package for onepm" +groups = ["workspace"] +dependencies = [ + "unearth>=0.14.0", ] [[package]] @@ -124,7 +150,7 @@ name = "packaging" version = "23.2" requires_python = ">=3.7" summary = "Core utilities for Python packages" -groups = ["all", "default", "test"] +groups = ["test", "workspace"] files = [ {file = "packaging-23.2-py3-none-any.whl", hash = "sha256:8c491190033a9af7e1d931d0b5dacc2ef47509b34dd0de67ed209b5203fc88c7"}, {file = "packaging-23.2.tar.gz", hash = "sha256:048fb0e9405036518eaaf48a55953c750c11e1a1b68e0dd1a9d62ed0c092cfc5"}, @@ -132,19 +158,19 @@ files = [ [[package]] name = "pluggy" -version = "1.0.0" -requires_python = ">=3.6" +version = "1.4.0" +requires_python = ">=3.8" summary = "plugin and hook calling mechanisms for python" groups = ["test"] files = [ - {file = "pluggy-1.0.0-py2.py3-none-any.whl", hash = "sha256:74134bbf457f031a36d68416e1509f34bd5ccc019f0bcc952c7b909d06b37bd3"}, - {file = "pluggy-1.0.0.tar.gz", hash = "sha256:4224373bacce55f955a878bf9cfa763c1e360858e330072059e10bad68531159"}, + {file = "pluggy-1.4.0-py3-none-any.whl", hash = "sha256:7db9f7b503d67d1c5b95f59773ebb58a8c1c288129a88665838012cfb07b8981"}, + {file = "pluggy-1.4.0.tar.gz", hash = "sha256:8c85c2876142a764e5b7548e7d9a0e0ddb46f5185161049a79b7e974454223be"}, ] [[package]] name = "pytest" -version = "7.4.4" -requires_python = ">=3.7" +version = "8.0.0" +requires_python = ">=3.8" summary = "pytest: simple powerful testing with Python" groups = ["test"] dependencies = [ @@ -152,12 +178,12 @@ dependencies = [ "exceptiongroup>=1.0.0rc8; python_version < \"3.11\"", "iniconfig", "packaging", - "pluggy<2.0,>=0.12", + "pluggy<2.0,>=1.3.0", "tomli>=1.0.0; python_version < \"3.11\"", ] files = [ - {file = "pytest-7.4.4-py3-none-any.whl", hash = "sha256:b090cdf5ed60bf4c45261be03239c2c1c22df034fbffe691abe93cd80cea01d8"}, - {file = "pytest-7.4.4.tar.gz", hash = "sha256:2cf0005922c6ace4a3e2ec8b4080eb0d9753fdc93107415332f50ce9e7994280"}, + {file = "pytest-8.0.0-py3-none-any.whl", hash = "sha256:50fb9cbe836c3f20f0dfa99c565201fb75dc54c8d76373cd1bde06b06657bdb6"}, + {file = "pytest-8.0.0.tar.gz", hash = "sha256:249b1b0864530ba251b7438274c4d251c58d868edaaec8762893ad4a0d71c36c"}, ] [[package]] @@ -179,7 +205,7 @@ name = "requests" version = "2.31.0" requires_python = ">=3.7" summary = "Python HTTP for Humans." -groups = ["all"] +groups = ["workspace"] dependencies = [ "certifi>=2017.4.17", "charset-normalizer<4,>=2", @@ -196,7 +222,7 @@ name = "tomli" version = "2.0.1" requires_python = ">=3.7" summary = "A lil' TOML parser" -groups = ["default", "test"] +groups = ["test"] marker = "python_version < \"3.11\"" files = [ {file = "tomli-2.0.1-py3-none-any.whl", hash = "sha256:939de3e7a6161af0c887ef91b7d41a53e7c5a1ca976325f429cb46ea9bc30ecc"}, @@ -208,7 +234,7 @@ name = "tomlkit" version = "0.12.3" requires_python = ">=3.7" summary = "Style preserving TOML library" -groups = ["default"] +groups = ["workspace"] files = [ {file = "tomlkit-0.12.3-py3-none-any.whl", hash = "sha256:b0a645a9156dc7cb5d3a1f0d4bab66db287fcb8e0430bdd4664a095ea16414ba"}, {file = "tomlkit-0.12.3.tar.gz", hash = "sha256:75baf5012d06501f07bee5bf8e801b9f343e7aac5a92581f20f80ce632e6b5a4"}, @@ -219,7 +245,7 @@ name = "unearth" version = "0.14.0" requires_python = ">=3.8" summary = "A utility to fetch and download python packages" -groups = ["all"] +groups = ["workspace"] dependencies = [ "packaging>=20", "requests>=2.25", @@ -234,7 +260,7 @@ name = "urllib3" version = "2.1.0" requires_python = ">=3.8" summary = "HTTP library with thread-safe connection pooling, file post, and more." -groups = ["all"] +groups = ["workspace"] files = [ {file = "urllib3-2.1.0-py3-none-any.whl", hash = "sha256:55901e917a5896a349ff771be919f8bd99aff50b79fe58fec595eb37bbc56bb3"}, {file = "urllib3-2.1.0.tar.gz", hash = "sha256:df7aa8afb0148fa78488e7899b2c59b5f4ffcfa82e6c54ccb9dd37c1d7b52d54"}, diff --git a/pyproject.toml b/pyproject.toml index 958021e..9e789c3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,18 +1,12 @@ [project] -name = "onepm" -description = "Picks the right package manager for you" +name = "onepm-workspace" +description = "Picks the right package manager for you." authors = [ {name = "Frost Ming", email = "mianghong@gmail.com"}, ] -dependencies = [ - "packaging>=22.1", - "tomlkit>=0.12.3", - "unearth>=0.14.0", -] requires-python = ">=3.10" readme = "README.md" license = {text = "MIT"} -dynamic = ["version"] classifiers = [ "Topic :: Software Development :: Build Tools", "Programming Language :: Python :: 3", @@ -22,33 +16,18 @@ classifiers = [ "Programming Language :: Python :: 3.12", ] -[project.urls] -Homepage = "https://github.com/frostming/onepm" -Changelog = "https://github.com/frostming/onepm/releases" - -[project.scripts] -pi = "onepm:pi" -pu = "onepm:pu" -pr = "onepm:pr" -pun = "onepm:pun" -pa = "onepm:pa" -pdm = "onepm:pdm" -poetry = "onepm:poetry" -pipenv = "onepm:pipenv" -onepm = "onepm.cli:main" - -[build-system] -requires = ["pdm-backend"] -build-backend = "pdm.backend" - -[tool.pdm.version] -source = "scm" +[tool.pdm] +distribution = false [tool.pdm.dev-dependencies] test = [ "pytest>=7.1.2", "pytest-mock>=3.12.0", ] +workspace = [ + "-e file:///${PROJECT_ROOT}/packages/onepm#egg=onepm", + "-e file:///${PROJECT_ROOT}/packages/onepm-shims#egg=onepm-shims", +] [tool.ruff] target-version = "py310" @@ -68,3 +47,11 @@ known-first-party = ["onepm"] [tool.onepm] package-manager = "pdm>=2.12.0" + +[tool.pyright] +venvPath = "." +venv = ".venv" +pythonVersion = "3.10" + +[tool.pdm.scripts] +test = "pytest -ra packages/onepm/tests"