Skip to content

Commit dac673b

Browse files
refactoring codebase
Signed-off-by: Deepak Raj <[email protected]>
1 parent 73aa390 commit dac673b

File tree

7 files changed

+32
-144
lines changed

7 files changed

+32
-144
lines changed

api/api.py

-118
This file was deleted.

api/requirements.txt

-3
This file was deleted.

docs/conf.py

+9-11
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
1+
import sys
2+
sys.path.append('.')
3+
4+
from random_profile.__about__ import *
15
from datetime import datetime
26

37

4-
project = 'Random Profile Generator'
5-
description = 'A random profile generator for testing purposes.'
6-
author = 'Deeapk Raj'
7-
release = '0.2.3'
8+
project = __package_name__
9+
description = __description__
10+
author = __author__
11+
release = __version__
812
year = datetime.now().year
913
copyright = "{} Deepak Raj".format(year)
1014
source_suffix = ".rst"
@@ -21,17 +25,11 @@
2125

2226
autosectionlabel_prefix_document = True
2327

24-
html_theme = 'sphinx_rtd_theme' # 'pydata_sphinx_theme' 'alabaster'
28+
html_theme = 'sphinx_rtd_theme'
2529

2630
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store', '.venv']
2731
html_sidebars = {'**': ['globaltoc.html', 'relations.html', 'sourcelink.html', 'searchbox.html']}
2832

29-
rst_epilog = """
30-
.. |project| replace:: Random Profile Generator
31-
.. |copyright| replace:: Copyright © {} Deepak Raj
32-
.. | community | replace:: `Py-Contributors <https://github.com/py-contributors/>`_
33-
""".format(year)
34-
3533
# epub settings
3634
epub_basename = project
3735
epub_theme = 'epub'

random_profile/__about__.py

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
__title__ = 'RandomProfileGenerator'
2+
__package_name__ = 'random_profile'
3+
__version__ = '3.0.1'
4+
__description__ = "Python Module To Generate Random Profile Data"
5+
__email__ = "[email protected]"
6+
__author__ = 'PyContributors'
7+
__github__ = 'https://github.com/Py-Contributors/RandomProfileGenerator'
8+
__pypi__ = 'https://pypi.org/project/random-profile/'
9+
__license__ = 'MIT License'

random_profile/api.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
from pydantic import create_model
66

77
sys.path.append('.')
8-
from random_profile.main import RandomProfile, VERSION
8+
from random_profile.main import RandomProfile
9+
from random_profile import __version__
910

1011
# random_profile==0.2.3 required
1112
rp = RandomProfile()
@@ -17,7 +18,7 @@
1718
metadata = {
1819
"status": "200",
1920
"message": "Success",
20-
"version": VERSION,
21+
"version": __version__,
2122
"author": "Deepak Raj",
2223
"author_email": "[email protected]",
2324
"github": "https://github.com/codeperfectplus"}
@@ -156,7 +157,7 @@ def custom_openapi():
156157
return app.openapi_schema
157158
openapi_schema = get_openapi(
158159
title="Random Profile Generator API",
159-
version=VERSION,
160+
version=__version__,
160161
description="Python Module To Generate Random Profile Data",
161162
routes=app.routes,
162163
)

random_profile/main.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@
1515

1616
from random_profile.enums.gender import Gender
1717
from random_profile import utils
18-
19-
VERSION = '3.0.1'
18+
from random_profile.__about__ import __version__
2019

2120
lname_txt = os.path.join(utils.ASSETS_DIR, "lnames.txt")
2221
fname_male_txt = os.path.join(utils.ASSETS_DIR, "fnames_male.txt")
@@ -69,7 +68,7 @@ def __init__(self, num: int = 1, gender: Gender = None):
6968
self.gender = gender
7069

7170
def __str__(self) -> str:
72-
return f'Random Profile Generator version {VERSION}'
71+
return f'Random Profile Generator version {__version__}'
7372

7473
def __repr__(self) -> str:
7574
return f'RandomProfile(num={self.num})'

setup.py

+8-6
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,25 @@
11
import setuptools
22
from glob import glob
33

4+
from random_profile.__about__ import *
5+
46
with open("README.md", "r") as fh:
57
long_description = fh.read()
68

79
with open("requirements.txt", "r") as fh:
810
requirements = fh.read().splitlines()
911

1012
setuptools.setup(
11-
name="random_profile",
12-
version="3.0.1",
13-
author="Deepak Raj",
14-
author_email="[email protected]",
15-
description="Generate Random Profile",
13+
name=__package_name__,
14+
version=__version__,
15+
author=__author__,
16+
author_email=__email__,
17+
description=__description__,
1618
long_description=long_description,
1719
long_description_content_type="text/markdown",
1820
install_requires=requirements,
1921
data_files=[('assets', glob('random_profile/assets/*'))],
20-
url="https://github.com/Py-Contributors/RandomProfileGenerator",
22+
url=__github__,
2123
packages=setuptools.find_packages(),
2224
project_urls={"Documentation": "https://pycontributors.readthedocs.io/projects/randomprofilegenerator/en/latest/",
2325
"Source": "https://github.com/Py-Contributors/RandomProfileGenerator",

0 commit comments

Comments
 (0)