Skip to content

Commit

Permalink
Merge branch 'main' into feature/support-markdown
Browse files Browse the repository at this point in the history
  • Loading branch information
souzatharsis authored Oct 28, 2024
2 parents 7428cfe + caa56e3 commit 0029598
Show file tree
Hide file tree
Showing 33 changed files with 1,165 additions and 474 deletions.
18 changes: 18 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
.git
.gitignore
.github
__pycache__
*.pyc
*.pyo
*.pyd
.Python
env/
venv/
.env
*.log
.pytest_cache/
.coverage
htmlcov/
dist/
build/
*.egg-info/
90 changes: 90 additions & 0 deletions .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
name: Docker

on:
push:
branches: [ "main" ]
tags: [ 'v*.*.*' ]
paths:
- 'podcastfy/**'
- 'setup.py'
- 'requirements.txt'
- 'Dockerfile'
- 'Dockerfile.dev'
- '.github/workflows/docker-publish.yml'
pull_request:
branches: [ "main" ]
paths:
- 'podcastfy/**'
- 'setup.py'
- 'requirements.txt'
- 'Dockerfile'
- 'Dockerfile.dev'
- '.github/workflows/docker-publish.yml'

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.CR_PAT }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}

# Build and push PyPI version with caching
- name: Build and push PyPI Docker image
uses: docker/build-push-action@v5
with:
context: .
file: Dockerfile
push: true
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha,scope=prod
cache-to: type=gha,scope=prod,mode=max

# Build and push development version with caching
- name: Build and push development Docker image
uses: docker/build-push-action@v5
with:
context: .
file: Dockerfile.dev
push: true
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:dev
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha,scope=dev
cache-to: type=gha,scope=dev,mode=max

- name: Test Docker images
env:
GEMINI_API_KEY: ${{ secrets.GEMINI_API_KEY }}
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
run: |
# Test PyPI version
docker pull ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
docker run --rm ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest python3 -c "import podcastfy"
# Test development version
docker pull ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:dev
docker run --rm ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:dev python3 -c "import podcastfy"
6 changes: 2 additions & 4 deletions .github/workflows/python-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,8 @@ on:
- 'setup.py'
- '.github/workflows/**'
- 'pyproject.toml'

permissions:
contents: read

jobs:
build:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -51,7 +49,7 @@ jobs:
run: |
set -e
. /opt/venv/bin/activate
pip install flake8 pytest
pip install flake8 pytest pytest-xdist
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Check versions and list packages
run: |
Expand Down Expand Up @@ -80,7 +78,7 @@ jobs:
run: |
set -e
. /opt/venv/bin/activate
pytest
pytest -n auto --dist loadfile
- name: Upload test artifacts
uses: actions/upload-artifact@v3
with:
Expand Down
37 changes: 37 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Use Ubuntu 24.04 as base image
FROM ubuntu:24.04

# Prevent interactive prompts during package installation
ENV DEBIAN_FRONTEND=noninteractive

