diff --git a/docs/source/all_moccasin_toml_parameters.rst b/docs/source/all_moccasin_toml_parameters.rst index 259133c..e8f024e 100644 --- a/docs/source/all_moccasin_toml_parameters.rst +++ b/docs/source/all_moccasin_toml_parameters.rst @@ -42,7 +42,6 @@ All possible options # You can have pip-style dependencies and also github-style dependencies # These are going to be dependencies for your vyper contracts dependencies = ["snekmate==0.1.0", "pcaversaccio/snekmate@0.1.0"] - installer = "uv" save_abi_path = "abis" # location to save ABIs from the explorer cov_config = ".coveragerc" # coverage configuration file dot_env = ".env" # environment variables file diff --git a/docs/source/dependencies.rst b/docs/source/dependencies.rst index d04fadb..59bc053 100644 --- a/docs/source/dependencies.rst +++ b/docs/source/dependencies.rst @@ -1,7 +1,7 @@ Dependencies ############ -Moccasin allows for working with either: +For working with smart contracts, ``moccasin`` allows for working with either: - :ref:`Installing from GitHub repositories ` @@ -68,20 +68,9 @@ You can then use these packages in your vyper contracts, for example in an minia Installing uv/pip/PyPI Dependencies =================================== -Moccasin let's you directly install and work with PyPI packages as you would any other python package. PyPi dependencies in moccasin are by default powered by the `uv `_ tool. In order to use this, you need to have the `uv` tool installed. However, you can change this setting to `pip` in your `moccasin.tom`. +Moccasin let's you directly install and work with PyPI packages as you would any other python package. PyPi dependencies in moccasin are by default powered by the `uv `_ tool under the hood. It comes built-in with ``moccasin``. -.. code-block:: toml - - [project] - installer = "uv" # change/add this setting - -As of today, `moccasin` supports: - -- `uv` - -- `pip` - -You can also directly install and work with PyPI packages as you would any other python package. To install a package from PyPI, you can run the following: +To install a package from PyPI, you can run the following: .. code-block:: bash diff --git a/moccasin/commands/install.py b/moccasin/commands/install.py index 47bddcd..d3350b1 100644 --- a/moccasin/commands/install.py +++ b/moccasin/commands/install.py @@ -47,7 +47,7 @@ def main(args: Namespace): pip_requirements.append(requirement) install_path: Path = config.get_base_dependencies_install_path() if len(pip_requirements) > 0: - _pip_installs(pip_requirements, install_path, config.installer, args.quiet) + _pip_installs(pip_requirements, install_path, args.quiet) if len(github_requirements) > 0: _github_installs(github_requirements, install_path, args.quiet) return 0 @@ -226,15 +226,10 @@ def _get_download_url_from_tag(org: str, repo: str, version: str, headers: dict) ) -def _pip_installs( - package_ids: list[str], base_install_path: Path, installer: str, quiet: bool = False -): +def _pip_installs(package_ids: list[str], base_install_path: Path, quiet: bool = False): logger.info(f"Installing {len(package_ids)} pip packages...") cmd = [] - if installer == "uv": - cmd = ["uv", "pip", "install", *package_ids, "--target", str(base_install_path)] - else: - cmd = ["pip", "install", *package_ids, "--target", str(base_install_path)] + cmd = ["uv", "pip", "install", *package_ids, "--target", str(base_install_path)] capture_output = quiet try: @@ -243,10 +238,6 @@ def _pip_installs( logger.info( f"Stack trace:\n{''.join(traceback.format_exception(type(e), e, e.__traceback__))}" ) - logger.error(e) - logger.info( - f'Your installer {installer} is not found in your system PATH.\nPlease install {installer} or update your installer in your moccasin.toml as: \n\n[project]\ninstaller = "your installer here (pip or uv)"' - ) sys.exit(1) _write_dependencies(package_ids, DependencyType.PIP) diff --git a/pyproject.toml b/pyproject.toml index 64380bc..41e8b65 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -11,10 +11,10 @@ dependencies = [ "python-dotenv>=1.0.1", "titanoboa-zksync>=v0.2.2", "tqdm>=4.66.5", - "tomlkit>=0.13.2", - # For preserving comments when writing to toml + "tomlkit>=0.13.2", # For preserving comments when writing to toml "tomli-w>=1.0.0", "pytest-cov>=5.0.0", + "uv>=0.4.15", ] readme = "README.md" requires-python = ">= 3.11, < 3.13" diff --git a/uv.lock b/uv.lock index 121d95c..be855a2 100644 --- a/uv.lock +++ b/uv.lock @@ -626,6 +626,7 @@ dependencies = [ { name = "tomli-w" }, { name = "tomlkit" }, { name = "tqdm" }, + { name = "uv" }, ] [package.optional-dependencies] @@ -663,6 +664,7 @@ requires-dist = [ { name = "tomli-w", specifier = ">=1.0.0" }, { name = "tomlkit", specifier = ">=0.13.2" }, { name = "tqdm", specifier = ">=4.66.5" }, + { name = "uv", specifier = ">=0.4.15" }, { name = "watchdog", marker = "extra == 'docs'", specifier = ">=5.0.2" }, ] @@ -1297,6 +1299,31 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/ca/1c/89ffc63a9605b583d5df2be791a27bc1a42b7c32bab68d3c8f2f73a98cd4/urllib3-2.2.2-py3-none-any.whl", hash = "sha256:a448b2f64d686155468037e1ace9f2d2199776e17f0a46610480d311f73e3472", size = 121444 }, ] +[[package]] +name = "uv" +version = "0.4.15" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/5b/2f/a222fa72fb3197cd4c7f5259b9bf17c5478933be11f2b7754290509a06f6/uv-0.4.15.tar.gz", hash = "sha256:8e36b8e07595fc6216d01e729c81a0b4ff029a93cc2ef987a73d3b650d6d559c", size = 1965646 } +wheels = [ + { url = "https://files.pythonhosted.org/packages/8f/5a/19df8161c69e452bbb009cc9d24d3a187aed0cba0985eae6a9e7cf7f8024/uv-0.4.15-py3-none-linux_armv6l.whl", hash = "sha256:04858bfd551fabe1635127d9a0afe5c62e1e7d56cf309a9674840c90bfc1f21e", size = 11479317 }, + { url = "https://files.pythonhosted.org/packages/11/11/246eb4a195a085b0e72599f1d23ba30c822a26ce91697703cddd873b3db8/uv-0.4.15-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:e32137ba8202b1291e879e8145113bfb543fcc992b5f043852a96d803788b83c", size = 11825671 }, + { url = "https://files.pythonhosted.org/packages/24/e4/e267e2ff15986533bf819fd03ae565bf66d6bba28d9a67a1c1c12a7437da/uv-0.4.15-py3-none-macosx_11_0_arm64.whl", hash = "sha256:1bb79cb06be9bb25a1bf8641bf34593f64a96b3ba66ebd8712954f647d9faa24", size = 10948815 }, + { url = "https://files.pythonhosted.org/packages/75/74/35c45db4465b084c6af4d4468b06921a4b1e679fb8cfa5883bd4486bec79/uv-0.4.15-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.musllinux_1_1_aarch64.whl", hash = "sha256:1401e73f0e8df62b4cfbf394e65a75f18b73bf8a94a6c5653a55bd6fdb8e1bc3", size = 11295486 }, + { url = "https://files.pythonhosted.org/packages/43/d5/d09fa9dac4bdd37f7d7bb28b182f19ec021890e2f3163463c1cb4c813aeb/uv-0.4.15-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:d16ae6b97eb77f478dfe51d6eb3627048d3f47bd04282d3006e6a212e541dba0", size = 11275359 }, + { url = "https://files.pythonhosted.org/packages/72/f0/88a6bab0b661873151685fc9885f2c12c0b98fd4a138c127b66504ed98ed/uv-0.4.15-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:be46b37b569e3c8ffb7d78022bcc0eadeb987109f709c1cec01b00c261ed9595", size = 11991296 }, + { url = "https://files.pythonhosted.org/packages/aa/54/38362fa8ff4670e34e80015d031a16939cad6c4173a8ca8b603d015677da/uv-0.4.15-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl", hash = "sha256:8d45295757f66d1913e5917c06f1974745adad842403d419362491939be889a6", size = 12714934 }, + { url = "https://files.pythonhosted.org/packages/7b/a7/a3a5cd53775c46df4f479948e7f01d1406e6ef64b0276d9a674c55ab2b96/uv-0.4.15-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:7fcf7f3812dd173d39273e99fb2abb0814be6133e7a721baa424cbcfd25b483b", size = 12497268 }, + { url = "https://files.pythonhosted.org/packages/a6/9e/2632995096a2af4b6f415079428a99880f04f5641c23c247da994745c1db/uv-0.4.15-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:a5920ff4d114025c51d3f925130ca3b0fad277631846b1109347c24948b29159", size = 15956906 }, + { url = "https://files.pythonhosted.org/packages/80/f3/674fc5fa68d1ddec989f6e447dc5b2818c8dd51aad8da26776f1c8f5847c/uv-0.4.15-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:9e28141883c0aa8525ad5418e519d8791b7dd75f35020d3b1457db89346c5dc8", size = 12224188 }, + { url = "https://files.pythonhosted.org/packages/46/c8/a91c39ef1c695041cdad922da8dbee5dc29191a0d4a8282b3bd451e0df18/uv-0.4.15-py3-none-manylinux_2_28_aarch64.whl", hash = "sha256:21a3cedb2276d635543a10a11c61f75c6e387110e23e90cdb6c6dd2e1f3c9453", size = 11408803 }, + { url = "https://files.pythonhosted.org/packages/11/c9/bff204e786f3cf081234eab14933d25345f6db172f15e41971ebcf6ede5c/uv-0.4.15-py3-none-musllinux_1_1_armv7l.whl", hash = "sha256:6eef6881abf9b858020ffd23f4e5d77423329da2d4a1bc0af6613c2f698c369a", size = 11282836 }, + { url = "https://files.pythonhosted.org/packages/e3/d3/9e0373926ae37222a9cc6a45d4b886becc872699e5a0b2eec97623f5e262/uv-0.4.15-py3-none-musllinux_1_1_i686.whl", hash = "sha256:27884429b7fed371fe1fcbe829659c4a259463d0ecacb7891d800e4754b5f24c", size = 11788490 }, + { url = "https://files.pythonhosted.org/packages/0c/3f/203ec3510017185e68a23392c523615f89b5eae5c7cb2e5a0964409b74fc/uv-0.4.15-py3-none-musllinux_1_1_ppc64le.whl", hash = "sha256:4e40deb2cf2cb403dbaf65209d49c45462ebbb1bff290d4c18b902b5b385cdc9", size = 13554182 }, + { url = "https://files.pythonhosted.org/packages/c2/7d/9d8d8efd477f3dfd5301897527517a93140210196f6665ba408533c0d7dc/uv-0.4.15-py3-none-musllinux_1_1_x86_64.whl", hash = "sha256:cf7d554656bb8c5b7710300e04d86ab5137ebdd31fe309d66860a9d474b385f8", size = 12357807 }, + { url = "https://files.pythonhosted.org/packages/d8/e4/8697997485ee4b1e47170e5cd9796cd48ea0aafd7068aef556fab92f4d1e/uv-0.4.15-py3-none-win32.whl", hash = "sha256:9822fa4db0d8d50abf5eebe081c01666a98120455090d0b71463d01d5d4153c1", size = 11641259 }, + { url = "https://files.pythonhosted.org/packages/ef/fe/ed6023c885087507094d97a53d452765a1600baa8b2db431fe37ee68149f/uv-0.4.15-py3-none-win_amd64.whl", hash = "sha256:0e9b78f1a800a4cfdfbdc9ff4e5d4cce34af770f8a1f2b9416b161f294eb3703", size = 12809800 }, +] + [[package]] name = "vvm" version = "0.2.1"