create a new directory for the application and run python -m brython --install
to install the basic Brython files (brython.js, brython_stdlib.js)
the developer writes HTML pages and Python scripts for the application
the new command-line option python -m brython --make_dist
executes the following tasks :
__dist__
<script src="/path/to/brython/brython_stdlib.js">
is replaced by <script src="/path/to/brython/brython_modules.js">
--make_dist
is runfrom the __dist__ subdirectory, running python setup.py sdist
and python setup.py install
installs the package myapp
. This is done manually in case the developer wishes to edit or add information in setup.py. The package is an ordinary Python package and can be distributed through PyPI and pip.
running python -m myapp --install
installs the application files (HTML pages, brython.js, brython_modules.js, Python scripts, etc.) in an empty directory
> python -m brython --install
Installing Brython in an empty directory
Traceback (most recent call last):
File "/usr/lib/python3.4/runpy.py", line 170, in _run_module_as_main
"__main__", mod_spec)
File "/usr/lib/python3.4/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/home/me/venvs/myproject/lib/python3.4/site-packages/brython-3.3.3-py3.4.egg/brython.py", line 40, in <module>
shutil.copyfile(os.path.join(src_path, path), path)
File "/home/me/venvs/myproject/lib/python3.4/shutil.py", line 108, in copyfile
with open(src, 'rb') as fsrc:
FileNotFoundError: [Errno 2] No such file or directory: '/home/me/venvs/myproject/lib/python3.4/site-packages/brython-3.3.3-py3.4.egg/data/brython.js'
Great job Pierre! It looks promising.I just tried this new process and got an error at the third command:
> python -m brython --install
Installing Brython in an empty directory
Traceback (most recent call last):
File "/usr/lib/python3.4/runpy.py", line 170, in _run_module_as_main
"__main__", mod_spec)
File "/usr/lib/python3.4/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/home/me/venvs/myproject/lib/python3.4/site-packages/brython-3.3.3-py3.4.egg/brython.py", line 40, in <module>
shutil.copyfile(os.path.join(src_path, path), path)
File "/home/me/venvs/myproject/lib/python3.4/shutil.py", line 108, in copyfile
with open(src, 'rb') as fsrc:
FileNotFoundError: [Errno 2] No such file or directory: '/home/me/venvs/myproject/lib/python3.4/site-packages/brython-3.3.3-py3.4.egg/data/brython.js'The brython.js file doesn't exist.Ben
- Pierre
For those who don't follow the discussion on Github issue #491, here is a new proposal for the distribution and deployment of an application written in Brython.