Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor Packaging: Split setup.py into setup.py and pyproject.toml for PEP 517 Compliance #657

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ Currently, we are supporting Python 3. There are several ways to install Cornac:

- **From the GitHub source (for latest updates):**
```bash
pip3 install Cython numpy scipy
pip3 install git+https://github.com/PreferredAI/cornac.git
```

Expand Down
57 changes: 57 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
[build-system]
requires = [
"setuptools>=42",
"wheel",
"Cython>=0.29.21",
"numpy<2.0.0",
"scipy<=1.13.1",
]
build-backend = "setuptools.build_meta"

[project]
name = "cornac"
version = "2.3.0"
description = "A Comparative Framework for Multimodal Recommender Systems"
readme = "README.md"
dependencies = [
"numpy<2.0.0",
"scipy<=1.13.1",
"tqdm",
"powerlaw"
]
requires-python = ">=3.9"
license = { file = "LICENSE" }
keywords = [
"recommender system",
"collaborative filtering",
"multimodal",
"preference learning",
"recommendation",
]
classifiers = [
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Science/Research",
"Intended Audience :: Education",
"Intended Audience :: Developers",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"License :: OSI Approved :: Apache Software License",
"Topic :: Software Development",
"Topic :: Scientific/Engineering",
]

[project.urls]
Homepage = "https://cornac.preferred.ai"

[project.optional-dependencies]
tests = [
"pytest",
"pytest-pep8",
"pytest-xdist",
"pytest-cov",
"Flask",
]
45 changes: 2 additions & 43 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,20 +29,8 @@
import glob
import shutil
from setuptools import Extension, Command, setup, find_packages


INSTALL_REQUIRES = ["numpy<2.0.0", "scipy<=1.13.1", "tqdm", "powerlaw"]

try:
from Cython.Distutils import build_ext
import numpy as np
import scipy
except ImportError:
escape_dependency_version = lambda x: '"{}"'.format(x) if "<" in x or "=" in x or ">" in x else x
exit(
"We need some dependencies to build Cornac.\n"
+ "Run: pip3 install Cython {}".format(" ".join([escape_dependency_version(x) for x in INSTALL_REQUIRES]))
)
from Cython.Distutils import build_ext
import numpy as np


with open("README.md", "r") as fh:
Expand Down Expand Up @@ -341,37 +329,8 @@ def run(self):
}

setup(
name="cornac",
version="2.3.0",
description="A Comparative Framework for Multimodal Recommender Systems",
long_description=long_description,
long_description_content_type="text/markdown",
url="https://cornac.preferred.ai",
keywords=[
"recommender system",
"collaborative filtering",
"multimodal",
"preference learning",
"recommendation",
],
ext_modules=extensions,
install_requires=INSTALL_REQUIRES,
extras_require={"tests": ["pytest", "pytest-pep8", "pytest-xdist", "pytest-cov", "Flask"]},
cmdclass=cmdclass,
packages=find_packages(),
classifiers=[
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Science/Research",
"Intended Audience :: Education",
"Intended Audience :: Developers",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"License :: OSI Approved :: Apache Software License",
"Topic :: Software Development",
"Topic :: Scientific/Engineering",
],
)