Skip to content
Snippets Groups Projects
Commit 5d6524d3 authored by Grégoire Kubler's avatar Grégoire Kubler
Browse files

feat : 1st draw at aidge dependencies handling

parent 2054fc04
No related branches found
No related tags found
2 merge requests!93Release v0.3.0,!64Feat/release pip
Pipeline #48908 waiting for manual action
...@@ -13,6 +13,24 @@ from math import ceil ...@@ -13,6 +13,24 @@ from math import ceil
from setuptools import setup, Extension from setuptools import setup, Extension
from setuptools.command.build_ext import build_ext from setuptools.command.build_ext import build_ext
#######################################################
# DEPENDENCIES
"""
Dictionnary containing all aidge submodules and their required version.
WARNING : THIS IS ONLY A LOOK UP TABLE, build dependencies are listed below
"""
aidge_dependencies_LuT = {
"aidge_core": "0.2.1",
}
third_party_dependencies = [
"numpy",
"onnx>=1.16.0",
]
aidge_required_dependencies = [
"aidge_core",
]
def get_project_name() -> str: def get_project_name() -> str:
with open(pathlib.Path().absolute() / "pyproject.toml", "r") as file: with open(pathlib.Path().absolute() / "pyproject.toml", "r") as file:
...@@ -20,6 +38,25 @@ def get_project_name() -> str: ...@@ -20,6 +38,25 @@ def get_project_name() -> str:
return project_toml["project"]["name"] return project_toml["project"]["name"]
def read_local_or_pypi(package_name: str, version: str = None):
"""
Allows to know if a package exists locally or if it needs to be retrieved from pypi.
We check if each submodule is initilialized by checking the existence of pyproject.toml.
If not initialized, this project will be retrieved from pypi.
Args :
package_name : name of the pkg to look up from
version : version requirement with the condition (i.e >=2.3.4 , ==1.2 , <3.0.0)
"""
submodule = pathlib.Path(__file__).parent / ".." / package_name.replace("-", "_")
if (submodule / "pyproject.toml").exists():
return f"{package_name} @ file://{submodule.absolute()}"
elif version:
return f"{package_name}{version}"
return package_name
class CMakeExtension(Extension): class CMakeExtension(Extension):
def __init__(self, name): def __init__(self, name):
super().__init__(name, sources=[]) super().__init__(name, sources=[])
...@@ -96,6 +133,7 @@ class CMakeBuild(build_ext): ...@@ -96,6 +133,7 @@ class CMakeBuild(build_ext):
if __name__ == "__main__": if __name__ == "__main__":
setup( setup(
include_package_data=True, include_package_data=True,
install_requires=aidge_required_dependencies + third_party_dependencies,
ext_modules=[CMakeExtension(get_project_name())], ext_modules=[CMakeExtension(get_project_name())],
cmdclass={ cmdclass={
"build_ext": CMakeBuild, "build_ext": CMakeBuild,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment