Git Product home page Git Product logo

purplship's Introduction

Purplship

puprlship-tests License Codacy Badge

purplship is a multi-carrier shipping integartion platform.

purplship makes shipping services simple and accessible. Help us out… If you love open source and great software, give us a star! 🌟

Features

  • Multi-carrier SDK: Integrate purplship once and connect to multiple shipping carrier APIs
  • Extensible: Use the purplship SDK Framework to integrate with custom carrier APIs.
  • Headless shipping API: Power up your application with access to a network of carrier services.
  • Shipping: Connect carrier accounts, get live rates and purchase shipping labels.
  • Tracking: Create package tracker, get real time tracking status and provide a branded tracking page.
  • Address Validation: Validate shipping addresses using integrated 3rd party APIs.
  • Cloud: Optimized for deployments using Docker.
  • Dashboard: Use the purplship dashboard to orchestrate your logistics operations.

Purplship Dashboard

Try it now

There are several ways to use Purplship:

  • Purplship Cloud let's you use the fullset of shipping features. you don't need to deploy anything. We will manage and scale your infrastructure.
  • Purplship OSS is an open-source version of purplship that provides the core functionality of purplship (rating API, tracking API, shipping API), but lacks more advanced features (multi-tenant/orgs, shipping billing data, built-in address validation, etc.)
  • Purplship SDK is the core of the purplship abstraction layer. It can be installed as a simple set of python libraries to do the low level carrier integration yourself.

Source code for all editions is contained in this repository. See the License section for more details.

Status

  • Alpha: We are testing purplship with a closed set of customers
  • Public Alpha: Anyone can sign up over at cloud.purplship.com. But go easy on us, there are a few kinks
  • Public Beta: Stable enough for most non-enterprise use-cases
  • Public: Production-ready

We are currently in Public Alpha. Watch "releases" of this repo to get notified of major updates.

Self-hosted installation

Purplship OSS

check the latest version tags of the purplship/server image on Docker Hub

Using our Docker image
  • Start a Postgres database
docker run -d \
  --name db --rm \
  -e POSTGRES_DB=db \
  -e POSTGRES_USER=postgres \
  -e POSTGRES_PASSWORD=postgres \
  postgres
  • Run your shipping API
docker run -d \
  --name pship --rm \
  -e DEBUG_MODE=True \
  -e [email protected] \
  -e ADMIN_PASSWORD=demo \
  --link=db:db -p 5002:5002 \
  danh91.docker.scarf.sh/purplship/server:2021.11
Or using docker-compose
  • Create a docker-compose.yml file
version: '3'

services:
  db:
    image: postgres
    restart: unless-stopped
    environment:
      POSTGRES_DB: "db"
      POSTGRES_USER: "postgres"
      POSTGRES_PASSWORD: "postgres"
    networks:
      - db_network

  pship:
    image: danh91.docker.scarf.sh/purplship/server:2021.11
    restart: unless-stopped
    environment:
      - DEBUG_MODE=True
      - ALLOWED_HOSTS=*
      - [email protected]
      - ADMIN_PASSWORD=demo
      - DATABASE_NAME=db
      - DATABASE_HOST=db
      - DATABASE_PORT=5432
      - DATABASE_USERNAME=postgres
      - DATABASE_PASSWORD=postgres
    depends_on:
      - db
    networks:
      - db_network

volumes:
  pshipdb:
    driver: local

networks:
  db_network:
    driver: bridge
  • Run the application
docker-compose up

Purplship should now be running at http://0.0.0.0:5002

Default Login

email Password
[email protected] demo

Official Purplship Server Client Libraries

Use the swagger editor to generate any additional client with our OpenAPI References

Purplship SDK

Installation

# install purplship core
pip install purplship

# eg: install the purplship canadapost extention
pip install purplship.canadapost
Additional carrier extensions
  • purplship.aramex
  • purplship.australiapost
  • purplship.canadapost
  • purplship.canpar
  • purplship.dhl-express
  • purplship.dhl-poland
  • purplship.dhl-universal
  • purplship.dicom
  • purplship.fedex
  • purplship.purolator
  • purplship.royalmail
  • purplship.sendle
  • purplship.sf-express
  • purplship.tnt
  • purplship.ups
  • purplship.usps
  • purplship.usps-international
  • purplship.yanwen
  • purplship.yunexpress

Usage

Rates Fetching
  • Fetch shipping rates
import purplship
from purplship.core.models import Address, Parcel, RateRequest
from purplship.mappers.canadapost import Settings


# Initialize a carrier gateway
canadapost = purplship.gateway["canadapost"].create(
    Settings(
        username="6e93d53968881714",
        password="0bfa9fcb9853d1f51ee57a",
        customer_number="2004381",
        contract_id="42708517",
        test=True
    )
)

# Fetching shipment rates

# Provide the shipper's address
shipper = Address(
    postal_code="V6M2V9",
    city="Vancouver",
    country_code="CA",
    state_code="BC",
    address_line1="5840 Oak St"
)

# Provide the recipient's address
recipient = Address(
    postal_code="E1C4Z8",
    city="Moncton",
    country_code="CA",
    state_code="NB",
    residential=False,
    address_line1="125 Church St"
)

# Specify your package dimensions and weight
parcel = Parcel(
    height=3.0,
    length=6.0,
    width=3.0,
    weight=0.5,
    weight_unit='KG',
    dimension_unit='CM'
)

# Prepare a rate request
rate_request = RateRequest(
    shipper=shipper,
    recipient=recipient,
    parcels=[parcel],
    services=["canadapost_xpresspost"],
)

# Send a rate request using a carrier gateway
response = purplship.Rating.fetch(rate_request).from_(canadapost)

# Parse the returned response
rates, messages = response.parse()

print(rates)
# [
#     RateDetails(
#         carrier_name="canadapost",
#         carrier_id="canadapost",
#         currency="CAD",
#         transit_days=2,
#         service="canadapost_xpresspost",
#         discount=1.38,
#         base_charge=12.26,
#         total_charge=13.64,
#         duties_and_taxes=0.0,
#         extra_charges=[
#             ChargeDetails(name="Automation discount", amount=-0.37, currency="CAD"),
#             ChargeDetails(name="Fuel surcharge", amount=1.75, currency="CAD"),
#         ],
#         meta=None,
#         id=None,
#     )
# ]

Resources

Join us on Discord

License

This repository contains both OSS-licensed and non-OSS-licensed files. We maintain one repository rather than two separate repositories mainly for development convenience.

All files in the /insiders fall under the Purplship LICENSE.

The remaining files fall under the Apache 2 license. Purplship OSS is built only from the Apache-licensed files in this repository.

Any other questions, mail us at [email protected] We’d love to meet you!

purplship's People

Contributors

danh91 avatar jacobshilitz avatar rcknr avatar dependabot[bot] avatar gitter-badger avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.