We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Replace requirements.txt with Pipfile
Pipenv (which works with Pipfile) is officially recommended Python packaging tool from Python.org. We should use it instead `requirements.txt `.
  

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `setup.py`
Content:
```
1 """
2 .. image:: https://raw.githubusercontent.com/lk-geimfari/mimesis/master/media/logo-large-nodescr.png
3 
4 Mimesis
5 -------
6 
7 **Mimesis** is a fast and easy to use the library for Python programming
8 language, which helps generate mock data for a variety of purposes in a
9 variety of languages. This data can be particularly useful during software
10 development and testing. For example, it could be used to populate a
11 testing database for a web application with user information such as
12 email addresses, usernames, first names, last names, etc.
13 
14 Documentation
15 -------------
16 
17 Mimesis is very simple to use, and the below examples should help you
18 get started. Complete documentation for Mimesis is available on `Read
19 the Docs`_.
20 
21 .. _Read the Docs: http://mimesis.readthedocs.io/
22 
23 Installation
24 ------------
25 
26 To install mimesis, simply use pip (or `pipenv <http://pipenv.org/>`_):
27 
28 .. code:: bash
29 
30     ➜  ~ pip install mimesis
31 
32 Getting started
33 ---------------
34 
35 As we said above, this library is really easy to use. A simple usage
36 example is given below:
37 
38 .. code:: python
39 
40     >>> from mimesis import Personal
41     >>> from mimesis.enums import Gender
42     >>> person = Personal('en')
43 
44     >>> person.full_name(gender=Gender.FEMALE)
45     'Antonetta Garrison'
46 
47     >>> person.occupation()
48     'Backend Developer'
49 
50     >>> for template in ('U_d', 'U-d', 'l_d', 'l-d'):
51     ...     person.username(template=template)
52 
53     'Adders_1893'
54     'Abdel-1888'
55     'constructor_1884'
56     'chegre-2051'
57 
58 Locales
59 -------
60 
61 You can specify a locale when creating providers and they will return data that is appropriate for
62 the language or country associated with that locale. `Mimesis` currently includes support
63 for `33 different locales <http://mimesis.readthedocs.io/locales.html>`_.
64 
65 Data Providers
66 --------------
67 
68 List of supported data providers available `here <http://mimesis.readthedocs.io/providers.html>`_
69 
70 """
71 
72 import json
73 import os
74 import re
75 import sys
76 from distutils.core import setup
77 from os.path import abspath, dirname, exists, getsize, join, relpath, splitext
78 from shutil import rmtree
79 
80 from setuptools import Command
81 from setuptools.command.test import test as TestCommand
82 
83 VERSION_MINOR_MAX = 10
84 VERSION_MICRO_MAX = 10
85 
86 here = abspath(dirname(__file__))
87 
88 try:
89     with open('dev_requirements.txt') as f:
90         tests_requirements = f.read().splitlines()
91 except FileNotFoundError:
92     tests_requirements = []
93 
94 about = {}
95 # Get meta-data from __version__.py
96 with open(join(here, 'mimesis', '__version__.py')) as f:
97     exec(f.read(), about)
98 
99 
100 class BaseCommand(Command):
101     description = ''
102     user_options = []
103 
104     def initialize_options(self):
105         pass
106 
107     def finalize_options(self):
108         pass
109 
110     def run(self):
111         pass
112 
113 
114 class Upload(BaseCommand):
115     """Support setup.py upload."""
116 
117     def run(self):
118         try:
119             rmtree(os.path.join(here, 'dist'))
120         except OSError:
121             pass
122 
123         os.system('{0} setup.py sdist bdist_wheel --universal'.format(sys.executable))
124         os.system('twine upload dist/*')
125         sys.exit()
126 
127 
128 class PyTest(TestCommand):
129     """Custom command for running test using setup.py test"""
130 
131     user_options = [('pytest-args=', 'a', 'Arguments to pass to py.test')]
132 
133     def initialize_options(self):
134         TestCommand.initialize_options(self)
135         self.pytest_args = []
136 
137     def finalize_options(self):
138         TestCommand.finalize_options(self)
139         self.test_args = []
140         self.test_suite = True
141 
142     def run_tests(self):
143         import pytest
144         errno = pytest.main(self.pytest_args)
145         exit(errno)
146 
147 
148 class Minimizer(BaseCommand):
149     """Minify content of all json file for all locales.
150     """
151 
152     def initialize_options(self):
153         """Find all files of all locales.
154         """
155 
156         self.paths = []
157         self.data_path = '/mimesis/data'
158         self.separators = (',', ':')
159         self.data_dir = here + self.data_path
160         self.before_total = 0
161         self.after_total = 0
162 
163         for root, _, files in os.walk(self.data_dir):
164             for file in sorted(files):
165                 if splitext(file)[1] == '.json':
166                     self.paths.append(join(
167                         relpath(root, self.data_dir),
168                         file
169                     ))
170 
171     @staticmethod
172     def size_of(num):
173         for unit in ['B', 'KB', 'MB']:
174             if abs(num) < 1024.0:
175                 return "%3.1f%s" % (num, unit)
176             num = num / 1024.0
177         return "%.1f" % num
178 
179     def minify(self, file_path):
180         size_before = getsize(file_path)
181         self.before_total += size_before
182         size_before = self.size_of(size_before)
183 
184         with open(file_path, 'r', 1) as f:
185             json_text = json.loads(f.read())
186             minimized = json.dumps(
187                 json_text, separators=self.separators, ensure_ascii=False)
188 
189         if len(file_path) > 0:
190             output_path = abspath(file_path)
191             abs_path = abspath(dirname(output_path))
192 
193             if not exists(abs_path):
194                 os.makedirs(abs_path)
195 
196             with open(output_path, 'w+', 1) as f:
197                 f.write(minimized)
198 
199         size_after = getsize(file_path)
200         self.after_total += size_after
201         size_after = self.size_of(size_after)
202 
203         json_file = '/'.join(file_path.split('/')[-2:])
204 
205         template = "\033[34m{}\033[0m : " \
206                    "\033[92mminimized\033[0m : " \
207                    "\033[33m{}\033[0m -> \033[92m{}\033[0m".format(
208             json_file,
209             size_before,
210             size_after,
211         )
212 
213         print(template)
214 
215     def run(self):
216         """Start json minimizer and exit when all json
217         files was minimized.
218         """
219         for rel_path in sorted(self.paths):
220             file_path = join(self.data_dir, rel_path)
221             self.minify(file_path)
222 
223         after = self.size_of(self.after_total)
224         before = self.size_of(self.before_total)
225         saved = self.size_of(self.before_total - self.after_total)
226 
227         template = '\nTotal: ' \
228                    '\033[92m{}\033[0m -> \033[92m{}\033[0m. ' \
229                    'Compressed: \033[92m{}\033[0m\n'.format(before, after, saved)
230 
231         print(template)
232 
233 
234 class Version(BaseCommand):
235     """Custom command for versioning"""
236 
237     def initialize_options(self):
238         self.current = about['__version__']
239         print('Previous version: '
240               '\033[33m{}\033[0m.\n'.format(self.current))
241 
242     @staticmethod
243     def automatically(version):
244         """Automatically increment version string.
245 
246         :param version: Current version.
247         :return: Next version.
248         """
249         major, minor, micro = [
250             int(i) for i in version.split('.')
251         ]
252 
253         if VERSION_MICRO_MAX > micro:
254             micro += 1
255         elif VERSION_MICRO_MAX == micro:
256             micro = 0
257             minor += 1
258         elif VERSION_MINOR_MAX > minor:
259             minor += 1
260         elif VERSION_MINOR_MAX == minor:
261             micro, minor = 0, 0
262             major += 1
263         if VERSION_MINOR_MAX < minor:
264             minor, micro = 0, 0
265             major += 1
266 
267         return '.'.join([str(i) for i
268                          in (major, minor, micro)])
269 
270     def rewrite(self, version=None):
271         if not version:
272             version = self.current
273 
274         with open(join(here, 'mimesis', '__version__.py'), 'r+') as f:
275             version_str = '__version__ = \'{}\''.format(version)
276             regexp = r'__version__ = .*'
277 
278             meta = re.sub(regexp, version_str, f.read())
279             f.seek(0)
280             f.write(meta)
281             f.truncate()
282 
283         print('Updated! Current version is: '
284               '\033[34m{}\033[0m.\n'.format(version))
285 
286         exit()
287 
288     def run(self):
289         response = input('Are you sure? (yes/no): ')
290         if response.lower() in ('yes', 'y'):
291             self.rewrite(
292                 self.automatically(
293                     self.current,
294                 ),
295             )
296 
297 
298 setup(
299     name=about['__title__'],
300     version=about['__version__'],
301     description=about['__description__'],
302     long_description=__doc__,
303     author=about['__author__'],
304     author_email=about['__author_email__'],
305     url=about['__url__'],
306     license=about['__license__'],
307     packages=[
308         'mimesis',
309         'mimesis.data',
310         'mimesis.data.int',
311         'mimesis.builtins',
312         'mimesis.providers',
313     ],
314     keywords=[
315         'fake',
316         'mock',
317         'data',
318         'populate',
319         'database',
320         'testing',
321         'generate',
322         'mimesis',
323         'dummy',
324     ],
325     package_data={
326         'mimesis': [
327             'data/*/*',
328         ],
329     },
330     exclude_package_data={
331         'mimesis': [
332             # It's for development.
333             'data/locale_template/*'
334         ],
335     },
336     data_files=[
337         ('', ['LICENSE']),
338     ],
339     classifiers=[
340         'License :: OSI Approved :: MIT License',
341         'Intended Audience :: Developers',
342         'Programming Language :: Python :: 3.5',
343         'Programming Language :: Python :: 3.6',
344         'Programming Language :: Python :: Implementation :: CPython',
345         'Operating System :: OS Independent',
346         'Topic :: Software Development',
347         'Topic :: Software Development :: Testing',
348     ],
349     tests_require=tests_requirements,
350     cmdclass={
351         'test': PyTest,
352         'version': Version,
353         'minify': Minimizer,
354         'upload': Upload,
355     },
356 )
357
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -85,12 +85,6 @@
 
 here = abspath(dirname(__file__))
 
-try:
-    with open('dev_requirements.txt') as f:
-        tests_requirements = f.read().splitlines()
-except FileNotFoundError:
-    tests_requirements = []
-
 about = {}
 # Get meta-data from __version__.py
 with open(join(here, 'mimesis', '__version__.py')) as f:
@@ -125,26 +119,6 @@
         sys.exit()
 
 
-class PyTest(TestCommand):
-    """Custom command for running test using setup.py test"""
-
-    user_options = [('pytest-args=', 'a', 'Arguments to pass to py.test')]
-
-    def initialize_options(self):
-        TestCommand.initialize_options(self)
-        self.pytest_args = []
-
-    def finalize_options(self):
-        TestCommand.finalize_options(self)
-        self.test_args = []
-        self.test_suite = True
-
-    def run_tests(self):
-        import pytest
-        errno = pytest.main(self.pytest_args)
-        exit(errno)
-
-
 class Minimizer(BaseCommand):
     """Minify content of all json file for all locales.
     """
@@ -346,9 +320,7 @@
         'Topic :: Software Development',
         'Topic :: Software Development :: Testing',
     ],
-    tests_require=tests_requirements,
     cmdclass={
-        'test': PyTest,
         'version': Version,
         'minify': Minimizer,
         'upload': Upload,

{"golden_diff": "diff --git a/setup.py b/setup.py\n--- a/setup.py\n+++ b/setup.py\n@@ -85,12 +85,6 @@\n \n here = abspath(dirname(__file__))\n \n-try:\n-    with open('dev_requirements.txt') as f:\n-        tests_requirements = f.read().splitlines()\n-except FileNotFoundError:\n-    tests_requirements = []\n-\n about = {}\n # Get meta-data from __version__.py\n with open(join(here, 'mimesis', '__version__.py')) as f:\n@@ -125,26 +119,6 @@\n         sys.exit()\n \n \n-class PyTest(TestCommand):\n-    \"\"\"Custom command for running test using setup.py test\"\"\"\n-\n-    user_options = [('pytest-args=', 'a', 'Arguments to pass to py.test')]\n-\n-    def initialize_options(self):\n-        TestCommand.initialize_options(self)\n-        self.pytest_args = []\n-\n-    def finalize_options(self):\n-        TestCommand.finalize_options(self)\n-        self.test_args = []\n-        self.test_suite = True\n-\n-    def run_tests(self):\n-        import pytest\n-        errno = pytest.main(self.pytest_args)\n-        exit(errno)\n-\n-\n class Minimizer(BaseCommand):\n     \"\"\"Minify content of all json file for all locales.\n     \"\"\"\n@@ -346,9 +320,7 @@\n         'Topic :: Software Development',\n         'Topic :: Software Development :: Testing',\n     ],\n-    tests_require=tests_requirements,\n     cmdclass={\n-        'test': PyTest,\n         'version': Version,\n         'minify': Minimizer,\n         'upload': Upload,\n", "issue": "Replace requirements.txt with Pipfile\nPipenv (which works with Pipfile) is officially recommended Python packaging tool from Python.org. We should use it instead `requirements.txt `.\r\n  \n", "before_files": [{"content": "\"\"\"\n.. image:: https://raw.githubusercontent.com/lk-geimfari/mimesis/master/media/logo-large-nodescr.png\n\nMimesis\n-------\n\n**Mimesis** is a fast and easy to use the library for Python programming\nlanguage, which helps generate mock data for a variety of purposes in a\nvariety of languages. This data can be particularly useful during software\ndevelopment and testing. For example, it could be used to populate a\ntesting database for a web application with user information such as\nemail addresses, usernames, first names, last names, etc.\n\nDocumentation\n-------------\n\nMimesis is very simple to use, and the below examples should help you\nget started. Complete documentation for Mimesis is available on `Read\nthe Docs`_.\n\n.. _Read the Docs: http://mimesis.readthedocs.io/\n\nInstallation\n------------\n\nTo install mimesis, simply use pip (or `pipenv <http://pipenv.org/>`_):\n\n.. code:: bash\n\n    \u279c  ~ pip install mimesis\n\nGetting started\n---------------\n\nAs we said above, this library is really easy to use. A simple usage\nexample is given below:\n\n.. code:: python\n\n    >>> from mimesis import Personal\n    >>> from mimesis.enums import Gender\n    >>> person = Personal('en')\n\n    >>> person.full_name(gender=Gender.FEMALE)\n    'Antonetta Garrison'\n\n    >>> person.occupation()\n    'Backend Developer'\n\n    >>> for template in ('U_d', 'U-d', 'l_d', 'l-d'):\n    ...     person.username(template=template)\n\n    'Adders_1893'\n    'Abdel-1888'\n    'constructor_1884'\n    'chegre-2051'\n\nLocales\n-------\n\nYou can specify a locale when creating providers and they will return data that is appropriate for\nthe language or country associated with that locale. `Mimesis` currently includes support\nfor `33 different locales <http://mimesis.readthedocs.io/locales.html>`_.\n\nData Providers\n--------------\n\nList of supported data providers available `here <http://mimesis.readthedocs.io/providers.html>`_\n\n\"\"\"\n\nimport json\nimport os\nimport re\nimport sys\nfrom distutils.core import setup\nfrom os.path import abspath, dirname, exists, getsize, join, relpath, splitext\nfrom shutil import rmtree\n\nfrom setuptools import Command\nfrom setuptools.command.test import test as TestCommand\n\nVERSION_MINOR_MAX = 10\nVERSION_MICRO_MAX = 10\n\nhere = abspath(dirname(__file__))\n\ntry:\n    with open('dev_requirements.txt') as f:\n        tests_requirements = f.read().splitlines()\nexcept FileNotFoundError:\n    tests_requirements = []\n\nabout = {}\n# Get meta-data from __version__.py\nwith open(join(here, 'mimesis', '__version__.py')) as f:\n    exec(f.read(), about)\n\n\nclass BaseCommand(Command):\n    description = ''\n    user_options = []\n\n    def initialize_options(self):\n        pass\n\n    def finalize_options(self):\n        pass\n\n    def run(self):\n        pass\n\n\nclass Upload(BaseCommand):\n    \"\"\"Support setup.py upload.\"\"\"\n\n    def run(self):\n        try:\n            rmtree(os.path.join(here, 'dist'))\n        except OSError:\n            pass\n\n        os.system('{0} setup.py sdist bdist_wheel --universal'.format(sys.executable))\n        os.system('twine upload dist/*')\n        sys.exit()\n\n\nclass PyTest(TestCommand):\n    \"\"\"Custom command for running test using setup.py test\"\"\"\n\n    user_options = [('pytest-args=', 'a', 'Arguments to pass to py.test')]\n\n    def initialize_options(self):\n        TestCommand.initialize_options(self)\n        self.pytest_args = []\n\n    def finalize_options(self):\n        TestCommand.finalize_options(self)\n        self.test_args = []\n        self.test_suite = True\n\n    def run_tests(self):\n        import pytest\n        errno = pytest.main(self.pytest_args)\n        exit(errno)\n\n\nclass Minimizer(BaseCommand):\n    \"\"\"Minify content of all json file for all locales.\n    \"\"\"\n\n    def initialize_options(self):\n        \"\"\"Find all files of all locales.\n        \"\"\"\n\n        self.paths = []\n        self.data_path = '/mimesis/data'\n        self.separators = (',', ':')\n        self.data_dir = here + self.data_path\n        self.before_total = 0\n        self.after_total = 0\n\n        for root, _, files in os.walk(self.data_dir):\n            for file in sorted(files):\n                if splitext(file)[1] == '.json':\n                    self.paths.append(join(\n                        relpath(root, self.data_dir),\n                        file\n                    ))\n\n    @staticmethod\n    def size_of(num):\n        for unit in ['B', 'KB', 'MB']:\n            if abs(num) < 1024.0:\n                return \"%3.1f%s\" % (num, unit)\n            num = num / 1024.0\n        return \"%.1f\" % num\n\n    def minify(self, file_path):\n        size_before = getsize(file_path)\n        self.before_total += size_before\n        size_before = self.size_of(size_before)\n\n        with open(file_path, 'r', 1) as f:\n            json_text = json.loads(f.read())\n            minimized = json.dumps(\n                json_text, separators=self.separators, ensure_ascii=False)\n\n        if len(file_path) > 0:\n            output_path = abspath(file_path)\n            abs_path = abspath(dirname(output_path))\n\n            if not exists(abs_path):\n                os.makedirs(abs_path)\n\n            with open(output_path, 'w+', 1) as f:\n                f.write(minimized)\n\n        size_after = getsize(file_path)\n        self.after_total += size_after\n        size_after = self.size_of(size_after)\n\n        json_file = '/'.join(file_path.split('/')[-2:])\n\n        template = \"\\033[34m{}\\033[0m : \" \\\n                   \"\\033[92mminimized\\033[0m : \" \\\n                   \"\\033[33m{}\\033[0m -> \\033[92m{}\\033[0m\".format(\n            json_file,\n            size_before,\n            size_after,\n        )\n\n        print(template)\n\n    def run(self):\n        \"\"\"Start json minimizer and exit when all json\n        files was minimized.\n        \"\"\"\n        for rel_path in sorted(self.paths):\n            file_path = join(self.data_dir, rel_path)\n            self.minify(file_path)\n\n        after = self.size_of(self.after_total)\n        before = self.size_of(self.before_total)\n        saved = self.size_of(self.before_total - self.after_total)\n\n        template = '\\nTotal: ' \\\n                   '\\033[92m{}\\033[0m -> \\033[92m{}\\033[0m. ' \\\n                   'Compressed: \\033[92m{}\\033[0m\\n'.format(before, after, saved)\n\n        print(template)\n\n\nclass Version(BaseCommand):\n    \"\"\"Custom command for versioning\"\"\"\n\n    def initialize_options(self):\n        self.current = about['__version__']\n        print('Previous version: '\n              '\\033[33m{}\\033[0m.\\n'.format(self.current))\n\n    @staticmethod\n    def automatically(version):\n        \"\"\"Automatically increment version string.\n\n        :param version: Current version.\n        :return: Next version.\n        \"\"\"\n        major, minor, micro = [\n            int(i) for i in version.split('.')\n        ]\n\n        if VERSION_MICRO_MAX > micro:\n            micro += 1\n        elif VERSION_MICRO_MAX == micro:\n            micro = 0\n            minor += 1\n        elif VERSION_MINOR_MAX > minor:\n            minor += 1\n        elif VERSION_MINOR_MAX == minor:\n            micro, minor = 0, 0\n            major += 1\n        if VERSION_MINOR_MAX < minor:\n            minor, micro = 0, 0\n            major += 1\n\n        return '.'.join([str(i) for i\n                         in (major, minor, micro)])\n\n    def rewrite(self, version=None):\n        if not version:\n            version = self.current\n\n        with open(join(here, 'mimesis', '__version__.py'), 'r+') as f:\n            version_str = '__version__ = \\'{}\\''.format(version)\n            regexp = r'__version__ = .*'\n\n            meta = re.sub(regexp, version_str, f.read())\n            f.seek(0)\n            f.write(meta)\n            f.truncate()\n\n        print('Updated! Current version is: '\n              '\\033[34m{}\\033[0m.\\n'.format(version))\n\n        exit()\n\n    def run(self):\n        response = input('Are you sure? (yes/no): ')\n        if response.lower() in ('yes', 'y'):\n            self.rewrite(\n                self.automatically(\n                    self.current,\n                ),\n            )\n\n\nsetup(\n    name=about['__title__'],\n    version=about['__version__'],\n    description=about['__description__'],\n    long_description=__doc__,\n    author=about['__author__'],\n    author_email=about['__author_email__'],\n    url=about['__url__'],\n    license=about['__license__'],\n    packages=[\n        'mimesis',\n        'mimesis.data',\n        'mimesis.data.int',\n        'mimesis.builtins',\n        'mimesis.providers',\n    ],\n    keywords=[\n        'fake',\n        'mock',\n        'data',\n        'populate',\n        'database',\n        'testing',\n        'generate',\n        'mimesis',\n        'dummy',\n    ],\n    package_data={\n        'mimesis': [\n            'data/*/*',\n        ],\n    },\n    exclude_package_data={\n        'mimesis': [\n            # It's for development.\n            'data/locale_template/*'\n        ],\n    },\n    data_files=[\n        ('', ['LICENSE']),\n    ],\n    classifiers=[\n        'License :: OSI Approved :: MIT License',\n        'Intended Audience :: Developers',\n        'Programming Language :: Python :: 3.5',\n        'Programming Language :: Python :: 3.6',\n        'Programming Language :: Python :: Implementation :: CPython',\n        'Operating System :: OS Independent',\n        'Topic :: Software Development',\n        'Topic :: Software Development :: Testing',\n    ],\n    tests_require=tests_requirements,\n    cmdclass={\n        'test': PyTest,\n        'version': Version,\n        'minify': Minimizer,\n        'upload': Upload,\n    },\n)\n", "path": "setup.py"}], "after_files": [{"content": "\"\"\"\n.. image:: https://raw.githubusercontent.com/lk-geimfari/mimesis/master/media/logo-large-nodescr.png\n\nMimesis\n-------\n\n**Mimesis** is a fast and easy to use the library for Python programming\nlanguage, which helps generate mock data for a variety of purposes in a\nvariety of languages. This data can be particularly useful during software\ndevelopment and testing. For example, it could be used to populate a\ntesting database for a web application with user information such as\nemail addresses, usernames, first names, last names, etc.\n\nDocumentation\n-------------\n\nMimesis is very simple to use, and the below examples should help you\nget started. Complete documentation for Mimesis is available on `Read\nthe Docs`_.\n\n.. _Read the Docs: http://mimesis.readthedocs.io/\n\nInstallation\n------------\n\nTo install mimesis, simply use pip (or `pipenv <http://pipenv.org/>`_):\n\n.. code:: bash\n\n    \u279c  ~ pip install mimesis\n\nGetting started\n---------------\n\nAs we said above, this library is really easy to use. A simple usage\nexample is given below:\n\n.. code:: python\n\n    >>> from mimesis import Personal\n    >>> from mimesis.enums import Gender\n    >>> person = Personal('en')\n\n    >>> person.full_name(gender=Gender.FEMALE)\n    'Antonetta Garrison'\n\n    >>> person.occupation()\n    'Backend Developer'\n\n    >>> for template in ('U_d', 'U-d', 'l_d', 'l-d'):\n    ...     person.username(template=template)\n\n    'Adders_1893'\n    'Abdel-1888'\n    'constructor_1884'\n    'chegre-2051'\n\nLocales\n-------\n\nYou can specify a locale when creating providers and they will return data that is appropriate for\nthe language or country associated with that locale. `Mimesis` currently includes support\nfor `33 different locales <http://mimesis.readthedocs.io/locales.html>`_.\n\nData Providers\n--------------\n\nList of supported data providers available `here <http://mimesis.readthedocs.io/providers.html>`_\n\n\"\"\"\n\nimport json\nimport os\nimport re\nimport sys\nfrom distutils.core import setup\nfrom os.path import abspath, dirname, exists, getsize, join, relpath, splitext\nfrom shutil import rmtree\n\nfrom setuptools import Command\nfrom setuptools.command.test import test as TestCommand\n\nVERSION_MINOR_MAX = 10\nVERSION_MICRO_MAX = 10\n\nhere = abspath(dirname(__file__))\n\nabout = {}\n# Get meta-data from __version__.py\nwith open(join(here, 'mimesis', '__version__.py')) as f:\n    exec(f.read(), about)\n\n\nclass BaseCommand(Command):\n    description = ''\n    user_options = []\n\n    def initialize_options(self):\n        pass\n\n    def finalize_options(self):\n        pass\n\n    def run(self):\n        pass\n\n\nclass Upload(BaseCommand):\n    \"\"\"Support setup.py upload.\"\"\"\n\n    def run(self):\n        try:\n            rmtree(os.path.join(here, 'dist'))\n        except OSError:\n            pass\n\n        os.system('{0} setup.py sdist bdist_wheel --universal'.format(sys.executable))\n        os.system('twine upload dist/*')\n        sys.exit()\n\n\nclass Minimizer(BaseCommand):\n    \"\"\"Minify content of all json file for all locales.\n    \"\"\"\n\n    def initialize_options(self):\n        \"\"\"Find all files of all locales.\n        \"\"\"\n\n        self.paths = []\n        self.data_path = '/mimesis/data'\n        self.separators = (',', ':')\n        self.data_dir = here + self.data_path\n        self.before_total = 0\n        self.after_total = 0\n\n        for root, _, files in os.walk(self.data_dir):\n            for file in sorted(files):\n                if splitext(file)[1] == '.json':\n                    self.paths.append(join(\n                        relpath(root, self.data_dir),\n                        file\n                    ))\n\n    @staticmethod\n    def size_of(num):\n        for unit in ['B', 'KB', 'MB']:\n            if abs(num) < 1024.0:\n                return \"%3.1f%s\" % (num, unit)\n            num = num / 1024.0\n        return \"%.1f\" % num\n\n    def minify(self, file_path):\n        size_before = getsize(file_path)\n        self.before_total += size_before\n        size_before = self.size_of(size_before)\n\n        with open(file_path, 'r', 1) as f:\n            json_text = json.loads(f.read())\n            minimized = json.dumps(\n                json_text, separators=self.separators, ensure_ascii=False)\n\n        if len(file_path) > 0:\n            output_path = abspath(file_path)\n            abs_path = abspath(dirname(output_path))\n\n            if not exists(abs_path):\n                os.makedirs(abs_path)\n\n            with open(output_path, 'w+', 1) as f:\n                f.write(minimized)\n\n        size_after = getsize(file_path)\n        self.after_total += size_after\n        size_after = self.size_of(size_after)\n\n        json_file = '/'.join(file_path.split('/')[-2:])\n\n        template = \"\\033[34m{}\\033[0m : \" \\\n                   \"\\033[92mminimized\\033[0m : \" \\\n                   \"\\033[33m{}\\033[0m -> \\033[92m{}\\033[0m\".format(\n            json_file,\n            size_before,\n            size_after,\n        )\n\n        print(template)\n\n    def run(self):\n        \"\"\"Start json minimizer and exit when all json\n        files was minimized.\n        \"\"\"\n        for rel_path in sorted(self.paths):\n            file_path = join(self.data_dir, rel_path)\n            self.minify(file_path)\n\n        after = self.size_of(self.after_total)\n        before = self.size_of(self.before_total)\n        saved = self.size_of(self.before_total - self.after_total)\n\n        template = '\\nTotal: ' \\\n                   '\\033[92m{}\\033[0m -> \\033[92m{}\\033[0m. ' \\\n                   'Compressed: \\033[92m{}\\033[0m\\n'.format(before, after, saved)\n\n        print(template)\n\n\nclass Version(BaseCommand):\n    \"\"\"Custom command for versioning\"\"\"\n\n    def initialize_options(self):\n        self.current = about['__version__']\n        print('Previous version: '\n              '\\033[33m{}\\033[0m.\\n'.format(self.current))\n\n    @staticmethod\n    def automatically(version):\n        \"\"\"Automatically increment version string.\n\n        :param version: Current version.\n        :return: Next version.\n        \"\"\"\n        major, minor, micro = [\n            int(i) for i in version.split('.')\n        ]\n\n        if VERSION_MICRO_MAX > micro:\n            micro += 1\n        elif VERSION_MICRO_MAX == micro:\n            micro = 0\n            minor += 1\n        elif VERSION_MINOR_MAX > minor:\n            minor += 1\n        elif VERSION_MINOR_MAX == minor:\n            micro, minor = 0, 0\n            major += 1\n        if VERSION_MINOR_MAX < minor:\n            minor, micro = 0, 0\n            major += 1\n\n        return '.'.join([str(i) for i\n                         in (major, minor, micro)])\n\n    def rewrite(self, version=None):\n        if not version:\n            version = self.current\n\n        with open(join(here, 'mimesis', '__version__.py'), 'r+') as f:\n            version_str = '__version__ = \\'{}\\''.format(version)\n            regexp = r'__version__ = .*'\n\n            meta = re.sub(regexp, version_str, f.read())\n            f.seek(0)\n            f.write(meta)\n            f.truncate()\n\n        print('Updated! Current version is: '\n              '\\033[34m{}\\033[0m.\\n'.format(version))\n\n        exit()\n\n    def run(self):\n        response = input('Are you sure? (yes/no): ')\n        if response.lower() in ('yes', 'y'):\n            self.rewrite(\n                self.automatically(\n                    self.current,\n                ),\n            )\n\n\nsetup(\n    name=about['__title__'],\n    version=about['__version__'],\n    description=about['__description__'],\n    long_description=__doc__,\n    author=about['__author__'],\n    author_email=about['__author_email__'],\n    url=about['__url__'],\n    license=about['__license__'],\n    packages=[\n        'mimesis',\n        'mimesis.data',\n        'mimesis.data.int',\n        'mimesis.builtins',\n        'mimesis.providers',\n    ],\n    keywords=[\n        'fake',\n        'mock',\n        'data',\n        'populate',\n        'database',\n        'testing',\n        'generate',\n        'mimesis',\n        'dummy',\n    ],\n    package_data={\n        'mimesis': [\n            'data/*/*',\n        ],\n    },\n    exclude_package_data={\n        'mimesis': [\n            # It's for development.\n            'data/locale_template/*'\n        ],\n    },\n    data_files=[\n        ('', ['LICENSE']),\n    ],\n    classifiers=[\n        'License :: OSI Approved :: MIT License',\n        'Intended Audience :: Developers',\n        'Programming Language :: Python :: 3.5',\n        'Programming Language :: Python :: 3.6',\n        'Programming Language :: Python :: Implementation :: CPython',\n        'Operating System :: OS Independent',\n        'Topic :: Software Development',\n        'Topic :: Software Development :: Testing',\n    ],\n    cmdclass={\n        'version': Version,\n        'minify': Minimizer,\n        'upload': Upload,\n    },\n)\n", "path": "setup.py"}]}