How to make a portable Pyramid application - pyramid

I'm starting a Pyramid application on OSX which will eventually be deployed on Ubuntu. The application will need packages such as boto and pymongo. What do I need to do to make the application easy to deploy on Ubuntu?

Just follow any of the tutorials pyramid provides using scaffolds either on OSX and on Ubuntu. This will show you how pyramid application requirements are managed. It is abstracted by defining requirements in setup.py or requirement.txt for example.
SQLAlchemy + URL Dispatch Wiki Tutorial
ZODB + Traversal Wiki Tutorial
Really, all you need to start to be productive with pyramid is here
Getting Started
After finishing your application you may distribute a source distribution/archive (*.tar.gz)
Distribute your application
Install your application on Ubuntu with pip and pass the path to your local source archive. You need to install your package into development mode either using pip or setuptools. Below you will find the --editable option from pip:
$ pip install --help
Usage:
pip install [options] <requirement specifier> ...
pip install [options] -r <requirements file> ...
pip install [options] [-e] <vcs project url> ...
pip install [options] [-e] <local project path> ...
pip install [options] <archive url/path> ...
Description:
Install packages from:
- PyPI (and other indexes) using requirement specifiers.
- VCS project urls.
- Local project directories.
- Local or remote source archives.
pip also supports installing from "requirements files", which provide
an easy way to specify a whole environment to be installed.
Install Options:
-e, --editable <path/url> Install a project in editable mode (i.e.
setuptools "develop mode") from a local project
path or a VCS url.
I recommend to use virtualenv to isolate your work on any platform.

Related

How to install github python files which pip installation is not provided?

I want to install https://github.com/opendoor-labs/pyfin package in windows 10, but no pip installation method is provided in the page. I use vs-code python-3.9.10 and all my libraries are installed in a virtual environment. The git address of all files is https://github.com/opendoor-labs/pyfin.git. but I don't know how to download and install directly to the (venv). Is there any easy way to install and import it to my code? I tried 'pip install pyfin', but it installed other library included in this page : https://pypi.org/project/pyfin/ which is different.
First activate your venv.
(activate it using the .\venv\Scripts\activate command.)
The run pip install git+https://github.com/your/repo

Using user's dir to store copied python3 packages

I'm defining an update procedure on the air-gapped standalone RedHat7 server with the preinstalled python3 and
basic packages.
The python3 applications are developed on a host with an Internet access, and are delivered to this standalone
server using DOK.
Additional packages can't be installed using pip, but must be trasfered from development host to the local user's home directory.
I'm looking for a proper way to update and activate python3 applications on this standalone server, without appending a new package path using sys.path.append("/home/user/packages/pack_N") before importing it.
Thanks
Zeev
I'm assuming you meant without using "PyPi".
Downloading the packages can be done with pip wheel <package> after installing the wheel package.
Installing them locally without using pip's servers (PyPi) can be done like so:
pip install <package> --no-index --find-links=<directory containing wheels>

How to install dltpy library via python anaconda

I'm developing an application via spyder that can read and convert dlt files into a txt extension file, therefore I need to add dltpy library to spyder
I found a site https://pypi.org/project/dltpy/ in which it provided commands( you'll find below) to install the "dltpy" library. however, I wasn't I able to install it via anaconda.
INSTALLATION:
git clone git+https://github.com/Equidamoid/dltpy
(cd dltpy; git checkout native-dltreader)
pip install --user ./dltpy
Is it possible to install a github library into spyder?
Thank you for your help.

Python Packages Installation from local directory

There is a need to install python packages on machine without internet connection
I used pip download to download the packages and their dependencies
I copied all the dependencies to the offline machine
I run pip from the local python packages repository using
pip install *
package with dependencies are trying to access the internet to download their dependencies even that they are locate in the same directory
I would like to avoid the requirement.txt file and would like it to install all the packages from the local directory with their dependencies.
Is there any way to do so?
It's possible to download the wheels directly for each package, and once you have them on the machine you can run pip install name-of-wheel.whl and it will install them without routing to pypi.
You can use on the online machine:
pip download -r requirements.txt
to download package without installing them.
Then, on the offline machine:
pip install --no-index --find-links /path/to/download/dir/ -r requirements.txt
Source: Python Packages Offline Installation

Making setup.py to point to local pypi repository

recently i found pip2pi, which is super useful to install pip package from local pypi repo. I just followed the post here to do that http://blog.nknj.me/python-guide-to-hacking-on-an-airplane
But when I use setup tools, requires, I do not know how I can make it to use my local repo. I do not want to download the packages each time when i run "python setup.py develop". I am getting started with pyramid, and it will be helpful if i can avoid downloading packages everytime i create a new virtualenv.
Thanks in advance
Here is workaround:
$ python setup.py egg_info
The command above creates a directory {PackageName}.egg-info and places requires.txt file into one, but downloads nothing. So you can use requires.txt file with pip command to install dependencies:
$ pip install -r {PackageName}.egg-info/requires.txt --index-url=file:///path/to/local/repo
After that, you can install your application without access to the internet:
$ python setup.py develop

Resources