From 81746484ae97dd970e1009e96eb9a5aafefef4e0 Mon Sep 17 00:00:00 2001 From: Carson-Shaar Date: Tue, 19 Sep 2023 16:47:24 -0400 Subject: [PATCH] GHA for publishing to PyPI --- .github/workflows/publish_docs.yml | 7 ---- .github/workflows/publish_package.yml | 50 +++++++++++++++++++++++++++ setup.cfg | 19 ++++++++++ setup.py | 20 ++--------- 4 files changed, 71 insertions(+), 25 deletions(-) create mode 100644 .github/workflows/publish_package.yml create mode 100644 setup.cfg diff --git a/.github/workflows/publish_docs.yml b/.github/workflows/publish_docs.yml index a6d54f0f..d221da98 100644 --- a/.github/workflows/publish_docs.yml +++ b/.github/workflows/publish_docs.yml @@ -10,14 +10,7 @@ permissions: pages: write id-token: write -# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. -# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. -concurrency: - group: "pages" - cancel-in-progress: false - jobs: - # Single deploy job since we're just deploying deploy: environment: name: github-pages diff --git a/.github/workflows/publish_package.yml b/.github/workflows/publish_package.yml new file mode 100644 index 00000000..df4e883d --- /dev/null +++ b/.github/workflows/publish_package.yml @@ -0,0 +1,50 @@ +name: Publish Package to PyPI + +on: + release: + types: [created] + +jobs: + build: + runs-on: ubuntu-latest + + steps: + + - name: Checkout code + uses: actions/checkout@v3 + + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: 3.9 + + - name: Build Package + run: | + pip install build + python -m build + + - name: Store the distribution packages + uses: actions/upload-artifact@v3 + with: + name: python-package-distributions + path: dist/ + + publish-to-pypi: + runs-on: ubuntu-latest + needs: + - build + environment: + name: pypi + url: https://pypi.org/p/zero-true + permissions: + id-token: write + + steps: + - name: Download all the dists + uses: actions/download-artifact@v3 + with: + name: python-package-distributions + path: dist/ + + - name: Publish distribution 📦 to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 \ No newline at end of file diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 00000000..448baadf --- /dev/null +++ b/setup.cfg @@ -0,0 +1,19 @@ +[metadata] +name = zero-true +description = A collaborative notebook built for data scientists +version = 0.0.dev0 + +[options] +packages = find: +install_requires = + fastapi + uvicorn + pydantic + toml + pytest + astroid + +[options.entry_points] +console_scripts = + zero-true = zt_cli.cli:start_servers + zero-true-dev = zt_dev_cli.cli:zt_cli \ No newline at end of file diff --git a/setup.py b/setup.py index be70bd43..fc1f76c8 100644 --- a/setup.py +++ b/setup.py @@ -1,19 +1,3 @@ -from setuptools import setup, find_packages +from setuptools import setup -# Read the contents of requirements.txt -with open('zt_backend/requirements.txt') as f: - requirements = f.read().splitlines() - -setup( - name='zero-true', - version='0.1', - packages=find_packages(), - install_requires=requirements, # Use the requirements read from the file - entry_points={ - 'console_scripts': [ - 'zero-true=zt_cli.cli:start_servers', - 'zero-true-dev=zt_dev_cli.cli:zt_cli', - ], - - } -) \ No newline at end of file +setup() \ No newline at end of file