Skip to content

Commit 9ffed41

Browse files
authored
Merge pull request Py-Contributors#35 from codePerfectPlus/type-check
Updated the fastapi and docs
2 parents d7b3ff4 + 6e68606 commit 9ffed41

File tree

12 files changed

+278
-159
lines changed

12 files changed

+278
-159
lines changed

CHANGELOG.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
4+
5+
## Changelog
6+
7+
## [Unreleased]
8+
9+
- Moved test files to random_profile to avoid flake8:402 error
10+
- Following proper changelog format, added changelog file
11+
- Added config for readthedocs
12+
13+
## [v0.2.3] - 13-10-2022
14+
15+
- Flask app added
16+
- Date of Birth Added
17+
- Age added
18+
- Height and Weight Added
19+
- Blood Group and hair color added
20+
- Job title added
21+
- More email domains added
22+
- Bugs Fixed
23+
24+
## [v0.2.1] - 12-10-2022
25+
26+
- More variation added to the data
27+
- Test cases added
28+
- Created a separate file for data loadings
29+
- Fixed some bugs
30+
31+
32+
## [V0.0.1] - 19-03-2020
33+
34+
- Initial Release

CODE_OF_CONDUCT.md

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
# Contributor Covenant Code of Conduct
2+
3+
## Our Pledge
4+
5+
In the interest of fostering an open and welcoming environment, we as
6+
contributors and maintainers pledge to making participation in our project and
7+
our community a harassment-free experience for everyone, regardless of age, body
8+
size, disability, ethnicity, sex characteristics, gender identity and expression,
9+
level of experience, education, socio-economic status, nationality, personal
10+
appearance, race, religion, or sexual identity and orientation.
11+
12+
## Our Standards
13+
14+
Examples of behavior that contributes to creating a positive environment
15+
include:
16+
17+
* Using welcoming and inclusive language
18+
* Being respectful of differing viewpoints and experiences
19+
* Gracefully accepting constructive criticism
20+
* Focusing on what is best for the community
21+
* Showing empathy towards other community members
22+
23+
Examples of unacceptable behavior by participants include:
24+
25+
* The use of sexualized language or imagery and unwelcome sexual attention or
26+
advances
27+
* Trolling, insulting/derogatory comments, and personal or political attacks
28+
* Public or private harassment
29+
* Publishing others' private information, such as a physical or electronic
30+
address, without explicit permission
31+
* Other conduct which could reasonably be considered inappropriate in a
32+
professional setting
33+
34+
## Our Responsibilities
35+
36+
Project maintainers are responsible for clarifying the standards of acceptable
37+
behavior and are expected to take appropriate and fair corrective action in
38+
response to any instances of unacceptable behavior.
39+
40+
Project maintainers have the right and responsibility to remove, edit, or
41+
reject comments, commits, code, wiki edits, issues, and other contributions
42+
that are not aligned to this Code of Conduct, or to ban temporarily or
43+
permanently any contributor for other behaviors that they deem inappropriate,
44+
threatening, offensive, or harmful.
45+
46+
## Scope
47+
48+
This Code of Conduct applies both within project spaces and in public spaces
49+
when an individual is representing the project or its community. Examples of
50+
representing a project or community include using an official project e-mail
51+
address, posting via an official social media account, or acting as an appointed
52+
representative at an online or offline event. Representation of a project may be
53+
further defined and clarified by project maintainers.
54+
55+
## Enforcement
56+
57+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
58+
reported by contacting the project team at [email protected]. All
59+
complaints will be reviewed and investigated and will result in a response that
60+
is deemed necessary and appropriate to the circumstances. The project team is
61+
obligated to maintain confidentiality with regard to the reporter of an incident.
62+
Further details of specific enforcement policies may be posted separately.
63+
64+
Project maintainers who do not follow or enforce the Code of Conduct in good
65+
faith may face temporary or permanent repercussions as determined by other
66+
members of the project's leadership.
67+
68+
## Attribution
69+
70+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71+
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
72+
73+
[homepage]: https://www.contributor-covenant.org
74+
75+
For answers to common questions about this code of conduct, see
76+
https://www.contributor-covenant.org/faq

