diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..9ee8362 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +dist +pramanpatram.egg-info \ No newline at end of file diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 18ea629..08a77e5 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -5,8 +5,10 @@ + - + + - { + "keyToString": { + "Python.pramanpatram.executor": "Run", + "Python.test_pramanpatram.executor": "Run", + "RunOnceActivity.ShowReadmeOnStart": "true", + "RunOnceActivity.git.unshallow": "true", + "git-widget-placeholder": "main", + "node.js.detected.package.eslint": "true", + "node.js.detected.package.tslint": "true", + "node.js.selected.package.eslint": "(autodetect)", + "node.js.selected.package.tslint": "(autodetect)", + "nodejs_package_manager_path": "npm", + "settings.editor.selected.configurable": "preferences.pluginManager", + "vue.rearranger.settings.migration": "true" } -}]]> +} @@ -69,7 +71,8 @@ - + + @@ -78,6 +81,6 @@ - + \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..a18fa26 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,27 @@ +[project] +name = "pramanpatram" +version = "1.0.1" +authors = [ + { name="Aryan Karamtoth", email="aryankmmiv@outlook.com" }, +] +description = "A Python Library to generate event certificates" +readme = "README.md" +requires-python = ">=3.12" +classifiers = [ + "Programming Language :: Python :: 3", + "License :: OSI Approved :: MIT License", + "Operating System :: OS Independent", +] +dependencies = [ + "pandas", + "PIL", + "pillow", + "textwrap" +] + +[project.urls] +Homepage = "https://github.com/SpaciousCoder78/pramanpatram-lib" +Issues = "https://github.com/SpaciousCoder78/pramanpatram-lib/issues" + +[project.license] +text = "MIT License" \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index 46ee757..19bef23 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ pandas PIL textwrap -setuptools \ No newline at end of file +pillow \ No newline at end of file diff --git a/setup.py b/setup.py index b42723f..78fd267 100644 --- a/setup.py +++ b/setup.py @@ -15,167 +15,125 @@ # This call to setup() does all the work setup( name="pramanpatram", - version="1.0.0", + version="1.0.1", description="Python Library for Generating Event Certificates", - long_description="""A simple Python library for Structural Beam Analysis developed by students of Kakatiya Institute of Technology and Science for Civil Engineering Applications - Python Library for Beam Analysis for Civil Engineering - -Developed by Aryan Karamtoth from Information Technology Department at Kakatiya Institute of Technology and Science + long_description="""A Python Library for Generating Event Certificates ## Supported Features - -- Making a beam -- Calculating Support Reactions of a beam -- Applying load on a beam +- Generating event certificates with only attendee names ## Installation +```sh +$ pip install pramanpatram ``` -pip install pramanpatram -``` + ## Getting Started Import the package ```py -import pramanpatram as patra +import Pramanpatram ``` -Read the documentation and apply the required method for your purpose +Create `.csv` file containing the Column header as `Attendees` with the Attendee names + +Pass the parameters into `patram.generate_certificates()`: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ParameterDescription
csv_pathPath of CSV File
sample_pathPath of Certificate Template File
text_coords_x X Coordinate of the text to be printed
text_coords_y Y Coordinate of the text to be printed
text_sizeSize of text to be printed
r_ValueRed Colour Value (Set to 0 for Black)
g_ValueGreen Colour Value (Set to 0 for Black)
b_ValueBlue Colour Value (Set to 0 for Black)
text_widthWidth of text
certificate_textText to be printed on the certificate (use {name} to print the name in the position)
certificate_pathLocation to save certificates
+ +Run the program to find your certificates in the path you mentioned. ## Documentation -### Built-in Methods: -- `createBeam(len)`: -Method for creating a beam - - Input: len --> Length of Beam - Output: beam --> Beam object - -Example: -```py -beam = bm.createBeam(10) -print(beam) -``` - -- `definePin(pinPos,beam)`: - -Method for defining the position of pin support - - Input: pinPos --> Pin Support Position - beam --> Beam object - Output: pinposition --> Pin Position - -Example: -```py -pinpos = bm.definePin(2,beam) -print(pinpos) -``` - -- `defineRoller(rollPos,beam)`: +### Available Methods +- `generate_certificates(self, csv_path, sample_path, text_coords_x, text_coords_y, text_size, r_value, g_value, b_value, text_width, certificate_text, certificate_path)` - Method for defining the position of roller support - - Input: rollPos --> Roller Support Position - beam --> Beam object - - Output: rollposition --> Roller Position + Takes 12 inputs and generates the certificates in the specified path Example: - ```py - rollpos = bm.defineRoller(4,beam) - print(rollpos) - ``` -- `applyPointLoad(loadPos,loadMag,beam)`: - - Method for applying Point Load on the beam - - Input: loadPos --> Position of Point Load - loadMag --> Magnitude of Point Load - beam --> Beam object - - Output: load --> Applied Load - Example: ```py - ptload = bm.applyPointLoad(4,60,beam) - print(ptload) + import os + from pramanpatram.pramanpatram import Pramanpatram + + def test_generate_certificate(): + csv_path = "attendees.csv" + sample_path = "sample.jpg" + text_coords_x = 110 + text_coords_y = 120 + text_size = 20 + r_value = 0 + g_value = 0 + b_value = 0 + text_width = 40 + certificate_text = "Thanks {name}" + certificate_path = "certificates" + + if not os.path.exists(csv_path): + print(f"CSV file not found at path: {csv_path}") + return + + if not os.path.exists(certificate_path): + os.makedirs(certificate_path) + print(f"Created directory for certificates at path: {certificate_path}") + + patram = Pramanpatram() + result = patram.generate_certificates(csv_path, sample_path, text_coords_x, text_coords_y, text_size, r_value, g_value, b_value, text_width, certificate_text, certificate_path) + print(result) + + test_generate_certificate() ``` -- `applyUDL(beam,loadPerUnitLength)`: - - Method for applying UDL (Uniformly Distributed Load) on the beam - - Input: beam --> Beam object - loadPerUnitLength --> Load Per Unit Length - - Output: udl --> Applied UDL - - Example: - - ```py - udlarray = bm.applyUDL(beam,20) - print(udlarray) - ``` - -- `applyUVL(beam,startLoad,endLoad)`: - - Method for applying UVL (Uniformly Varying Load) on the beam - - Input: beam --> Beam object - startLoad --> Start Load - endLoad --> End Load - - Output: uvl --> Applied UVL - - Example: - ```py - uvlarray = bm.applyUVL(beam,20,40) - print(uvlarray) - ``` -- `applyMoment(momentPos, momentMag, beam)`: - - Method for applying Moment on the beam - - Input: momentPos --> Moment Position - momentMag --> Moment Magnitude - beam --> Beam Object - - Output: moments --> Moment Applied - - Example: - ```py - appliedmoment = bm.applyMoment(3,20,beam) - print(appliedmoment) - ``` -- `calcReactionsSSB(loads, pinPos, rollPos, beam)`: - - Method for calculation support reaction of a simply supported beam with various loads - - Input: loads --> Dictionary containing load data - beam --> Beam Object - pinPos --> Pin Position - rollPos --> Roller Support Position - - Output: Ra --> Reaction at pin support - Rb --> Reaction at roller support - - Example: - - ```py - loads = [ - {'type': 'point', 'position': 2, 'magnitude': 50}, - {'type': 'udl', 'start': 3, 'end': 5, 'magnitude': 20}, - {'type': 'uvl', 'start': 6, 'end': 8, 'start_magnitude': 10, 'end_magnitude': 30} - ] - pinPos = 1 - rollPos = 9 - Ra, Rb = bm.calcReactionsSSB(loads, pinPos, rollPos, beam) - print(Ra) - print(Rb) - ``` - - - """ , @@ -199,5 +157,5 @@ ], packages=["pramanpatram"], include_package_data=True, - install_requires=["pandas","PIL","textwrap", "setuptools"] + install_requires=["pandas","PIL","pillow","textwrap"] ) \ No newline at end of file diff --git a/tests/test_pramanpatram.py b/tests/test_pramanpatram.py index ceac229..565cfa8 100644 --- a/tests/test_pramanpatram.py +++ b/tests/test_pramanpatram.py @@ -2,14 +2,14 @@ from pramanpatram.pramanpatram import Pramanpatram def test_generate_certificate(): - csv_path = "attendees.csv" - sample_path = "sample.jpg" - text_coords_x = 450 - text_coords_y = 530 + csv_path = "attendees.csv" #csv path + sample_path = "sample.jpg" #sample path + text_coords_x = 110 + text_coords_y = 120 text_size = 20 - r_value = 0 - g_value = 0 - b_value = 0 + r_value = 0 #black + g_value = 0 #black + b_value = 0 #black text_width = 40 certificate_text = "Thanks {name}" certificate_path = "certificates"