Micro framework for SOA based applications.
Drift is a high level web framework to implement REST based web services and contains tools for deployment, operation and total lifecycle management of those services.
This library is not installed directly. (WORK IN PROGRESS).
The following instructions are for setting up your workstation for local development.
You need to have pipenv, PostgreSQL and Redis installed.
pip install --user pipenv
brew install postgresql
brew install redispip install --user pipenv
sudo apt-get update
sudo apt-get install postgresql postgresql-contrib
sudo apt-get install redis-serverpip install pipenv
# Install and run Redis server
choco install redis-64
redis-server
# Install and run PostgreSQL server
choco install postgresql # When prompted for pwd, specify 'postgres'.Drift assumes a default password of postgres for the database superuser. The default install on Linux typically uses an empty one. To set a password:
sudo -u postgres psql postgres
postgres=# \\password postgres
(set password to 'postgres')
postres=# \\qThis module can be tested on its own, but it requires the drift-config project as a dependency.
Assuming that drift-config has been cloned to the same level as this one, do the following to create a virtualenv:
pipenv --two # or --three
pipenv install -e "../drift-config[s3-backend,redis-backend]"
pipenv install -e ".[aws,test]"This creates a Pipfile and a Pipfile.lock for local development.
You can now run unittests, e.g. by running pipenv run python -m unittest discover
If you want to switch to a different version of Python remove the Pipfile entirely and re-do the above steps with the appropriate switch for python version.
You may also need to remove .pyc files, e.g. with a command such as:
find . -name "*.pyc" -exec rm "{}" ";"Drift comes with some base services in a project called drift-base. Here is an example of how to set up that project for local development. The same method applies for all other Drift based projects.
# Get the drift-base project from Github
git clone https://github.com/dgnorth/drift-base.git
cd drift-base
# Set up virtual environment and install dependencies
pipenv install --dev
# Activate the virtualenv and set up local development environment
pipenv shell
dconf developerIt's very convenient to refresh the local environment and run a server in one go. (Just make sure the virtualenv is active):
dconf developer --runDrift is a Pypi package which is released here: https://pypi.org/project/python-drift/
To create a new release simply add a git tag with a semantic version. The GitHub Actions process will create a new build and upload it to Pypi.
The following command will tag the latest commit on the current branch and create a new pypi package.
git tag 1.0.1
git push --tagsAfter a few minutes the package should be built and uploaded. You can now run the following command in services which depend on drift:
pipenv updateThis will update the drift package to the latest version in that service.
The project is generously supported by a grant from the Icelandic Technology Development Fund.
