Comments (2)
It does! Having this as the script file launching the actual script worked rather nicely :)
import os
import sys
import runpy
import site
import subprocess
from pathlib import Path
bin_dir = Path(os.environ["PYAPP"]).parent.absolute()
project_dir = bin_dir.parent
libs_dir = Path(bin_dir, "libs")
req_file = Path(project_dir, "requirements.txt")
libs_dir.mkdir(parents=True, exist_ok=True)
if len(os.listdir(libs_dir)) == 0:
print("Installing missing dependencies...")
cmd = [sys.executable, "-m", "pip", "install", "--target", libs_dir, "-r", req_file]
proc = subprocess.Popen(cmd, stdout=subprocess.DEVNULL, stderr=subprocess.PIPE, universal_newlines=True)
result = proc.communicate()[1]
if "ERROR:" in result:
print(result)
sys.exit()
site.ENABLE_USER_SITE = True
site.addsitedir(libs_dir)
site.addsitedir(bin_dir)
runpy.run_path("main.py", run_name="__main__")
from pyapp.
For the workaround you mentioned, does this suffice? https://ofek.dev/pyapp/latest/config/#installation-indicator
from pyapp.
Related Issues (20)
- After built with pyapp, pip install failed for hdbscan HOT 16
- Cache pyapp build on GHA
- Support for gui-scripts HOT 5
- Management command for deleting installation files HOT 9
- Missing glibc when building an app on ubuntu and running on centos HOT 1
- No network HOT 9
- Dependency file is not a file: ./requirements.txt HOT 10
- A potential manual solution to Monorepos with Path Dependencies HOT 2
- Can it be used to encrypt python projects? HOT 3
- Cannot use `PYAPP_DISTRIBUTION_PATH` (at least with locally embedded projects) HOT 5
- Notebook execution mode HOT 3
- Incorrect exit code HOT 4
- How to add `optional-dependencies` HOT 3
- Python version support - docs and code are inconsistent
- CPython 3.7 unaccessible from `x86_64` linux
- Build failure on Windows (whl METADATA containing CRLF) HOT 1
- Offline installation with local archive file
- can this lib work with streamlit? HOT 2
- PyApp with GUI program - disable console on Windows HOT 4
- Can not just copy binary to docker and run. HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pyapp.