Skip to content

Commit

Permalink
Raises min python version, renames default branch
Browse files Browse the repository at this point in the history
- Sets the minimum python version to 3.10
- Makes main the default branch
  • Loading branch information
jkwill87 committed Dec 22, 2022
1 parent e08f978 commit 0a13fd7
Show file tree
Hide file tree
Showing 49 changed files with 483 additions and 629 deletions.
19 changes: 19 additions & 0 deletions .github/actions/init/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Init
description: Sets up the environment for build, lint, and test jobs

runs:
using: composite
steps:
- uses: actions/setup-python@v4
with:
cache: pip
cache-dependency-path: |
pyproject.toml
requirements.txt
requirements-dev.txt
- name: Installing dependencies
shell: sh
run: >-
pip install -U pip &&
pip install -U -r requirements.txt -r requirements-dev.txt
23 changes: 23 additions & 0 deletions .github/actions/lint/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Lint
description: Lints the codebase with black, isort, pyflakes, and mypy

runs:
using: composite
steps:
- uses: ./.github/actions/init

- name: Linting with black
run: black --check mnamer tests
shell: sh

- name: Linting isort
run: isort --check-only mnamer tests
shell: sh

- name: Linting pyflakes
run: pyflakes mnamer tests
shell: sh

- name: Linting mypy
run: mypy mnamer tests
shell: sh
46 changes: 46 additions & 0 deletions .github/actions/test/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Test
description: Tests the codebase with pytest

runs:
using: composite
steps:
- uses: ./.github/actions/init

- name: Running Local Unit Tests
run: >-
python -m pytest
-m local
--durations=10
--cov=./
--cov-append
--cov-report=term-missing
--cov-report=xml
shell: sh

- name: Running Network Unit Tests
run: >-
python -m pytest
-m network
--reruns 3
--durations=10
--cov=./
--cov-append
--cov-report=term-missing
--cov-report=xml
shell: sh

- name: Running End to End Tests
run: >-
python -m pytest
-m e2e
--reruns 3
--durations=10
--cov=./
--cov-append
--cov-report=term-missing
--cov-report=xml
shell: sh

- name: Reporting Coverage Statistics
uses: codecov/codecov-action@v1
if: success() && github.ref == 'refs/heads/main'
41 changes: 7 additions & 34 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,43 +3,16 @@ name: pr
on: pull_request

jobs:

lint: # ------------------------------------------------------------------------------
lint:
runs-on: ubuntu-latest

steps:
- name: Checking out Git Commit
uses: actions/checkout@v2

- name: Installing Python 3
uses: actions/setup-python@v2
with:
python-version: 3.x
cache: pip
cache-dependency-path: pyproject.toml

- name: Installing Linters from PyPI
run: pip install .[test,dev]

- name: Linting with black
run: black --check mnamer tests
- uses: actions/checkout@v3
- uses: ./.github/actions/lint

- name: Linting isort
run: isort --check-only mnamer tests

- name: Linting mypy
run: mypy mnamer

test: # ------------------------------------------------------------------------------
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: 3.x
cache: pip
cache-dependency-path: pyproject.toml

- run: pip install -q -U pip .[test]
- run: >-
python -m pytest -m 'not tvdb'
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/test
147 changes: 19 additions & 128 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,154 +3,45 @@ name: push
on:
push:
schedule:
- cron: "0 8 * * 1" # Mondays at 8am
- cron: "0 8 * * 1" # mondays at 8am

jobs:
build: # -----------------------------------------------------------------------------
lint:
runs-on: ubuntu-latest

strategy:
matrix:
python-version: ["3.8", "3.x"]
name: build-v${{matrix.python-version}}

steps:
- name: Checking out Git Commit
uses: actions/checkout@v2

- name: Installing Python
uses: actions/setup-python@v2
with:
python-version: ${{matrix.python-version}}
cache: pip
cache-dependency-path: pyproject.toml