# Install system dependencies
RUN apt-get update && \
apt-get install -y \
python3-full \
python3-pip \
ffmpeg \
&& rm -rf /var/lib/apt/lists/*

# Create and activate virtual environment
RUN python3 -m venv /opt/venv
ENV PATH="/opt/venv/bin:$PATH"

# Upgrade pip
RUN python3 -m pip install --upgrade pip

# Install podcastfy from PyPI
RUN pip install --no-cache-dir podcastfy

# Set environment variables
ENV PYTHONUNBUFFERED=1

# Verify installations
RUN echo "Verifying installations:" && \
echo "Ubuntu version:" && cat /etc/os-release && \
echo "FFmpeg version:" && ffmpeg -version && \
echo "Python version:" && python3 --version && \
echo "Pip version:" && pip --version && \
echo "Installed packages:" && pip list

# Command to run when container starts
CMD ["python3"]
60 changes: 60 additions & 0 deletions Dockerfile.dev
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# Use Ubuntu 24.04 as base image to match CI environment
FROM ubuntu:24.04

# Prevent interactive prompts during package installation
ENV DEBIAN_FRONTEND=noninteractive

# Set working directory
WORKDIR /app

# Install system dependencies matching CI configuration
RUN apt-get update && \
apt-get install -y \
python3-full \
python3-pip \
python3-venv \
ffmpeg \
&& rm -rf /var/lib/apt/lists/*

# Create and activate virtual environment
RUN python3 -m venv /opt/venv
ENV PATH="/opt/venv/bin:$PATH"

# Upgrade pip
RUN python3 -m pip install --upgrade pip

# Install testing and linting dependencies
RUN pip install --no-cache-dir \
flake8 \
pytest \
pytest-xdist

# Copy requirements first to leverage Docker cache
COPY requirements.txt .

# Install Python dependencies
RUN pip install --no-cache-dir -r requirements.txt

# Copy the package files
COPY . .

# Install the package in editable mode
RUN pip install -e .

# Set environment variables
ENV PYTHONUNBUFFERED=1

# Verify installations
RUN echo "Verifying installations:" && \
echo "Ubuntu version:" && cat /etc/os-release && \
echo "FFmpeg version:" && ffmpeg -version && \
echo "Python version:" && python3 --version && \
echo "Pip version:" && pip --version && \
echo "Installed packages:" && pip list

# Run flake8 checks during build
RUN flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics && \
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics

# Command to run when container starts
CMD ["python3"]
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ lint:
mypy podcastfy/*.py

test:
python3 -m pytest tests
poetry run pytest -n auto

doc-gen:
sphinx-apidoc -f -o ./docs/source ./podcastfy
Expand Down
7 changes: 7 additions & 0 deletions NOTICE
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Podcastfy
Copyright 2024 Tharsis T. P. Souza
------------------------
This product includes software developed by:
Tharsis T. P. Souza (www.souzatharsis.com) and all of the great contributors listed at https://github.com/souzatharsis/podcastfy/graphs/contributors.
------------------------
The text of the Apache License, Version 2.0 can be found in the LICENSE file.
13 changes: 10 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@
[![Downloads](https://pepy.tech/badge/podcastfy)](https://pepy.tech/project/podcastfy)
[![Issues](https://img.shields.io/github/issues-raw/souzatharsis/podcastfy)](https://github.com/souzatharsis/podcastfy/issues)
[![Pytest](https://github.com/souzatharsis/podcastfy/actions/workflows/python-app.yml/badge.svg)](https://github.com/souzatharsis/podcastfy/actions/workflows/python-app.yml)
[![Docker](https://github.com/souzatharsis/podcastfy/actions/workflows/docker-publish.yml/badge.svg)](https://github.com/souzatharsis/podcastfy/actions/workflows/docker-publish.yml)
[![Documentation Status](https://readthedocs.org/projects/podcastfy/badge/?version=latest)](https://podcastfy.readthedocs.io/en/latest/?badge=latest)
[![License: CC BY-NC-SA 4.0](https://img.shields.io/badge/License-CC%20BY--NC--SA%204.0-lightgrey.svg)](https://creativecommons.org/licenses/by-nc-sa/4.0/)
[![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
![GitHub Repo stars](https://img.shields.io/github/stars/souzatharsis/podcastfy)


Expand All @@ -17,7 +18,7 @@ https://github.com/user-attachments/assets/f1559e70-9cf9-4576-b48b-87e7dad1dd0b

Podcastfy is an open-source Python package that transforms multi-modal content (text, images) into engaging, multi-lingual audio conversations using GenAI. Input content include websites, PDFs, YouTube videos, images, and Markdown files.

Unlike UI-based tools focused primarily on note-taking or research synthesis (e.g. NotebookLM ❤️), Podcastfy focuses on the programmatic and bespoke generation of engaging, conversational transcripts and audio from a multitude of multi-modal sources enabling customization and scale.
Unlike UI-based tools focused primarily on note-taking or research synthesis (e.g. NotebookLM ❤️), Podcastfy focuses on the programmatic and bespoke generation of engaging, conversational transcripts and audio from a multitude of multi-modal sources, enabling customization and scale.

[![Star History Chart](https://api.star-history.com/svg?repos=souzatharsis/podcastfy&type=Date&theme=dark)](https://api.star-history.com/svg?repos=souzatharsis/podcastfy&type=Date&theme=dark)

Expand Down Expand Up @@ -102,17 +103,23 @@ python -m podcastfy.client --url <url1> --url <url2>

- [CLI](usage/cli.md)

- [Docker Image](usage/docker.md)

- [How to](usage/how-to.md)

Experience Podcastfy with our [HuggingFace](https://huggingface.co/spaces/thatupiso/Podcastfy.ai_demo) 🤗 Spaces app for a simple URL-to-Audio demo. (Note: This UI app is less extensively tested and capable than the Python package.)

## Customization 🔧

Podcastfy offers a range of customization options to tailor your AI-generated podcasts:
- Customize podcast [Conversation](usage/conversation_custom.md) (e.g. format, style, voices)
- Customize podcast [conversation](usage/conversation_custom.md) (e.g. format, style, voices)
- Choose to run [Local LLMs](usage/local_llm.md) (156+ HuggingFace models)
- Set [System Settings](usage/config_custom.md) (e.g. output directory settings)

## License

This software is licensed under [Apache 2.0](LICENSE). [Here](usage/license-guide.md) are a few instructions if you would like to use podcastfy in your software.

## Contributing 🤝

We welcome contributions! See [Guidelines](GUIDELINES.md) for more details.
Expand Down
41 changes: 0 additions & 41 deletions data/prompts/prompt_v0.txt

This file was deleted.

Loading

0 comments on commit 0029598

Please sign in to comment.