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

Simplified pyinstaller script #265

Merged
merged 2 commits into from
Jul 5, 2024
Merged
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
4 changes: 0 additions & 4 deletions release/macos/build_backend_macos.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
# navigate to the root directory

# Creating the wheel
pip install git+https://github.com/huggingface/huggingface_hub.git
python -c "from huggingface_hub import get_full_repo_name; print('success')"

pip install build
python -m build
pip install "dist/alphadia-1.7.1-py3-none-any.whl[stable]"
Expand Down
57 changes: 13 additions & 44 deletions release/pyinstaller/alphadia.spec
Original file line number Diff line number Diff line change
Expand Up @@ -24,55 +24,24 @@ remove_tests = True
bundle_name = "AlphaDIA"
#####################

requirements = {
req.split()[0] for req in importlib.metadata.requires(project)
}
requirements.add(project)
requirements.add("distributed")
hidden_imports = {'transformers','huggingface_hub'}
datas = []
binaries = []
checked = set()

while requirements:
requirement = requirements.pop()
checked.add(requirement)
if requirement in ["pywin32"]:
continue
try:
module_version = importlib.metadata.version(requirement)
except (
importlib.metadata.PackageNotFoundError,
ModuleNotFoundError,
ImportError
):
continue
try:
datas_, binaries_, hidden_imports_ = PyInstaller.utils.hooks.collect_all(
requirement,
include_py_files=True
)
except ImportError:
continue
datas += datas_
# binaries += binaries_
hidden_imports_ = set(hidden_imports_)
if "" in hidden_imports_:
hidden_imports_.remove("")
if None in hidden_imports_:
hidden_imports_.remove(None)
requirements |= hidden_imports_ - checked
hidden_imports |= hidden_imports_
datas, binaries, hidden_imports = PyInstaller.utils.hooks.collect_all(
project,
include_py_files=True
)

if remove_tests:
hidden_imports = sorted(
[h for h in hidden_imports if "tests" not in h.split(".")]
alpha_x = ['alphabase', 'alpharaw','alphatims','peptdeep']
for alpha_package in alpha_x:
_datas, _binaries, _hidden_imports = PyInstaller.utils.hooks.collect_all(
alpha_package,
include_py_files=True
)
else:
hidden_imports = sorted(hidden_imports)
datas+=_datas
binaries+=_binaries
hidden_imports+=_hidden_imports

hidden_imports = list(set(hidden_imports) & {'clr','rocket_fft','tokenizers'})
hidden_imports = [h for h in hidden_imports if "__pycache__" not in h]
hidden_imports += ['clr', 'alphabase', 'alpharaw','alphatims','rocket_fft']
datas = [d for d in datas if ("__pycache__" not in d[0]) and (d[1] not in [".", "Resources", "scripts"])]

a = Analysis(
Expand Down
3 changes: 0 additions & 3 deletions release/windows/build_backend.ps1
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
Remove-Item -Recurse -Force -ErrorAction SilentlyContinue ./build
Remove-Item -Recurse -Force -ErrorAction SilentlyContinue ./dist

pip install git+https://github.com/huggingface/huggingface_hub.git
GeorgWa marked this conversation as resolved.
Show resolved Hide resolved
python -c 'from huggingface_hub import get_full_repo_name; print("success")'

pip install build
python -m build
pip install "dist/alphadia-1.7.1-py3-none-any.whl[stable]"
Expand Down
Loading