Skip to content

Commit

Permalink
Update package metadata (#2226)
Browse files Browse the repository at this point in the history
* Update package metadata

* address review
  • Loading branch information
ofek committed Sep 14, 2022
1 parent 1beb54a commit f43481c
Show file tree
Hide file tree
Showing 9 changed files with 75 additions and 59 deletions.
6 changes: 5 additions & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,14 @@ jobs:
command: |
sudo apt update
sudo apt install ffmpeg -y
- run:
name: Upgrade virtual environment tools
command: |
python -m pip install --upgrade pip virtualenv
- run:
name: Install Python deps in a venv
command: |
python -m venv venv
python -m virtualenv venv
. venv/bin/activate
bash scripts/install_gradio.sh
bash scripts/install_test_requirements.sh
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/deploy-pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,15 @@ jobs:
with:
python-version: '3.x'
- name: Check new pypi version
run: python scripts/check_pypi.py
run: python scripts/check_pypi.py
- name: Install pnpm
uses: pnpm/action-setup@v2.2.2
with:
version: 7
- name: Install pip
run: python -m pip install pip wheel
- name: Install build tool dependencies
run: python -m pip install build
- name: Build pypi package
run: |
run: |
export AWS_ACCESS_KEY_ID=${{ secrets.AWSACCESSKEYID }}
export AWS_SECRET_ACCESS_KEY=${{ secrets.AWSSECRETKEY }}
export AWS_DEFAULT_REGION=us-west-2
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/deploy-spaces.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ jobs:
with:
version: 7
- name: Install pip
run: python -m pip install pip wheel requests
run: python -m pip install build requests
- name: Get PR Number
run: |
python -c "import os;print(os.environ['GITHUB_REF'].split('/')[2])" > pr_number.txt
echo "PR_NUMBER=$(cat pr_number.txt)" >> $GITHUB_ENV
echo "GRADIO_VERSION=$(python -c 'import requests;print(requests.get("https://pypi.org/pypi/gradio/json").json()["info"]["version"])')" >> $GITHUB_ENV
- name: Build and publish pr package
run: |
run: |
export AWS_ACCESS_KEY_ID=${{ secrets.PR_DEPLOY_KEY }}
export AWS_SECRET_ACCESS_KEY=${{ secrets.PR_DEPLOY_SECRET }}
export AWS_DEFAULT_REGION=us-east-1
Expand All @@ -35,7 +35,7 @@ jobs:
pnpm i
pnpm build
cd ..
python3 setup.py bdist_wheel
python3 -m build -w
aws s3 cp dist/gradio-${{ env.GRADIO_VERSION }}-py3-none-any.whl s3://gradio-builds/${{ github.sha }}/
- name: Install Hub Client Library
run: pip install huggingface-hub==0.8.1
Expand Down
6 changes: 0 additions & 6 deletions MANIFEST.in

This file was deleted.

60 changes: 60 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
[build-system]
requires = ["hatchling", "hatch-requirements-txt", "hatch-fancy-pypi-readme>=22.5.0"]
build-backend = "hatchling.build"

[project]
name = "gradio"
dynamic = ["version", "dependencies", "readme"]
description = "Python library for easily interacting with trained machine learning models"
license = "Apache-2.0"
requires-python = ">=3.7"
authors = [
{ name = "Abubakar Abid", email = "team@gradio.app" },
{ name = "Ali Abid", email = "team@gradio.app" },
{ name = "Ali Abdalla", email = "team@gradio.app" },
{ name = "Dawood Khan", email = "team@gradio.app" },
{ name = "Ahsen Khaliq", email = "team@gradio.app" },
{ name = "Pete Allen", email = "team@gradio.app" },
{ name = "Ömer Faruk Özdemir", email = "team@gradio.app" },
]
keywords = ["machine learning", "reproducibility", "visualization"]

[project.scripts]
gradio = "gradio.reload:run_in_reload_mode"

[project.urls]
Homepage = "https://github.com/gradio-app/gradio"

[tool.hatch.version]
path = "gradio/version.txt"
pattern = "(?P<version>.+)"

[tool.hatch.metadata.hooks.requirements_txt]
filename = "requirements.txt"

[tool.hatch.metadata.hooks.fancy-pypi-readme]
content-type = "text/markdown"
fragments = [
{ path = "README.md" },
]

[[tool.hatch.metadata.hooks.fancy-pypi-readme.substitutions]]
pattern = "(website/homepage|readme_files)/"
replacement = 'https://raw.githubusercontent.com/gradio-app/gradio/main/\g<1>/'

[[tool.hatch.metadata.hooks.fancy-pypi-readme.substitutions]]
pattern = 'demo/([\S]*.gif)'
replacement = 'https://raw.githubusercontent.com/gradio-app/gradio/main/demo/\g<1>'

[tool.hatch.build]
artifacts = [
"/gradio/templates",
]

[tool.hatch.build.targets.sdist]
include = [
"/gradio",
"/test",
"/README.md",
"/requirements.txt",
]
2 changes: 1 addition & 1 deletion scripts/gh_action_pypi.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ cp gradio/templates/cdn/index.html gradio/templates/frontend/share.html

rm -r dist/*
rm -r build/*
python3 setup.py sdist bdist_wheel
python3 -m build
39 changes: 0 additions & 39 deletions setup.py

This file was deleted.

3 changes: 1 addition & 2 deletions website/demos/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ RUN pip install numpy matplotlib
WORKDIR /gradio
COPY ./gradio ./gradio
COPY ./requirements.txt ./requirements.txt
COPY ./setup.py ./setup.py
COPY ./MANIFEST.in ./MANIFEST.in
COPY ./pyproject.toml ./pyproject.toml
COPY ./README.md ./README.md
COPY ./test ./test
RUN pip install .
Expand Down
4 changes: 1 addition & 3 deletions website/homepage/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ RUN pnpm build:website
WORKDIR /gradio
COPY ./gradio ./gradio
COPY ./requirements.txt ./requirements.txt
COPY ./setup.py ./setup.py
COPY ./MANIFEST.in ./MANIFEST.in
COPY ./pyproject.toml ./pyproject.toml
COPY ./README.md ./README.md
COPY ./test ./test
RUN pip install .
Expand All @@ -42,4 +41,3 @@ RUN ASSETS_FILE=$(grep -oE index.[a-z0-9]+.js /gradio/gradio/templates/cdn/index
RUN cp /gradio/website/homepage/nginx.conf /etc/nginx/conf.d/default.conf

ENTRYPOINT ["nginx", "-g", "daemon off;"]

0 comments on commit f43481c

Please sign in to comment.