-
Notifications
You must be signed in to change notification settings - Fork 5
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
How to use libsass with boussole through a single python process? #46
Comments
It seems a problem with threads and popen usage. Boussole stands on watchdog for the watch mode and it did have some issues with this kind of usage. As i know, Boussole don't keep any unclosed files and i never tried to use Boussole in the same way you did. Maybe you could try to directly use the watchdog script "watchmedo" with "boussole compile ..." to see if it changes anything. If the issue is still the same, it probably comes from watchdog, else it the issue does not appear anymore this should be a bug from Boussole. As for now i don't have any idea of a solution yet, let me know if you found something new. |
I forget to advise that with the watchmedo + boussole compile, obviously you will have to define yourself the sources to watch, which is not as efficient than the boussole watch that make some smart inspection about source inheritance. |
Hi and thanks @sveetch for your fast reply, it is well appreciated ! I am not sure we use watchdog in our project and I am afraid to propose to add new library for this purpose, I already had to negotiate to get libsass and boussole :D This seems like a common use case for webpack dev server, I was expecting to get the same experience in python development, but if I understand right, your advice is to run boussole along the python process? This is actually the fix I was thinking of, but I hope there was a way or fix that could avoid that extreme solution. |
Watchdog itself is a requirement from Boussole so if you have Boussole installed you already got watchdog. However the solution i was giving use an extra dependency from watchdog (called watchmedo) so it may not fit to your constraints. Honestly i don't know what is going on with your script, i looked at your exceptions and the ImportError does not really seems to involve a PID problem, but you truncated the stacktrace so i can't trace from where it is happening. I never used watch mode through a subprocess so i can ensure this is related or not to watchdog, as fas as i know Boussole is not playing with imports, process or threads. |
Hello, I just opened a pull request to remove this features, but before mergin, I'd like to know stacktrace I can give you to help your further. This is how my console look like: /home/dka/workspace/github.com/pass-culture/pass-culture-main/api/env/bin/python /srv/pycharm-2022.3.3/plugins/python/helpers/pydev/pydevd.py --module --multiprocess --qt-support=auto --client 127.0.0.1 --port 45975 --file pcapi.backoffice_app
warning: PYDEVD_USE_CYTHON environment variable is set to 'NO'. Frame evaluator will be also disabled because it requires Cython extensions to be enabled in order to operate correctly.
Connected to pydev debugger (build 223.8836.43)
💅 Scss compiler attached and watching, enjoy styling 💅
* Serving Flask app 'pcapi.flask_app' (lazy loading)
* Environment: production
WARNING: This is a development server. Do not use it in a production deployment.
Use a production WSGI server instead.
* Debug mode: on
warning: PYDEVD_USE_CYTHON environment variable is set to 'NO'. Frame evaluator will be also disabled because it requires Cython extensions to be enabled in order to operate correctly.
Traceback (most recent call last):
File "/usr/local/lib/python3.10/shutil.py", line 713, in rmtree
ImportError: sys.meta_path is None, Python is likely shutting down
warning: PYDEVD_USE_CYTHON environment variable is set to 'NO'. Frame evaluator will be also disabled because it requires Cython extensions to be enabled in order to operate correctly.
Traceback (most recent call last):
File "/usr/local/lib/python3.10/shutil.py", line 713, in rmtree
ImportError: sys.meta_path is None, Python is likely shutting down
warning: PYDEVD_USE_CYTHON environment variable is set to 'NO'. Frame evaluator will be also disabled because it requires Cython extensions to be enabled in order to operate correctl How should I give you more verbose logs ? |
I don't know for the verbose logs, commonly a traceback is longer that yours, but it does not seems there is more to see. Whatever, i've just seen the exception comes from usage of I think your problem is higher level in your script or else, but searching for rmtree in your code and its requirements could help you to find the real cause. |
Our repository is public : https://github.com/pass-culture/pass-culture-main
I can only disagree as this problem started when I added subprocess boussole from our python app, and goes away as soon as I remove this subprocess from boussole. This bug also happen while we just edit html or py code (we reload our flask service on .py edition), it's not just only while editing scss, but it was working fine before, and it work fine if we do not run boussole from py, perhaps this could be a reason. |
I'll close the issue as I am in the process to revert this feature. Thanks for helping ! |
Describe the bug
I have written the following function in
python
that usepython-libsass
to preprocesssass
on runtime inproduction
, and in development, that watch for change usingboussole
.This work well for production, however, with boussole it watch for change, but I keep having my python process crashing with :
I already took caution not to rerun the process when I have the flask hotreload on
*.py
edition by clearing the previous subprocess on restart. I checked and I only have one process running all the time.It work fine when I do not run the boussole subprocess with python.
This is my
boussole.yml
configuration:Environment
Describe your environment:
To Reproduce
Expected behavior
I expect boussole to watch for change without error
Additional context
NA
The text was updated successfully, but these errors were encountered: