From d8fd0468cf65addf1f440e94968a2a97006a7544 Mon Sep 17 00:00:00 2001 From: prayansh_chhablani Date: Sat, 20 Sep 2025 18:07:22 +0530 Subject: [PATCH 1/9] setup pip package --- MANIFEST.in | 6 ++++++ pyproject.toml | 21 +++++++++++++++++++-- setup.py | 25 +++++++++++++++++++++++++ 3 files changed, 50 insertions(+), 2 deletions(-) create mode 100644 MANIFEST.in create mode 100644 setup.py diff --git a/MANIFEST.in b/MANIFEST.in new file mode 100644 index 00000000000..03033c6b5d6 --- /dev/null +++ b/MANIFEST.in @@ -0,0 +1,6 @@ +include SConstruct +include SConscript +recursive-include board * +recursive-include crypto * +recursive-include certs * +recursive-include tests * diff --git a/pyproject.toml b/pyproject.toml index 660fc3e63e8..202cf6c06f2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -19,7 +19,6 @@ dependencies = [ [project.optional-dependencies] dev = [ "scons", - "pycryptodome >= 3.9.8", "cffi", "flaky", "pytest", @@ -34,7 +33,7 @@ dev = [ ] [build-system] -requires = ["setuptools>=61", "wheel"] +requires = ["setuptools>=61", "wheel", "pycryptodome >= 3.9.8"] build-backend = "setuptools.build_meta" [tool.setuptools] @@ -43,6 +42,24 @@ packages = ["panda"] [tool.setuptools.package-dir] panda = "." +[tool.hatch.build.targets.wheel] +packages = ["src/panda"] +include = [ "include/**" +] + +[tool.hatch.build.targets.wheel.shared-data] +"include" = "include" + +[tool.setuptools.package-data] +panda = [ +"board/**/*.h", +"board/**/*.py", +"board/obj/**/*.bin", +"board/obj/**/*.elf", +"board/obj/**/*.bin.signed", +"python/**/*.py" +] + [tool.mypy] # third-party packages ignore_missing_imports = true diff --git a/setup.py b/setup.py new file mode 100644 index 00000000000..edacdac6176 --- /dev/null +++ b/setup.py @@ -0,0 +1,25 @@ +import os +import subprocess +from setuptools import setup +from setuptools.command.build import build as _build + +class build(_build): + def run(self): + env = os.environ.copy() + env['FINAL_PROVISIONING'] = '1' + + project_root = os.path.abspath(os.path.dirname(__file__)) + + print("Building firmware with scons...") + + subprocess.check_call( + ["scons", "-j4"], + cwd=project_root, + env=env + ) + + super().run() + +setup( + cmdclass={"build": build}, +) \ No newline at end of file From bf5956bde09de35f1fe23154ae043782dc6c29eb Mon Sep 17 00:00:00 2001 From: prayansh_chhablani Date: Sat, 20 Sep 2025 18:35:15 +0530 Subject: [PATCH 2/9] fix test --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index edacdac6176..3d616c0e4c7 100644 --- a/setup.py +++ b/setup.py @@ -11,7 +11,7 @@ def run(self): project_root = os.path.abspath(os.path.dirname(__file__)) print("Building firmware with scons...") - + subprocess.check_call( ["scons", "-j4"], cwd=project_root, From 6fe5e5fa6bd146fc4b8a58d91953c628ca5dd534 Mon Sep 17 00:00:00 2001 From: prayansh_chhablani Date: Sun, 21 Sep 2025 00:28:33 +0530 Subject: [PATCH 3/9] expose include path --- __init__.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/__init__.py b/__init__.py index 12fbe3a7c5f..dfa21883e79 100644 --- a/__init__.py +++ b/__init__.py @@ -1,3 +1,4 @@ +import os from .python.constants import McuType, BASEDIR, FW_PATH, USBPACKET_MAX_SIZE # noqa: F401 from .python.spi import PandaSpiException, PandaProtocolMismatch, STBootloaderSPIHandle # noqa: F401 from .python.serial import PandaSerial # noqa: F401 @@ -8,3 +9,7 @@ # panda jungle from .board.jungle import PandaJungle, PandaJungleDFU # noqa: F401 + +INCLUDE_PATH = os.path.abspath( + os.path.join(os.path.dirname(os.path.realpath(__file__)), "../") +) \ No newline at end of file From c489c21d5e9ceb7b64a5b16810a7ca9fde074c37 Mon Sep 17 00:00:00 2001 From: prayansh_chhablani Date: Sun, 21 Sep 2025 10:38:31 +0530 Subject: [PATCH 4/9] add scons --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 202cf6c06f2..e6495482d70 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -33,7 +33,7 @@ dev = [ ] [build-system] -requires = ["setuptools>=61", "wheel", "pycryptodome >= 3.9.8"] +requires = ["setuptools>=61", "wheel", "pycryptodome >= 3.9.8", "scons"] build-backend = "setuptools.build_meta" [tool.setuptools] From 041da5b54f9d45e4fb523a986b59061ef2775980 Mon Sep 17 00:00:00 2001 From: prayansh_chhablani Date: Sun, 21 Sep 2025 10:46:00 +0530 Subject: [PATCH 5/9] remove scons --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index e6495482d70..202cf6c06f2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -33,7 +33,7 @@ dev = [ ] [build-system] -requires = ["setuptools>=61", "wheel", "pycryptodome >= 3.9.8", "scons"] +requires = ["setuptools>=61", "wheel", "pycryptodome >= 3.9.8"] build-backend = "setuptools.build_meta" [tool.setuptools] From b3f487c84131c79ba12a6fc4196beead6c30bf2f Mon Sep 17 00:00:00 2001 From: prayansh_chhablani Date: Sun, 21 Sep 2025 11:09:04 +0530 Subject: [PATCH 6/9] add opendbc --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 202cf6c06f2..42bda33b5de 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -33,7 +33,7 @@ dev = [ ] [build-system] -requires = ["setuptools>=61", "wheel", "pycryptodome >= 3.9.8"] +requires = ["setuptools>=61", "wheel", "pycryptodome >= 3.9.8", "scons", "opendbc @ git+https://github.com/commaai/opendbc.git@master#egg=opendbc",] build-backend = "setuptools.build_meta" [tool.setuptools] From 2a135f0e5c4a43b8904136d59507d29345b2c8ff Mon Sep 17 00:00:00 2001 From: prayansh_chhablani Date: Tue, 23 Sep 2025 13:22:21 +0530 Subject: [PATCH 7/9] fix lint opnepilot --- py.typed | 0 setup.py | 7 ++++++- 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 py.typed diff --git a/py.typed b/py.typed new file mode 100644 index 00000000000..e69de29bb2d diff --git a/setup.py b/setup.py index 3d616c0e4c7..9bed2dc4fdd 100644 --- a/setup.py +++ b/setup.py @@ -1,6 +1,6 @@ import os import subprocess -from setuptools import setup +from setuptools import setup, find_packages from setuptools.command.build import build as _build class build(_build): @@ -21,5 +21,10 @@ def run(self): super().run() setup( + name="pandacan", + version="0.0.10", + packages=find_packages(), cmdclass={"build": build}, + package_data={"panda": ["py.typed"]}, + zip_safe=False, ) \ No newline at end of file From c93a96abe3d0e9db0b7a580b11e4c53e4bb0cfea Mon Sep 17 00:00:00 2001 From: prayansh_chhablani Date: Thu, 25 Sep 2025 00:41:27 +0530 Subject: [PATCH 8/9] address comments --- MANIFEST.in | 6 ------ pyproject.toml | 13 ++++--------- setup.py | 11 ++++------- 3 files changed, 8 insertions(+), 22 deletions(-) delete mode 100644 MANIFEST.in diff --git a/MANIFEST.in b/MANIFEST.in deleted file mode 100644 index 03033c6b5d6..00000000000 --- a/MANIFEST.in +++ /dev/null @@ -1,6 +0,0 @@ -include SConstruct -include SConscript -recursive-include board * -recursive-include crypto * -recursive-include certs * -recursive-include tests * diff --git a/pyproject.toml b/pyproject.toml index 42bda33b5de..7c771a6fbe0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -33,7 +33,7 @@ dev = [ ] [build-system] -requires = ["setuptools>=61", "wheel", "pycryptodome >= 3.9.8", "scons", "opendbc @ git+https://github.com/commaai/opendbc.git@master#egg=opendbc",] +requires = ["setuptools>=61", "wheel", "pycryptodome >= 3.9.8"] build-backend = "setuptools.build_meta" [tool.setuptools] @@ -44,20 +44,15 @@ panda = "." [tool.hatch.build.targets.wheel] packages = ["src/panda"] -include = [ "include/**" -] +include = ["include/**"] [tool.hatch.build.targets.wheel.shared-data] "include" = "include" [tool.setuptools.package-data] panda = [ -"board/**/*.h", -"board/**/*.py", -"board/obj/**/*.bin", -"board/obj/**/*.elf", -"board/obj/**/*.bin.signed", -"python/**/*.py" + "board/**", + "python/**", ] [tool.mypy] diff --git a/setup.py b/setup.py index 9bed2dc4fdd..90af8de6a4b 100644 --- a/setup.py +++ b/setup.py @@ -3,23 +3,20 @@ from setuptools import setup, find_packages from setuptools.command.build import build as _build + class build(_build): def run(self): env = os.environ.copy() - env['FINAL_PROVISIONING'] = '1' project_root = os.path.abspath(os.path.dirname(__file__)) print("Building firmware with scons...") - subprocess.check_call( - ["scons", "-j4"], - cwd=project_root, - env=env - ) + subprocess.check_call(["scons", "-j4"], cwd=project_root, env=env) super().run() + setup( name="pandacan", version="0.0.10", @@ -27,4 +24,4 @@ def run(self): cmdclass={"build": build}, package_data={"panda": ["py.typed"]}, zip_safe=False, -) \ No newline at end of file +) From 08e0dd2efba09864572c2390197f99de025f9c96 Mon Sep 17 00:00:00 2001 From: prayansh_chhablani Date: Thu, 25 Sep 2025 01:05:02 +0530 Subject: [PATCH 9/9] add opendbc in requires --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 7c771a6fbe0..1ae5df8b249 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -33,7 +33,7 @@ dev = [ ] [build-system] -requires = ["setuptools>=61", "wheel", "pycryptodome >= 3.9.8"] +requires = ["setuptools>=61", "wheel", "pycryptodome >= 3.9.8", "scons", "opendbc @ git+https://github.com/commaai/opendbc.git@master#egg=opendbc"] build-backend = "setuptools.build_meta" [tool.setuptools]