pip install library with pyd-files on Google App Engine - google-app-engine

When pip-installing the SFTP-lib paramiko I get multiple pyd-files and that don't work with my Google App Engine-dev_appserver.
I should be able to puzzle together a solution free from pyd, but I love how I can just delete and reinstall libraries with pip. I don't want to lose that. What options do I have?

Related

How to create simple React app without internet connection

I live in Ukraine, Kyiv. And due to the constant terrorist acts of russia, I very often have no electricity. However, there is a desire to learn React. But there is a dillema: How to create, view and deploy simple react app, because i know that
npm init vite
npm create-react-app
they all need internet connection to dowload data etc.
So how can i create local react app and when internet restores, publish it?
Probably codesandbox?
Really Hope the circumstances get better.
You don't need internet to develop in react, once you have installed all the npm dependencies. So whenever you have internet, just execute those commands and all the dependencies will be downloaded in a folder called node_modules.
Once that is complete, you can run npm start which will serve the app locally (without internet) on localhost:3000 and it will automatically open that url in a web browser.
But keep in mind, that if your app accesses a remote API or data, then you would need internet for that.
As soon as you have all the needed npm packages installed, you can develop local without the need of an internet connection. create-react-app also comes with a preconfigured local webserver server where your app gets deployed to by using npm start.
In addition, you can use Verdaccio. That is some sort of proxy/cache for npm. Once correct configured, it caches all used npm packages on your local machine. Then you can also create new react apps without the need of an internet connection.
Setting up Verdaccio is pretty straight forward.
All answers I've read are valid, but I want to contribute a bit. I'm the verdaccio maintainer so feel free to ask me more details via comments or asynchronously via GitHub discussions.
While you have internet you can use verdaccio (as already recommended) you can install packages through the proxy, verdaccio works by demand, so if you install npm create-react-app --registry http://localhost:4873 all packages will be in the local storage. The storage is just a folder that host all packages RAW that can be consumed offline with any package manager. Each packager manager has its own local cache, but is not sharable, but verdaccio can allow you that. If you suddenly lose internet the command npm create-react-app --registry http://localhost:4873 should still works without any issue, but if you need new packages (modify the package.json) you definitely need wait until get back online again.
The default behaviour should be good enough for your needs, but also there are plugins that can improve your experience like:
https://www.npmjs.com/package/verdaccio-offline-storage
If you need move your storage to another computer, you can use USB and just copy the storage folder (location might differ from OS you are using) zipped and just move it and install again in that computer.
The recommendation is always use proxy with all your projects while you are online and keep caching as much you can, there is now way to fetch in advance at this point but maybe in the future.
Verdaccio is maintained for many reasons, but the main one is to allow everyone keep learning Node.js/JavaScript independently of the lack of network access. Hopefully you can back to normality and circumstances get better, in the meantime feel free to ask follow up questions.

GAE: No longer able to update my Gaelyk project due to appcfg losing support

