From d156f715d3e52422020de0b439f5d21c267b6d92 Mon Sep 17 00:00:00 2001 From: Pedro Tabacof Date: Wed, 6 Dec 2023 21:38:46 +0000 Subject: [PATCH 1/4] trying to fix readthedocs v3 --- .readthedocs.yaml | 2 ++ pyproject.toml | 70 ++++++++++++++++++++++++++++++++------------ requirements.txt | 1 + setup.py | 74 ++++++++++++++++++++++++++++------------------- 4 files changed, 100 insertions(+), 47 deletions(-) diff --git a/.readthedocs.yaml b/.readthedocs.yaml index 50f7c43..5c28715 100644 --- a/.readthedocs.yaml +++ b/.readthedocs.yaml @@ -12,6 +12,8 @@ build: python: "3.11" rust: "1.70" commands: + - python -m venv .env + - source .env/bin/activate - pip install -r requirements.txt - maturin develop --release diff --git a/pyproject.toml b/pyproject.toml index 9cc7b45..e2d6d66 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,22 +1,56 @@ -[project] -name = "rustrees" -dependencies = [ - "numpy>=1.0", - "pandas>=2.0", - "scikit-learn>=1.0", - "pyarrow>=12.0", -] +import toml -[tool.maturin] -python-source = "python" -module-name = "rustrees.rustrees" +# Load and parse Cargo.toml +with open("path/to/your/Cargo.toml", "r") as file: + cargo_toml = toml.load(file) -[build-system] -requires = ["maturin>=1.0,<2.0"] -build-backend = "maturin" +# Load and parse pyproject.toml +with open("path/to/your/pyproject.toml", "r") as file: + pyproject_toml = toml.load(file) -[tool.black] -line-length = 88 +# Extract information from Cargo.toml +package_name = cargo_toml["package"]["name"] +version = cargo_toml["package"]["version"] +description = cargo_toml["package"].get("description", "") +license_type = cargo_toml["package"].get("license", "") +authors = cargo_toml["package"].get("authors", []) +authors_str = ", ".join(authors) -[tool.ruff] -line-length = 88 +# Extract information from pyproject.toml +dependencies = pyproject_toml["project"]["dependencies"] +build_requires = pyproject_toml["build-system"]["requires"] + +from setuptools import setup, find_packages + +setup( + name=package_name, + version=version, + description=description, + long_description=open('README.md').read(), + long_description_content_type='text/markdown', + author=authors_str, + url='https://github.com/tabacof/rust-trees', + license=license_type, + packages=find_packages(), + include_package_data=True, + install_requires=dependencies, + classifiers=[ + 'Development Status :: 4 - Beta', + 'Intended Audience :: Developers', + 'Intended Audience :: Science/Research', + 'License :: OSI Approved :: MIT License', + 'Operating System :: OS Independent', + 'Programming Language :: Python', + 'Programming Language :: Rust', + 'Topic :: Software Development', + 'Topic :: Scientific/Engineering', + 'Topic :: Scientific/Engineering :: Artificial Intelligence', + ], + python_requires='>=3.6', + setup_requires=build_requires, + zip_safe=False, + project_urls={ + 'Documentation': 'https://rust-trees.readthedocs.io/en/latest/', + 'Rust Package': 'https://crates.io/crates/rustrees', + }, +) diff --git a/requirements.txt b/requirements.txt index 2dd84a0..81a19e5 100644 --- a/requirements.txt +++ b/requirements.txt @@ -9,3 +9,4 @@ econml seaborn black ruff +toml diff --git a/setup.py b/setup.py index 169ebeb..17233b3 100644 --- a/setup.py +++ b/setup.py @@ -1,40 +1,56 @@ +import toml + +# Load and parse Cargo.toml +with open("path/to/your/Cargo.toml", "r") as file: + cargo_toml = toml.load(file) + +# Load and parse pyproject.toml +with open("path/to/your/pyproject.toml", "r") as file: + pyproject_toml = toml.load(file) + +# Extract information from Cargo.toml +package_name = cargo_toml["package"]["name"] +version = cargo_toml["package"]["version"] +description = cargo_toml["package"].get("description", "") +license_type = cargo_toml["package"].get("license", "") +authors = cargo_toml["package"].get("authors", []) +authors_str = ", ".join(authors) + +# Extract information from pyproject.toml +dependencies = pyproject_toml["project"]["dependencies"] +build_requires = pyproject_toml["build-system"]["requires"] + from setuptools import find_packages, setup setup( - name="rustrees", - version="0.2.0", - description="Efficient decision tree and random forest library written in Rust with Python bindings", - long_description=open("README.md").read(), - long_description_content_type="text/markdown", - author="Pedro Tabacof, Guilherme Lázari", - author_email="tabacof@gmail.com, guilhermelcs@gmail.com", - url="https://github.com/tabacof/rust-trees", - license="MIT", + name=package_name, + version=version, + description=description, + long_description=open('README.md').read(), + long_description_content_type='text/markdown', + author=authors_str, + url='https://github.com/tabacof/rust-trees', + license=license_type, packages=find_packages(), include_package_data=True, - install_requires=[ - "numpy>=1.0", - "pandas>=2.0", - "scikit-learn>=1.0", - "pyarrow>=12.0", - ], + install_requires=dependencies, classifiers=[ - "Development Status :: 4 - Beta", - "Intended Audience :: Developers", - "Intended Audience :: Science/Research", - "License :: OSI Approved :: MIT License", - "Operating System :: OS Independent", - "Programming Language :: Python", - "Programming Language :: Rust", - "Topic :: Software Development", - "Topic :: Scientific/Engineering", - "Topic :: Scientific/Engineering :: Artificial Intelligence", + 'Development Status :: 4 - Beta', + 'Intended Audience :: Developers', + 'Intended Audience :: Science/Research', + 'License :: OSI Approved :: MIT License', + 'Operating System :: OS Independent', + 'Programming Language :: Python', + 'Programming Language :: Rust', + 'Topic :: Software Development', + 'Topic :: Scientific/Engineering', + 'Topic :: Scientific/Engineering :: Artificial Intelligence', ], - python_requires=">=3.6", - setup_requires=["maturin>=1.0,<2.0"], + python_requires='>=3.6', + setup_requires=build_requires, zip_safe=False, project_urls={ - "Documentation": "https://rust-trees.readthedocs.io/en/latest/", - "Rust Package": "https://crates.io/crates/rustrees", + 'Documentation': 'https://rust-trees.readthedocs.io/en/latest/', + 'Rust Package': 'https://crates.io/crates/rustrees', }, ) From 9a4190513da6c0d3aa82387250f8b77d6745c95d Mon Sep 17 00:00:00 2001 From: Pedro Tabacof Date: Wed, 6 Dec 2023 21:39:38 +0000 Subject: [PATCH 2/4] trying to fix readthedocs v3 --- pyproject.toml | 70 +++++++++++++------------------------------------- 1 file changed, 18 insertions(+), 52 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index e2d6d66..9cc7b45 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,56 +1,22 @@ -import toml +[project] +name = "rustrees" +dependencies = [ + "numpy>=1.0", + "pandas>=2.0", + "scikit-learn>=1.0", + "pyarrow>=12.0", +] -# Load and parse Cargo.toml -with open("path/to/your/Cargo.toml", "r") as file: - cargo_toml = toml.load(file) +[tool.maturin] +python-source = "python" +module-name = "rustrees.rustrees" -# Load and parse pyproject.toml -with open("path/to/your/pyproject.toml", "r") as file: - pyproject_toml = toml.load(file) +[build-system] +requires = ["maturin>=1.0,<2.0"] +build-backend = "maturin" -# Extract information from Cargo.toml -package_name = cargo_toml["package"]["name"] -version = cargo_toml["package"]["version"] -description = cargo_toml["package"].get("description", "") -license_type = cargo_toml["package"].get("license", "") -authors = cargo_toml["package"].get("authors", []) -authors_str = ", ".join(authors) +[tool.black] +line-length = 88 -# Extract information from pyproject.toml -dependencies = pyproject_toml["project"]["dependencies"] -build_requires = pyproject_toml["build-system"]["requires"] - -from setuptools import setup, find_packages - -setup( - name=package_name, - version=version, - description=description, - long_description=open('README.md').read(), - long_description_content_type='text/markdown', - author=authors_str, - url='https://github.com/tabacof/rust-trees', - license=license_type, - packages=find_packages(), - include_package_data=True, - install_requires=dependencies, - classifiers=[ - 'Development Status :: 4 - Beta', - 'Intended Audience :: Developers', - 'Intended Audience :: Science/Research', - 'License :: OSI Approved :: MIT License', - 'Operating System :: OS Independent', - 'Programming Language :: Python', - 'Programming Language :: Rust', - 'Topic :: Software Development', - 'Topic :: Scientific/Engineering', - 'Topic :: Scientific/Engineering :: Artificial Intelligence', - ], - python_requires='>=3.6', - setup_requires=build_requires, - zip_safe=False, - project_urls={ - 'Documentation': 'https://rust-trees.readthedocs.io/en/latest/', - 'Rust Package': 'https://crates.io/crates/rustrees', - }, -) +[tool.ruff] +line-length = 88 From efadc14ac14a75795d2f2c5906559dbc7fcbda63 Mon Sep 17 00:00:00 2001 From: Pedro Tabacof Date: Wed, 6 Dec 2023 21:41:08 +0000 Subject: [PATCH 3/4] release bump --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index f6abc00..bfb8426 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "rustrees" -version = "0.2.2" +version = "0.2.3" edition = "2021" authors = [ "Guilherme Lázari ", From d71e7b4d7430424332ef6646b15620460a5abaa9 Mon Sep 17 00:00:00 2001 From: Pedro Tabacof Date: Wed, 6 Dec 2023 21:43:27 +0000 Subject: [PATCH 4/4] fixing setup --- setup.py | 43 +++++++++++++++++++------------------------ 1 file changed, 19 insertions(+), 24 deletions(-) diff --git a/setup.py b/setup.py index 17233b3..290956e 100644 --- a/setup.py +++ b/setup.py @@ -1,14 +1,12 @@ import toml +from setuptools import find_packages, setup -# Load and parse Cargo.toml -with open("path/to/your/Cargo.toml", "r") as file: +with open("Cargo.toml", "r") as file: cargo_toml = toml.load(file) -# Load and parse pyproject.toml -with open("path/to/your/pyproject.toml", "r") as file: +with open("pyproject.toml", "r") as file: pyproject_toml = toml.load(file) -# Extract information from Cargo.toml package_name = cargo_toml["package"]["name"] version = cargo_toml["package"]["version"] description = cargo_toml["package"].get("description", "") @@ -16,41 +14,38 @@ authors = cargo_toml["package"].get("authors", []) authors_str = ", ".join(authors) -# Extract information from pyproject.toml dependencies = pyproject_toml["project"]["dependencies"] build_requires = pyproject_toml["build-system"]["requires"] -from setuptools import find_packages, setup - setup( name=package_name, version=version, description=description, - long_description=open('README.md').read(), - long_description_content_type='text/markdown', + long_description=open("README.md").read(), + long_description_content_type="text/markdown", author=authors_str, - url='https://github.com/tabacof/rust-trees', + url="https://github.com/tabacof/rust-trees", license=license_type, packages=find_packages(), include_package_data=True, install_requires=dependencies, classifiers=[ - 'Development Status :: 4 - Beta', - 'Intended Audience :: Developers', - 'Intended Audience :: Science/Research', - 'License :: OSI Approved :: MIT License', - 'Operating System :: OS Independent', - 'Programming Language :: Python', - 'Programming Language :: Rust', - 'Topic :: Software Development', - 'Topic :: Scientific/Engineering', - 'Topic :: Scientific/Engineering :: Artificial Intelligence', + "Development Status :: 4 - Beta", + "Intended Audience :: Developers", + "Intended Audience :: Science/Research", + "License :: OSI Approved :: MIT License", + "Operating System :: OS Independent", + "Programming Language :: Python", + "Programming Language :: Rust", + "Topic :: Software Development", + "Topic :: Scientific/Engineering", + "Topic :: Scientific/Engineering :: Artificial Intelligence", ], - python_requires='>=3.6', + python_requires=">=3.6", setup_requires=build_requires, zip_safe=False, project_urls={ - 'Documentation': 'https://rust-trees.readthedocs.io/en/latest/', - 'Rust Package': 'https://crates.io/crates/rustrees', + "Documentation": "https://rust-trees.readthedocs.io/en/latest/", + "Rust Package": "https://crates.io/crates/rustrees", }, )