Skip to content

Commit

Permalink
chore: add action, update setup.py (#3)
Browse files Browse the repository at this point in the history
  • Loading branch information
hustcc authored Dec 19, 2023
1 parent f6468ff commit 2e54586
Show file tree
Hide file tree
Showing 4 changed files with 90 additions and 6 deletions.
31 changes: 31 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: build

on: [push]

jobs:
build:
runs-on: macOS-latest
strategy:
matrix:
python-version: [3.5, 3.6, 3.7, 3.8, 3.9]

steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8 pytest
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Lint with flake8
run: |
# any syntax error, break build
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test with pytest
run: |
pytest
6 changes: 5 additions & 1 deletion example/app.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
import streamlit as st
from streamlit_g2 import g2

st.set_page_config(page_title="streamlit-g2: AntV G2 for Streamlit!")

"""
# Welcome to [streamlit-g2](https://github.com/hustcc/streamlit-g2)!
In the meantime, below are some examples of what you can do with just a few lines of code:
[G2](https://github.com/antvis/G2) is a visualization grammar for dashboard building, data exploration and storytelling.
This project was created to allow us to render [G2](https://github.com/antvis/G2) charts in streamlit. In the meantime, below are some examples of what you can do with just a few lines of code:
"""

"""
Expand Down
55 changes: 50 additions & 5 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,64 @@
import setuptools
import io
import os
import sys
from shutil import rmtree
from setuptools import Command, find_packages, setup

setuptools.setup(
here = os.path.abspath(os.path.dirname(__file__))

class UploadCommand(Command):
description = "Build and publish the package."
user_options = []

@staticmethod
def status(s):
print("✨✨ {0}".format(s))

def initialize_options(self):
pass

def finalize_options(self):
pass

def run(self):
try:
self.status("Removing previous builds…")
rmtree(os.path.join(here, "dist"))
rmtree(os.path.join(here, "build"))
rmtree(os.path.join(here, "{0}.egg-info".format("streamlit_g2")))
except OSError:
pass

self.status("Building Source and Wheel distribution…")
os.system("{0} setup.py bdist_wheel".format(sys.executable))

self.status("Uploading the package to PyPI via Twine…")
os.system("twine upload dist/*")

sys.exit()

def read(*names, **kwargs):
return io.open(
os.path.join(os.path.dirname(__file__), *names),
encoding=kwargs.get("encoding", "utf8")
).read()

setup(
name="streamlit-g2",
version="0.0.6",
version="0.1.0",
author="hustcc",
author_email="[email protected]",
description="Render G2 charts in Streamlit",
long_description="Render G2 charts in Streamlit",
long_description=read('readme.md'),
long_description_content_type="text/plain",
keywords=["antv", "g2", "streamlit-component", "streamlit-g2"],
url="https://github.com/hustcc/streamlit-g2",
packages=setuptools.find_packages(),
packages=find_packages(),
include_package_data=True,
classifiers=[],
python_requires=">=3.6",
install_requires=[
"streamlit >= 0.63",
],
cmdclass={"upload": UploadCommand},
)
4 changes: 4 additions & 0 deletions tests/test_meta.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import pytest

def test_meta():
assert "1" == "1"

0 comments on commit 2e54586

Please sign in to comment.