Recently tried to update my Gaelyk project (yes, it's old, but it works well and I still use it), but Google App Engine will no longer accept the update. The error message returned is "Deployments using appcfg are no longer supported. See https://cloud.google.com/appengine/docs/deprecations". The thing is, I never used appcfg to deploy my application; I used Gaelyk and Gradle. But obviously Gaelyk must have used appcfg under the covers.
I did download the replacement Google Cloud SDK, but this new tool is not similar at all to how Gaelyk and Gradle worked. Is there anything I can do to get Gaelyk to work anymore? Or is Gaelyk just dead and I need to rewrite my application (like in Node.js or something instead of Groovy).
This will be hard, however I will try to help you as possible. I think you may try to migrate it somehow to app.yaml configuration of GAE.
I am not sure what plugins are used in the project. From Gaelyk temple project I can see that it's using appengine-geb which, according to the documentation, behind the scenes, is using gradle-appengine-plugin (there is wrong link on this doc, but proper is bellow).
On the github of gradle-appengine-plugin I have found following.
There is a note:
NOTE: All App Engine users are encouraged to transition to the new
gradle plugin for their projects.
And in FAQ part there is following information:
How do I deploy with gcloud?
If you're using gcloud to deploy your application, the newest version of app deploy > doesn't support war
directories, you will need to provide it with an app.yaml OR you can
use the appengineStage task to create a directory that is deployable
in /build/staged-app
$ ./gradlew appengineStage
$ gcloud app deploy build/staged-app/app.yaml --project [app id]
--version [some version]
NOTES:
You must explicitly define all config files your want to upload
(cron.yaml, etc)
This does not work with EAR formatted projects.
I think the best option will be to migrate to new appenine plugin or if not possible try to implement is with gcloud app deploy command crating the config files manually (at least app.yaml). And for this migration I can provide you this document.
I hope you will manage somehow...
I can confirm that Serge's answer on the Gaelyk Groups site works; the same procedure that he figured out also worked for me. To summarize:
Run gradlew appengineRun as run previously with Gaelyk.
Copy all jar files inside the build\exploded-app\WEB-INF\lib folder into a \src\main\webapp\web-inf\lib folder (for me the new lib folder did not exist previously).
To deploy, use the new required gcloud tool, and instead of running gradlew appengineUpdate (which fails now), instead run
gcloud app deploy appengine-web.xml where that XML file can be found in your webapp/WEB-INF directory. I navigated to that directory to run the gcloud command, but you can use a relative path there if your working directory is elsewhere. (There are a number of optional flags associated with the gcloud app deploy command, but I didn't need any of them.)
Serge needed to use these instructions to convert datastore-indexes.xml to index.yaml and run gcloud app deploy index.yaml, however, I didn't need to do this because I had no datastores.

How do I find my Google App Engine SDK installation

I am following a tutorial (https://github.com/GoogleCloudPlatform/gradle-appengine-plugin) on using google app engine to deploy from gradle.
It say to point to your local installation of Google App Engine SDK. Except I don't really know how to find this, how would I find this?
You are following an older tutorial. Please use the new tutorial for the new gradle plugin as your point of reference. The new tutorial does not require this information.
In regards to your question location of the SDK, it depends on the Operating System.
You can run the command gcloud info which will detail about the installation. See Installation Properties for more details about the install path.

qpython not able to download requests module

I am using qpython for programming python on android.In my script I am importing requests module and so I have tp install requests module from pip.When I run pip install requests command I get the following error:
error build/lib.linux-armv71-2.7/requests/auth.py:operation not permitted qpython
I get this error twice while installing requests and so I am not being able to run my script.
You might need to manually download requests, extract and move it to your Lib/site-packages/Requests/ folder, from there python should be able to import from it. I don't see that package available for qpython, it might work out of the box or it might still need to be ported.
After installing qpython on my current device I was able to open the app, go to My QPython ->Scripts and use pip_console.py to try to install it but as you said it fails. I'm going to test later my above recommendation. My install directory is /sdcard/com.hipipal.qpyplus/lib/python2.7/site-packages/ and that is where I'm going to drop the requests library.
To run pip on qpython just use the steps below:
import pip
pip.main(['install', 'bs4'])
The above is to install bs4 for BeautifulSoup. Worked for me :)
The newest version ( 1.3.1 ) from google play has fixed this issue.
This solution did not work or me...but I did resolve it by downloading the new beta v2.1 from
https://github.com/qpython-android/qpython/releases
Google play did not give me the latest version (I had 1.xx)
I was able to use QPYPY to install requests and it automatically installed the required library urllib3.

How to get WeasyPrint working with Google App Engine

I'm new to GAE, WeasyPrint and Python. I realise that WeasyPrint relies on quite a few dependences. I have had a look at the install documentation for Windows. But I cant seem to figure out how I would get it working on GAE. Is there no way to download an version with all the dependencies included and just copy it to my project folder?
Its not possible to run WeasyPrint directly on appengine. You should always read the docs on the dependencies. WeasyPrint is dependent on cairo and pango which are 'c' based libs. You can only run pure python libraries that you supply. There are some directly supported python libraries that do have some 'c' that are supported like PIL and libxml. But that isn't enough for WeasyPrint.

Resources