Skip to content

Commit

Permalink
Merge pull request #265 from MannLabs/fix-release
Browse files Browse the repository at this point in the history
Simplified pyinstaller script
  • Loading branch information
GeorgWa authored Jul 5, 2024
2 parents d70d96e + 0770325 commit bb39a9c
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 51 deletions.
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
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

0 comments on commit bb39a9c

Please sign in to comment.