CONTRIBUTING.md

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
# Contributing to RandomProfileGenerator
2+
3+
We love your input! We want to make contributing to this project as easy and transparent as possible, whether it's:
4+
5+
- Reporting a bug
6+
- Discussing the current state of the code
7+
- Submitting a fix
8+
- Proposing new features
9+
- Becoming a maintainer
10+
11+
## Steps to contribute
12+
13+
- Comment on the issue you want to work on. Make sure it's not assigned to someone else.
14+
15+
### Making a PR
16+
17+
> - Make sure you have been assigned the issue to which you are making a PR.
18+
> - If you make PR before being assigned, It may be labeled `invalid` and closed without merging.
19+
20+
- Fork the repo and clone it on your machine.
21+
- Add a upstream link to main branch in your cloned repo
22+
23+
```sh
24+
git remote add upstream https://github.com/py-contributors/RandomProfileGenerator.git
25+
```
26+
27+
- Keep your cloned repo upto date by pulling from upstream (this will also avoid any merge conflicts while committing new changes)
28+
29+
```sh
30+
git pull upstream master
31+
```
32+
33+
- Create your feature branch
34+
35+
```sh
36+
git checkout -b <feature-name>
37+
```
38+
39+
- Commit all the changes
40+
41+
```sh
42+
git commit -am "Meaningful commit message"
43+
```
44+
45+
- Push the changes for review
46+
47+
```sh
48+
git push origin <branch-name>
49+
```
50+
51+
- Create a PR from our repo on Github.
52+
53+
### Additional Notes
54+
55+
- Any changes should be made in the `dev` branch.
56+
- Changes should be logged in the `CHANGELOG.md` file.
57+
- Code should be properly commented to ensure it's readability.
58+
- If you've added code that should be tested, add tests as comments.
59+
- Make sure your code properly formatted.
60+
- Issue that pull request!
61+
62+
## Issue suggestions/Bug reporting
63+
64+
When you are creating an issue, make sure it's not already present. Furthermore, provide a proper description of the changes. If you are suggesting any code improvements, provide through details about the improvements.
65+
66+
**Great Issue suggestions** tend to have:
67+
68+
- A quick summary of the changes.
69+
- In case of any bug provide steps to reproduce
70+
- Be specific!
71+
- Give sample code if you can.
72+
- What you expected would happen
73+
- What actually happens
74+
- Notes (possibly including why you think this might be happening, or stuff you tried that didn't work)
75+
76+
77+
## License
78+
79+
By contributing, you agree that your contributions will be licensed under its [MIT License](http://choosealicense.com/licenses/mit/).

README.md

Lines changed: 13 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
<h1 align="center">
2-
<br>
3-
Random Profile Generator V0.2.3
4-
<br>
2+
<a href="https://pypi.org/project/random-profile/">
3+
Random Profile Generator
4+
</a>
5+
V0.2.3
56
</h1>
67

78
<h4 align="center">Python Module To Generate Random Profile Data</h4>
@@ -10,6 +11,7 @@
1011
<img src="https://img.shields.io/pypi/v/random-profile.svg">
1112
<img src="https://img.shields.io/pypi/pyversions/random-profile.svg">
1213
<img src="https://img.shields.io/pypi/l/random-profile.svg">
14+
1315
</p>
1416
<p align="center">
1517
<img src="https://img.shields.io/pypi/dd/random-profile.svg">
@@ -36,98 +38,36 @@ conda install random-profile # using anaconda
3638
```python
3739
from random_profile import RandomProfile
3840
rp = RandomProfile(num=5)
39-
'''
40-
41-
num = Total No. of Name You Want To Print
42-
default is 1
43-
change the num value according to your needs.
44-
'''
45-
# num can be overwritten in the function
46-
47-
# For first name
48-
rp.first_name(num=10)
49-
50-
# For full name
51-
rp.full_name(num=8)
5241

53-
# override the num value
5442
rp.full_profile(num=10)
55-
56-
# For last name
57-
rp.last_name(num=6)
5843
```
5944

45+
for detailed documentation check [here](https://randomprofilegenerator.readthedocs.io/)
46+
6047
### As Command Line Tool
6148

6249
```bash
6350
random-profile --help
6451
Usage: random-profile [OPTIONS]
65-
66-
usage: random_profile [-h] [-n N] [-f | -p | -l | -ip | -j]
67-
68-
optional arguments:
69-
-h, --help show this help message and exit
70-
-n N Number of random profiles
71-
-f, --fullname Get full name instead of first name
72-
-p, --profile Get full profile instead of first name
73-
-l, --lastname Get last name instead of first name
74-
-ip, --ipv4 Get an ipv4 IP address
75-
-j, --jobtitle Get job title
7652
```
7753

7854
```bash
79-
random-profile -n 10 -f # to get 10 full names
80-
random-profile -n 10 -p # to get 10 full profiles
81-
random-profile -n 10 -l # to get 10 last names
82-
random-profile -n 10 -ip # to get 10 ipv4 addresses
83-
random-profile -n 10 -j # to get 10 job titles
55+
random-profile -n 10 -p
8456
```
8557

58+
for detailed documentation check [here](https://randomprofilegenerator.readthedocs.io/)
8659

87-
## Support
60+
## Upcoming Features
8861

89-
Contributors for the Project
90-
[CodePerfectPLus](https://github.com/codePerfectPlus)
91-
...
92-
93-
## Roadmap
94-
95-
what's new in future update
96-
97-
- More Random data will be added to package.
98-
- Variety of Random-Data will increase.
62+
- Support for more languages
9963

10064
## Changelog
10165

102-
v0.2.3
103-
- Flask app added
104-
- Date of Birth Added
105-
- Age added
106-
- Height and Weight Added
107-
- Blood Group and hair color added
108-
- Job title added
109-
- More email domains added
110-
- Bugs Fixed
111-
112-
v0.2.1
113-
- More variation added to the data
114-
- Test cases added
115-
- Created a separate file for data loadings
116-
- Fixed some bugs
66+
Check the [Changelog](/CHANGELOG.md) for the latest changes.
11767

11868
## Contributing
11969

120-
Before submitting a bug, please do the following:
121-
122-
Perform basic troubleshooting steps:
123-
124-
- Make sure you are on the latest version. If you are not on the most recent version, your problem may have been solved already! Upgrading is always the best first step.
125-
- Try older versions. If you are already on the latest release, try rolling back a few minor versions (e.g. if on 1.7, try 1.5 or 1.6) and see if the problem goes away. This will help the devs narrow down when the problem first arose in the commit log.
126-
- Try switching up dependency versions. If the software in question has dependencies (other libraries, etc) try upgrading and downgrading those dependencies as well.
127-
128-
## Authors and acknowledgment
129-
130-
Show your appreciation to those who have contributed to the project.
70+
Check the [Contributing](/CONTRIBUTING.md) for the contribution guidelines.
13171

13272
## License
13373

_config.yml

Lines changed: 0 additions & 1 deletion
This file was deleted.

api/api.py

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,17 @@
1010
app = FastAPI()
1111

1212
query_model = create_model("num", num=(int, ...))
13+
api_version = "0.2.3"
1314

1415

1516
@app.get("/")
1617
def index():
17-
return {"status": "200", "message": "Welcome to Random Profile Generator API", "version": "0.2.3"}
18+
return {"status": "200",
19+
"message": "Welcome to Random Profile Generator API",
20+
"version": api_version}
1821

1922

20-
@app.get('/api/v1/random_profile')
23+
@app.get('/api/v1/random_profile/full_profile')
2124
async def multiple_profile(params: query_model = Depends()):
2225
""" Get multiple profile with all details
2326
@@ -26,7 +29,10 @@ async def multiple_profile(params: query_model = Depends()):
2629
"""
2730
params_as_dict = params.dict()
2831
if params_as_dict['num'] > 100:
29-
return {"status": "400", "message": "Number of profiles should be less than 100"}
32+
return {"status": "400",
33+
"message": "Number of profiles should be less than 100",
34+
"version": api_version}
35+
3036
num = params_as_dict['num']
3137
profile = rp.full_profile(num)
3238
return profile
@@ -42,7 +48,10 @@ async def multiple_first_name(params: query_model = Depends()):
4248
"""
4349
params_as_dict = params.dict()
4450
if params_as_dict['num'] > 100:
45-
return {"status": "400", "message": "Number of profiles should be less than 100"}
51+
return {"status": "400",
52+
"message": "Number of profiles should be less than 100",
53+
"version": api_version}
54+
4655
num = params_as_dict['num']
4756
first_names = rp.first_name(num)
4857
return first_names
@@ -58,7 +67,10 @@ async def multiple_last_name(params: query_model = Depends()):
5867
"""
5968
params_as_dict = params.dict()
6069
if params_as_dict['num'] > 100:
61-
return {"status": "400", "message": "Number of profiles should be less than 100"}
70+
return {"status": "400",
71+
"message": "Number of profiles should be less than 100",
72+
"version": api_version}
73+
6274
num = params_as_dict['num']
6375
last_names = rp.last_name(num)
6476
return last_names
@@ -74,7 +86,10 @@ async def multiple_full_name(params: query_model = Depends()):
7486
"""
7587
params_as_dict = params.dict()
7688
if params_as_dict['num'] > 100:
77-
return {"status": "400", "message": "Number of profiles should be less than 100"}
89+
return {"status": "400",
90+
"message": "Number of profiles should be less than 100",
91+
"version": api_version}
92+
7893
num = params_as_dict['num']
7994

8095
full_names = rp.full_name(num)
@@ -86,7 +101,7 @@ def custom_openapi():
86101
return app.openapi_schema
87102
openapi_schema = get_openapi(
88103
title="Random Profile Generator API",
89-
version="0.2.3",
104+
version=api_version,
90105
description="Python Module To Generate Random Profile Data",
91106
routes=app.routes,
92107
)

0 commit comments

Comments
 (0)