Skip to main content

A Flask extension for Shopify app development

Project description

Flask-Shopify-Utils

Python 3.9 Python 3.10 Python 3.11 Python 3.12 Python 3.13

The utils for Flask Application that build for Shopify Custom App


Installing

$pip install -U flask-shopify-utils

Get the sample code to start

After install the "flask-shopify-utils", you should get the sample code by running the following command.

$lazy-dog

Example / How to ...

Please check the example folder for more details.

Remember, this package is using Flask-SQLAlchemy, so you need to initialize the database first.

from flask import Flask
from flask_sqlalchemy import SQLAlchemy
from flask_shopify_utils import ShopifyUtil

app = Flask(__name__)
# Init Database
db = SQLAlchemy()
db.init_app(app)

# Initial Shopify Utils
utils = ShopifyUtil()
utils.init_app(app)

# example: register default routes
utils.enroll_default_route()

Donate

Well, I have no idea how this work, just copy it from somewhere.

The Pallets organization develops and supports Flask and the libraries it uses. In order to grow the community of contributors and users, and allow the maintainers to devote more time to the projects, please donate today


First time setup

  • Download the repository to your local machine.
  • Create a virtualenv.
# Linux/macOS
$ python3 -m venv env
$ . env/bin/active

# Window
$ py -3 -m venv env
$ env/Scripts/active
  • Install pip-tools, twine and build in the virtualenv.
>pip install --upgrade pip
>pip install pip-tools twine build
  • Install the development dependencies, then install Flask-ShopifyUtils in editable mode.
$ pip install -r requirements/dev.txt && pip install -e .
  • Build the wheel
# new 
>python -m build
# For more reference https://blog.ganssle.io/articles/2021/10/setup-py-deprecated.html
  • Deploy to PyPI
# check
>twine check dist/*
# upload
>twine upload dist/* --skip-existing

requirements.txt

All dependencies are managed by pip-tools, so you need to install it first. And you can find them from the requirements folder.

# development
>pip-compile --extra=dev --output-file=requirements/dev.txt pyproject.toml

# production
>pip-compile --output-file=requirements/index.txt pyproject.toml

Check the code format

>flake8

Running the tests

Make sure you had installed the repository locally.

# install the package
>pip install -e .
# install the pytest
>pip install pytest
# run all tests
>pytest
# run tests with output
>pytest -s
# run specific test
>pytest -vs tests/test_init.py
# run specific test case
>pytest -vs tests/test_init.py::test_init_app

Reference

Packing for Python

TODO

[] - Optimize the get_version for "unstable" [] - Add CLI for "query_shopify_functions" [] - Add test for ShopifyUtil methods [] - Optimize the Graphql fetch method (don't raise exception) [] - Can I create the abs base class? for 'utils/base.py'

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

flask_shopify_utils-0.2.7.tar.gz (16.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

flask_shopify_utils-0.2.7-py3-none-any.whl (17.3 kB view details)

Uploaded Python 3

File details

Details for the file flask_shopify_utils-0.2.7.tar.gz.

File metadata

  • Download URL: flask_shopify_utils-0.2.7.tar.gz
  • Upload date:
  • Size: 16.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.16

File hashes

Hashes for flask_shopify_utils-0.2.7.tar.gz
Algorithm Hash digest
SHA256 3165a483761aaca9250d1939b7f26914305a392a02bb67371c5db962e5a16e32
MD5 c0e44c0eff0e7a5c1a4abfd0a74d59d1
BLAKE2b-256 ba171d39f2f6e4527a241a92dc1c4855ed5e625ba37865ee748231359490f7ea

See more details on using hashes here.

File details

Details for the file flask_shopify_utils-0.2.7-py3-none-any.whl.

File metadata

File hashes

Hashes for flask_shopify_utils-0.2.7-py3-none-any.whl
Algorithm Hash digest
SHA256 4169bf1243fcb556f4f7fcc7103b52060be6c8b3581c539343d4481f68c55eae
MD5 dddcaf5d75af9cdc85f9dfe5fa07d82b
BLAKE2b-256 5144ffa1bfc149d0b97de400b1bbce9989411396dca4ec62ae71cc3a232e5164

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page