#! /usr/bin/env python

import codecs
import os.path
import re

import setuptools


def read(*parts):
    here = os.path.abspath(os.path.dirname(__file__))
    with codecs.open(os.path.join(here, *parts), "r") as f:
        return f.read()


def find_version(*file_parts):
    version_file = read(*file_parts)
    version_match = re.search(
        r"^__version__ = ['\"]([^'\"]*)['\"]$", version_file, re.M
    )
    if version_match:
        return version_match.group(1)
    raise RuntimeError("Unable to find version string.")


with open("README.md") as f1, open("CHANGELOG.md") as f2:
    long_description = f1.read() + "\n\n" + f2.read()

setuptools.setup(
    name="vulture",
    version=find_version("vulture", "version.py"),
    description="Find dead code",
    long_description=long_description,
    long_description_content_type="text/markdown",
    keywords="dead-code-removal",
    author="Jendrik Seipp",
    author_email="jendrikseipp@gmail.com",
    url="https://github.com/jendrikseipp/vulture",
    license="MIT",
    classifiers=[
        "Development Status :: 5 - Production/Stable",
        "Environment :: Console",
        "Intended Audience :: Developers",
        "License :: OSI Approved :: MIT License",
        "Programming Language :: Python",
        "Programming Language :: Python :: 3",
        "Programming Language :: Python :: 3.6",
        "Programming Language :: Python :: 3.7",
        "Programming Language :: Python :: 3.8",
        "Programming Language :: Python :: Implementation :: CPython",
        "Programming Language :: Python :: Implementation :: PyPy",
        "Topic :: Software Development :: Quality Assurance",
    ],
    install_requires=["toml"],
    entry_points={"console_scripts": ["vulture = vulture.core:main"]},
    python_requires=">=3.6",
    packages=setuptools.find_packages(exclude=["tests"]),
    package_data={"vulture": ["whitelists/*.py"]},
)

@@ -28,29 +28,15 @@
 ort 
-codecs%0Aimport os.
 path
+lib
 %0Aimp
@@ -67,20 +67,28 @@
 s%0A%0A%0Adef 
-read
+find_version
 (*parts)
@@ -104,203 +104,89 @@
 e = 
-os.
 path
-.abspath(os.path.dirname(__file__))%0A    with codecs.open(os.path.join(here, *parts), %22r%22) as f:%0A        return f.read()%0A%0A%0Adef find_version(*file_parts):%0A    version_file = read(*file_parts
+lib.Path(__file__).parent%0A    version_file = here.joinpath(*parts).read_text(
 )%0A  

Use pathlib in setup.py (#224)