Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
jerrrrry
infinicore
Commits
8f369f89
Commit
8f369f89
authored
Oct 13, 2025
by
Jiacheng Huang
Browse files
加入 `infinicore` Python 包的 editable 安装支持
parent
511aeb88
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
30 additions
and
20 deletions
+30
-20
python/infinicore/device.py
python/infinicore/device.py
+1
-1
python/infinicore/dtype.py
python/infinicore/dtype.py
+1
-1
python/infinicore/ops/matmul.py
python/infinicore/ops/matmul.py
+1
-2
python/infinicore/ops/rearrange.py
python/infinicore/ops/rearrange.py
+1
-2
python/infinicore/tensor.py
python/infinicore/tensor.py
+1
-2
setup.py
setup.py
+0
-11
xmake.lua
xmake.lua
+25
-1
No files found.
python/infinicore/device.py
View file @
8f369f89
from
.
import
_infinicore
from
infinicore.lib
import
_infinicore
class
device
:
class
device
:
...
...
python/infinicore/dtype.py
View file @
8f369f89
from
.
import
_infinicore
from
infinicore.lib
import
_infinicore
class
dtype
:
class
dtype
:
...
...
python/infinicore/ops/matmul.py
View file @
8f369f89
from
infinicore.lib
import
_infinicore
from
infinicore.tensor
import
Tensor
from
infinicore.tensor
import
Tensor
from
..
import
_infinicore
def
matmul
(
input
,
other
,
*
,
out
=
None
):
def
matmul
(
input
,
other
,
*
,
out
=
None
):
if
out
is
None
:
if
out
is
None
:
...
...
python/infinicore/ops/rearrange.py
View file @
8f369f89
from
infinicore.lib
import
_infinicore
from
infinicore.tensor
import
Tensor
from
infinicore.tensor
import
Tensor
from
..
import
_infinicore
def
rearrange
(
input
,
other
,
*
,
out
=
None
):
def
rearrange
(
input
,
other
,
*
,
out
=
None
):
if
out
is
None
:
if
out
is
None
:
...
...
python/infinicore/tensor.py
View file @
8f369f89
import
infinicore.device
import
infinicore.device
import
infinicore.dtype
import
infinicore.dtype
from
infinicore.lib
import
_infinicore
from
.
import
_infinicore
class
Tensor
:
class
Tensor
:
...
...
setup.py
View file @
8f369f89
import
glob
import
os
import
shutil
import
subprocess
import
subprocess
from
pathlib
import
Path
from
setuptools
import
setup
from
setuptools
import
setup
from
setuptools.command.build
import
build
from
setuptools.command.build
import
build
...
@@ -15,12 +11,5 @@ class Build(build):
...
@@ -15,12 +11,5 @@ class Build(build):
subprocess
.
run
([
"xmake"
,
"build"
,
"-y"
,
"_infinicore"
])
subprocess
.
run
([
"xmake"
,
"build"
,
"-y"
,
"_infinicore"
])
subprocess
.
run
([
"xmake"
,
"install"
,
"_infinicore"
])
subprocess
.
run
([
"xmake"
,
"install"
,
"_infinicore"
])
installation_dir
=
os
.
getenv
(
"INFINI_ROOT"
,
str
(
Path
.
home
()
/
".infini"
))
lib_dir
=
os
.
path
.
join
(
installation_dir
,
"lib"
)
lib_path
=
glob
.
glob
(
os
.
path
.
join
(
lib_dir
,
"_infinicore.*"
))[
0
]
package_dir
=
os
.
path
.
join
(
self
.
build_lib
,
"infinicore"
)
os
.
makedirs
(
package_dir
,
exist_ok
=
True
)
shutil
.
move
(
lib_path
,
package_dir
)
setup
(
package_dir
=
{
""
:
"python"
},
cmdclass
=
{
"build"
:
Build
})
setup
(
package_dir
=
{
""
:
"python"
},
cmdclass
=
{
"build"
:
Build
})
xmake.lua
View file @
8f369f89
...
@@ -347,7 +347,31 @@ target("_infinicore")
...
@@ -347,7 +347,31 @@ target("_infinicore")
add_files
(
"src/infinicore/op/*/*.cc"
)
add_files
(
"src/infinicore/op/*/*.cc"
)
add_files
(
"src/infinicore/pybind11/**.cc"
)
add_files
(
"src/infinicore/pybind11/**.cc"
)
set_installdir
(
os.getenv
(
"INFINI_ROOT"
)
or
(
os.getenv
(
is_host
(
"windows"
)
and
"HOMEPATH"
or
"HOME"
)
..
"/.infini"
))
set_installdir
(
"python/infinicore"
)
target_end
()
option
(
"editable"
)
set_default
(
false
)
set_showmenu
(
true
)
set_description
(
"Install the `infinicore` Python package in editable mode"
)
option_end
()
target
(
"infinicore"
)
set_kind
(
"phony"
)
set_default
(
false
)
add_deps
(
"_infinicore"
)
on_install
(
function
(
target
)
local
pip_install_args
=
{}
if
has_config
(
"editable"
)
then
table.insert
(
pip_install_args
,
"--editable"
)
end
os
.
execv
(
"python"
,
table
.
join
({
"-m"
,
"pip"
,
"install"
},
pip_install_args
,
{
"."
}))
end
)
target_end
()
target_end
()
-- Tests
-- Tests
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment