From 55e9fc04d5fe5b0995feb8bdeaca3cd6d67166f7 Mon Sep 17 00:00:00 2001 From: evelynmitchell Date: Tue, 26 Nov 2024 13:29:19 -0700 Subject: [PATCH] uv cleanup and docs --- pyproject.toml | 58 +++++++++++++++++++++++++++------------------ uv_project_notes.md | 46 +++++++++++++++++++++++++++++++++++ 2 files changed, 81 insertions(+), 23 deletions(-) create mode 100644 uv_project_notes.md diff --git a/pyproject.toml b/pyproject.toml index d8d06c61..135d1427 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,18 +1,14 @@ -[build-system] -requires = ["poetry-core>=1.0.0"] -build-backend = "poetry.core.masonry.api" -[tool.poetry] +[project] name = "swarms" version = "6.2.9" description = "Swarms - Pytorch" -license = "MIT" -authors = ["Kye Gomez "] -homepage = "https://github.com/kyegomez/swarms" -documentation = "https://docs.swarms.world" +license = {text = "MIT License"} +authors = [ + { name = "Kye Gomez", email = "kye@swams.world" }, +] readme = "README.md" -repository = "https://github.com/kyegomez/swarms" keywords = [ "artificial intelligence", "deep learning", @@ -45,8 +41,34 @@ classifiers = [ "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 3.10", ] +requires-python = ">=3.10,<4.0" +[dependency-groups] +lint = [ + "black<25.0,>=23.1", + "ruff<0.7.4,>=0.5.1", + "types-toml<1.0.0.0,>=0.10.8.1", + "types-pytz<2025.0,>=2023.3", + "types-chardet<6.0.0.0,>=5.0.4.6", + "mypy-protobuf<4.0.0,>=3.0.0", +] +test = [ + "pytest<9.0.0,>=8.1.1", + "termcolor<3.0.0,>=2.4.0", + "pandas<3.0.0,>=2.2.2", + "fastapi<0.116.0,>=0.110.1", +] + + +[project.urls] +homepage = "https://github.com/kyegomez/swarms" +repository = "https://github.com/kyegomez/swarms" +documentation = "https://docs.swarms.world" + +[project.scripts] +swarms = "swarms.cli.main:main" + [tool.poetry.dependencies] python = ">=3.10,<4.0" torch = ">=2.1.1,<3.0" @@ -81,24 +103,14 @@ reportlab = "*" doc-master = "*" rich = "*" -[tool.poetry.scripts] -swarms = "swarms.cli.main:main" +[tool.setuptools.packages.find] +where = ["swarms"] + + -[tool.poetry.group.lint.dependencies] -black = ">=23.1,<25.0" -ruff = ">=0.5.1,<0.7.4" -types-toml = "^0.10.8.1" -types-pytz = ">=2023.3,<2025.0" -types-chardet = "^5.0.4.6" -mypy-protobuf = "^3.0.0" -[tool.poetry.group.test.dependencies] -pytest = "^8.1.1" -termcolor = "^2.4.0" -pandas = "^2.2.2" -fastapi = ">=0.110.1,<0.116.0" [tool.ruff] line-length = 70 diff --git a/uv_project_notes.md b/uv_project_notes.md new file mode 100644 index 00000000..0d958b53 --- /dev/null +++ b/uv_project_notes.md @@ -0,0 +1,46 @@ +# uv project notes + +Guide: (https://www.loopwerk.io/articles/2024/migrate-poetry-to-uv/) + +## install uv + +Follow the [instructions](https://docs.astral.sh/uv/getting-started/installation/) + +## set up a virtual environment + +This assumes you have uv installed. + +```bash +uv venv --python 3.12.0 +source .venv/bin/activate +``` + +or you can run uv without setting up a virtual environment + +```bash +# use --sytem to run the tool ruff not in a virtual environment +uv run ruff check --system +``` + +# pyproject.toml differences + +In Poetry, the project is described in the [tool.poetry] section of the pyproject.toml file. In uv, the project is described in the [project] section of the pyproject.toml file. + +To convert, we use ```pdm``` to get us most of the way there followin [1] + +```bash +uvx pdm import pyproject.toml +``` + +There were several differences in the pyproject.toml file that needed to be addressed manually. +The authors field needed to be in the form: + +```toml +authors = [ { name = "John Doe", email = "email"}] +license = {text = "MIT License"} +``` + +There weren't a lot of good docs on these formatting issues, and the serde error messages were only helpful if you had some idea of what the goal was already. I ended up referring to [1] and [2] for examples. + +[1](https://packaging.python.org/en/latest/flow/#the-configuration-file) +[2](https://reinforcedknowledge.com/a-comprehensive-guide-to-python-project-management-and-packaging-concepts-illustrated-with-uv-part-i/) \ No newline at end of file