Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change m3u8 project to use poetry #386

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 27 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,35 @@ jobs:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

# Use abatilo/actions-poetry@v2 to install Poetry
- name: Install Poetry
uses: abatilo/actions-poetry@v2
with:
poetry-version: 1.5.1

# Setup Local Virtual Environment if no poetry.toml file
- name: Setup Local Virtual Environment
run: |
poetry config virtualenvs.create true --local
poetry config virtualenvs.in-project true --local

# Load Cached Environment if it exists
- name: Load Cached Environment
id: cached-poetry-dependencies
uses: actions/cache@v4
with:
path: .venv
key: venv-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('**/poetry.lock') }}

# Install Dependencies if no cached environment
- name: Install Dependencies
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: poetry install --no-interaction --no-root

# Runs a single command using the runners shell
- name: Run all tests
run: ./runtests

run: poetry run ./runtests
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@ local/
.vscode/
venv/
pyvenv.cfg
poetry.lock
3 changes: 0 additions & 3 deletions MANIFEST.in

This file was deleted.

36 changes: 36 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
[tool.poetry]
name = "m3u8"
version = "6.0.0"
description = "Python m3u8 parser"
authors = ["Globo.com"]
license = "MIT"
readme = "README.md"
repository = "https://github.com/globocom/m3u8"
packages = [
{include = "m3u8"},
{include = "LICENSE"},
{include = "README.md"},
]
classifiers = [
"License :: OSI Approved :: MIT License",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
]

[tool.poetry.dependencies]
python = "^3.7"
backports-datetime-fromisoformat = {version = "*", python = "<3.11"}

[tool.poetry.group.dev.dependencies]
bottle = "*"
pytest = "*"
pytest-cov = ">=2.4.0,<2.6"

[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"
8 changes: 0 additions & 8 deletions requirements-dev.txt

This file was deleted.

1 change: 0 additions & 1 deletion requirements.txt

This file was deleted.

10 changes: 7 additions & 3 deletions runtests
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,16 @@
test_server_stdout=tests/server.stdout

function install_deps {
pip install -r requirements-dev.txt
if [ -z "$GITHUB_ACTIONS" ]; then
poetry install
else
echo "Skipping dependency installation on GitHub Actions"
fi
}

function start_server {
rm -f ${test_server_stdout}
python tests/m3u8server.py >${test_server_stdout} 2>&1 &
poetry run python tests/m3u8server.py >${test_server_stdout} 2>&1 &
}

function stop_server {
Expand All @@ -17,7 +21,7 @@ function stop_server {
}

function run {
PYTHONPATH=. py.test -vv --cov-report term-missing --cov m3u8 tests/
poetry run pytest -vv --cov-report term-missing --cov m3u8 tests/
}

function main {
Expand Down
28 changes: 0 additions & 28 deletions setup.py

This file was deleted.