- uses: actions/cache@v2
with:
path: ${{ env.pythonLocation }}
key: ${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml') }}-${{ hashFiles('MANIFEST.in') }}-${{ hashFiles('pyproject.toml') }}
- uses: actions/checkout@v3
- uses: ./.github/actions/lint

- name: Installing dependencies
run: pip install -U -r requirements.txt -r requirements-test.txt -r requirements-dev.txt

- name: Attempting build
run: python -m build --wheel --no-isolation

lint: # ------------------------------------------------------------------------------
test:
runs-on: ubuntu-latest
needs: build

steps:
- name: Checking out Git Commit
uses: actions/checkout@v2

- name: Installing Python
uses: actions/setup-python@v2
with:
python-version: 3.x
cache: pip
cache-dependency-path: pyproject.toml
- uses: actions/checkout@v3
- uses: ./.github/actions/test

- uses: actions/cache@v2
with:
path: ${{ env.pythonLocation }}
key: ${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml') }}-${{ hashFiles('requirements.txt') }}-${{ hashFiles('requirements-text.txt') }}-${{ hashFiles('MANIFEST.in') }}

- name: Linting with black
run: black --check mnamer tests

- name: Linting isort
run: isort --check-only mnamer tests

- name: Linting mypy
run: mypy mnamer

test: # ------------------------------------------------------------------------------
publish:
runs-on: ubuntu-latest
needs: build

strategy:
matrix:
python-version: ["8", "3.x"]
name: test-v${{matrix.python-version}}

steps:
- name: Checking out Git Commit
uses: actions/checkout@v2

- name: Installing Python
uses: actions/setup-python@v2
with:
python-version: ${{matrix.python-version}}
cache: pip
cache-dependency-path: pyproject.toml

- uses: actions/cache@v2
with:
path: ${{ env.pythonLocation }}
key: ${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml') }}-${{ hashFiles('requirements.txt') }}-${{ hashFiles('requirements-text.txt') }}-${{ hashFiles('MANIFEST.in') }}
- name: Running Local Unit Tests
run: >-
python -m pytest
-m local
--durations=10
--cov=./
--cov-append
--cov-report=term-missing
--cov-report=xml
- name: Running Network Unit Tests
run: >-
python -m pytest
-m network
--reruns 3
--durations=10
--cov=./
--cov-append
--cov-report=term-missing
--cov-report=xml
if: >-
success()
&& github.event_name == 'push'
&& github.ref == 'refs/heads/main'
- name: Running End to End Tests
run: >-
python -m pytest
-m e2e
--reruns 3
--durations=10
--cov=./
--cov-append
--cov-report=term-missing
--cov-report=xml
- name: Reporting Coverage Statistics
if: >
success()
&& github.event_name == 'push'
&& github.ref == 'refs/heads/master'
&& matrix['python-version'] == '3.x'
uses: codecov/codecov-action@v1

publish: # ---------------------------------------------------------------------------
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags')
needs:
- build
- lint
- test

steps:
- name: Checking out Git Commit
uses: actions/checkout@v2

- name: Installing Python
uses: actions/setup-python@v2
with:
python-version: 3.8
- uses: actions/checkout@v3
with: { fetch-depth: 0 } # required for setuptools_scm to detect git tags
- uses: ./.github/actions/init

- name: Installing Requirements
run: pip install -U -r requirements.txt -r -r requirements-dev.txt
- name: Building
run: python3 -m build --sdist --wheel --no-isolation

- name: Building wheel and source distribution
run: python -m build --sdist --wheel
- name: Reporting Version
run: python3 -m mnamer --version

- name: Uploading to PyPI
run: >-
Expand Down
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ __pycache__/
.idea
.mypy_cache/
.pytest_cache/
.python-version
.vimrc
.vs
.vscode
Expand All @@ -20,6 +19,7 @@ coverage.xml
demo/
dist/
MANIFEST
mnamer/__version__.py
playground.py
testing/test_files_*
venv*
venv*
1 change: 1 addition & 0 deletions .python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.10
7 changes: 3 additions & 4 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,12 @@
"**/.DS_Store": true,
"**/.git": true,
"**/.pytest_cache/": true,
"**/.svn": true,
"**/__pycache__": true,
"*.egg-info": true,
"*.egg-info/": true,
".idea": true,
"demo": true,
"venv": true
},
"python.formatting.provider": "black"
}
"python.formatting.provider": "black",
"python.linting.mypyEnabled": true
}
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
FROM python:alpine
ARG MNAMER_VERSION=2.4.2
ARG MNAMER_VERSION=2.5.2
ARG UID=1000
ARG GID=1000
RUN addgroup mnamer -g $GID
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
[![PyPI](https://img.shields.io/pypi/v/mnamer.svg?style=for-the-badge)](https://pypi.python.org/pypi/mnamer)
[![Tests](https://img.shields.io/github/workflow/status/jkwill87/mnamer/push?style=for-the-badge&label=Tests)](https://github.com/jkwill87/mnamer/actions?query=workflow:push)
[![Coverage](https://img.shields.io/codecov/c/github/jkwill87/mnamer/master.svg?style=for-the-badge)](https://codecov.io/gh/jkwill87/mnamer)
[![Tests](https://img.shields.io/github/workflow/status/jkwill87/mnamer/push?style=for-the-badge&label=Tests)](https://img.shields.io/github/actions/workflow/status/jkwill87/mnamer/.github/workflows/push.yml?branch=main)
[![Coverage](https://img.shields.io/codecov/c/github/jkwill87/mnamer/main.svg?style=for-the-badge)](https://codecov.io/gh/jkwill87/mnamer)
[![Licence](https://img.shields.io/github/license/jkwill87/mnamer.svg?style=for-the-badge)](https://en.wikipedia.org/wiki/MIT_License)
[![Style: Black](https://img.shields.io/badge/Style-Black-black.svg?style=for-the-badge)](https://github.com/ambv/black)

<img src="https://github.com/jkwill87/mnamer/raw/master/assets/logo.png" width="450"/>
<img src="https://github.com/jkwill87/mnamer/raw/main/assets/logo.png" width="450"/>

# mnamer

mnamer (**m**edia re**namer**) is an intelligent and highly configurable media organization utility. It parses media filenames for metadata, searches the web to fill in the blanks, and then renames and moves them.

Currently it has integration support with [TVDb](https://thetvdb.com) and [TvMaze](https://www.tvmaze.com) for television episodes and [TMDb](https://www.themoviedb.org/) and [OMDb](https://www.omdbapi.com) for movies.

<img src="https://github.com/jkwill87/mnamer/raw/master/assets/screenshot.png" width="750"/>
<img src="https://github.com/jkwill87/mnamer/raw/main/assets/screenshot.png" width="750"/>

## Documentation

Expand Down
Loading

0 comments on commit 0a13fd7

Please sign in to comment.