Skip to content

Commit 4cdbc19

Browse files
committed
Drop Python 2 compatibility
1 parent 36c5f9d commit 4cdbc19

16 files changed

Lines changed: 28 additions & 102 deletions

README.md

Lines changed: 21 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,24 @@
1-
This is a sloppy fork of [pythonBits](https://github.com/mueslo/pythonbits) that
2-
fixes compatibility issues with recent tools (e.g. mediainfo and tvdb). It's not
3-
a proper fork, I just fix bugs as I find them.
4-
5-
Everything should work like it does with mueslo/pythonBits, except for the
6-
installation.
7-
8-
## Installation
9-
10-
I recommend [pipx](https://pipxproject.github.io/pipx/), which installs Python
11-
packages with all dependencies in a virtual environment in
12-
`~/.local/pipx/<package name>` and thus makes it very easy to uninstall them. To
13-
uninstall pythonBits with pip, you need to do something like this:
14-
15-
```sh
16-
pip3 uninstall -y appdirs attrdict attrs babelfish boto certifi chardet configparser diskcache future guessit idna imdbpie Logbook pip pkg-resources progressbar2 pymediainfo pyreadline python-dateutil python-utils pythonbits rebulk requests requests-cache setuptools six trans tvdb-api Unidecode urllib3 wheel
17-
```
18-
19-
But this might break other Python packages that share dependencies with
20-
pythonBits. This issue doesn't exist with pipx:
21-
22-
```sh
23-
$ # If possible, install pipx with your package manager, otherwise use pip
24-
$ pip3 install --user pipx
25-
$ # Install pythonBits
26-
$ pipx install --spec git+https://github.com/plotski/pythonBits.git pythonBits
27-
$ # You must also specify the git repository when upgrading
28-
$ pipx upgrade --spec git+https://github.com/plotski/pythonBits.git pythonBits
29-
$ # Uninstalling is straightforward
30-
$ pipx uninstall pythonBits
31-
```
32-
33-
If cannot use pipx for some reason, you can also use plain pip, of course.
34-
35-
```sh
36-
$ pip3 install --upgrade --user git+https://github.com/plotski/pythonBits.git
37-
```
1+
# pythonBits
2+
[![GitHub release](https://img.shields.io/github/release/mueslo/pythonbits.svg)](https://GitHub.com/mueslo/pythonBits/releases/)
3+
[![PyPI version](https://img.shields.io/pypi/v/pythonbits.svg)](https://pypi.python.org/pypi/pythonbits/)
4+
[![PyPI pyversions](https://img.shields.io/pypi/pyversions/pythonbits.svg)](https://pypi.python.org/pypi/pythonbits/)
5+
[![GitHub commits since release](https://img.shields.io/github/commits-since/mueslo/pythonbits/latest.svg)](https://github.com/mueslo/pythonBits/commits/master)
6+
[![GitHub license](https://img.shields.io/github/license/mueslo/pythonbits.svg)](https://github.com/mueslo/pythonbits/blob/master/LICENSE)
7+
[![Build Status](https://img.shields.io/travis/mueslo/pythonBits.svg)](https://travis-ci.org/mueslo/pythonBits)
8+
#### A Python description generator for movies and TV shows
9+
10+
## Install
11+
1. (Optional, highly recommended) Set up a virtualenv to avoid polluting your system with dependencies.
12+
- with virtualenvwrapper: `mkvirtualenv pythonbits`
13+
- activate the virtualenv with `workon pythonbits`
14+
2. Install pythonBits in one of the following ways
15+
- install via `pip install pythonbits`
16+
- clone and `pip install .`
17+
- (dev) clone, install requirements from setup.py and run as `python -m pythonbits` instead of `pythonbits`
18+
3. Install mediainfo, ffmpeg and mktorrent>=1.1 such that they are accessible for pythonBits
19+
- you can also manually specify things such as the torrent file or screenshots, this will prevent the programs from being called, removing the dependency
20+
21+
If you don't want to use a virtualenv but keep system pollution with PyPI packages to a minimum, install via `pip install --user`. For more information, visit [this site](https://packaging.python.org/guides/installing-using-pip-and-virtualenv/).
3822

3923
## Usage
4024
```

pythonbits/__main__.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
11
# -*- coding: utf-8 -*-
2-
from __future__ import (absolute_import, division,
3-
print_function, unicode_literals)
4-
from builtins import * # noqa: F401, F403
5-
62
import sys
73
from os import path
84
from argparse import ArgumentParser

pythonbits/bb.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,9 @@
11
# -*- coding: utf-8 -*-
2-
from __future__ import (absolute_import, division,
3-
print_function, unicode_literals)
4-
from builtins import * # noqa: F401, F403
5-
62
import os
73
import sys
84
import shutil
95
import re
106
import subprocess
11-
import time
127

138
from textwrap import dedent
149
from collections import namedtuple, abc
@@ -254,7 +249,6 @@ def _render_tv_specifier(self):
254249
return TvSpecifier(title, guess['season'],
255250
guess.get('episode', None))
256251

257-
raise Exception('Unable to guess TV show')
258252

259253
@form_field('tags')
260254
def _render_tags(self):

pythonbits/config.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
# -*- coding: utf-8 -*-
2-
from __future__ import (absolute_import, division,
3-
print_function, unicode_literals)
4-
from builtins import * # noqa: F401, F403
52
from io import open
6-
73
from os import path, chmod, makedirs
84

95
import configparser

pythonbits/ffmpeg.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,6 @@
55
Created by Ichabond on 2012-07-01.
66
Copyright (c) 2012 Baconseed. All rights reserved.
77
"""
8-
from __future__ import (absolute_import, division,
9-
print_function, unicode_literals)
10-
from builtins import * # noqa: F401, F403
11-
12-
138
import os
149
import subprocess
1510
import re

pythonbits/imdb.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
11
# -*- coding: utf-8 -*-
2-
from __future__ import (absolute_import, division,
3-
print_function, unicode_literals)
4-
from builtins import * # noqa: F401, F403
5-
62
from attrdict import AttrDict
73
import imdbpie
84

pythonbits/imgur.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
11
# -*- coding: utf-8 -*-
2-
from __future__ import (absolute_import, division,
3-
print_function, unicode_literals)
4-
from builtins import * # noqa: F401, F403
5-
62
import requests
73
import json
8-
from future.moves.urllib.parse import urlparse
4+
from urllib.parse import urlparse
95
from textwrap import dedent
106

117
from .config import config

pythonbits/logging.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
11
# -*- coding: utf-8 -*-
2-
from __future__ import (absolute_import, division,
3-
print_function, unicode_literals)
4-
from builtins import * # noqa: F401, F403
5-
62
import os
73
import sys
84

pythonbits/scene.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
11
# -*- coding: utf-8 -*-
2-
from __future__ import (absolute_import, division,
3-
print_function, unicode_literals)
4-
from builtins import * # noqa: F401, F403
5-
62
import os
73
import requests
84
import progressbar

pythonbits/submission.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,4 @@
11
# -*- coding: utf-8 -*-
2-
from __future__ import (absolute_import, division,
3-
print_function, unicode_literals)
4-
from builtins import * # noqa: F401, F403
5-
from future.utils import with_metaclass
6-
72
import os
83
import sys
94
import re
@@ -191,7 +186,7 @@ def toposort(depends_on):
191186
return sorted_funcs
192187

193188

194-
class Submission(with_metaclass(RegisteringType, CachedRenderer)):
189+
class Submission(CachedRenderer, metaclass=RegisteringType):
195190
def __repr__(self):
196191
return "\n".join(
197192
["Field {k}:\n\t{v}\n".format(k=k, v=v)

0 commit comments

Comments
 (0)