SimpleGeometryCalc 0.0.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- simplegeometrycalc-0.0.2/.github/workflows/python-publish.yml +70 -0
- simplegeometrycalc-0.0.2/LICENSE +5 -0
- simplegeometrycalc-0.0.2/PKG-INFO +19 -0
- simplegeometrycalc-0.0.2/README.md +10 -0
- simplegeometrycalc-0.0.2/SimpleGeometryCalc/__init__.py +148 -0
- simplegeometrycalc-0.0.2/pyproject.toml +17 -0
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
# This workflow will upload a Python Package to PyPI when a release is created
|
|
2
|
+
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python#publishing-to-package-registries
|
|
3
|
+
|
|
4
|
+
# This workflow uses actions that are not certified by GitHub.
|
|
5
|
+
# They are provided by a third-party and are governed by
|
|
6
|
+
# separate terms of service, privacy policy, and support
|
|
7
|
+
# documentation.
|
|
8
|
+
|
|
9
|
+
name: Upload Python Package
|
|
10
|
+
|
|
11
|
+
on:
|
|
12
|
+
release:
|
|
13
|
+
types: [published]
|
|
14
|
+
|
|
15
|
+
permissions:
|
|
16
|
+
contents: read
|
|
17
|
+
|
|
18
|
+
jobs:
|
|
19
|
+
release-build:
|
|
20
|
+
runs-on: ubuntu-latest
|
|
21
|
+
|
|
22
|
+
steps:
|
|
23
|
+
- uses: actions/checkout@v4
|
|
24
|
+
|
|
25
|
+
- uses: actions/setup-python@v5
|
|
26
|
+
with:
|
|
27
|
+
python-version: "3.x"
|
|
28
|
+
|
|
29
|
+
- name: Build release distributions
|
|
30
|
+
run: |
|
|
31
|
+
# NOTE: put your own distribution build steps here.
|
|
32
|
+
python -m pip install build
|
|
33
|
+
python -m build
|
|
34
|
+
|
|
35
|
+
- name: Upload distributions
|
|
36
|
+
uses: actions/upload-artifact@v4
|
|
37
|
+
with:
|
|
38
|
+
name: release-dists
|
|
39
|
+
path: dist/
|
|
40
|
+
|
|
41
|
+
pypi-publish:
|
|
42
|
+
runs-on: ubuntu-latest
|
|
43
|
+
needs:
|
|
44
|
+
- release-build
|
|
45
|
+
permissions:
|
|
46
|
+
# IMPORTANT: this permission is mandatory for trusted publishing
|
|
47
|
+
id-token: write
|
|
48
|
+
|
|
49
|
+
# Dedicated environments with protections for publishing are strongly recommended.
|
|
50
|
+
# For more information, see: https://docs.github.com/en/actions/deployment/targeting-different-environments/using-environments-for-deployment#deployment-protection-rules
|
|
51
|
+
environment:
|
|
52
|
+
name: pypi
|
|
53
|
+
# OPTIONAL: uncomment and update to include your PyPI project URL in the deployment status:
|
|
54
|
+
# url: https://pypi.org/p/YOURPROJECT
|
|
55
|
+
#
|
|
56
|
+
# ALTERNATIVE: if your GitHub Release name is the PyPI project version string
|
|
57
|
+
# ALTERNATIVE: exactly, uncomment the following line instead:
|
|
58
|
+
# url: https://pypi.org/project/YOURPROJECT/${{ github.event.release.name }}
|
|
59
|
+
|
|
60
|
+
steps:
|
|
61
|
+
- name: Retrieve release distributions
|
|
62
|
+
uses: actions/download-artifact@v4
|
|
63
|
+
with:
|
|
64
|
+
name: release-dists
|
|
65
|
+
path: dist/
|
|
66
|
+
|
|
67
|
+
- name: Publish release distributions to PyPI
|
|
68
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
69
|
+
with:
|
|
70
|
+
packages-dir: dist/
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: SimpleGeometryCalc
|
|
3
|
+
Version: 0.0.2
|
|
4
|
+
Summary: A small library to calculate most variables of shapes from just one!
|
|
5
|
+
Author: Tatpoato
|
|
6
|
+
License-File: LICENSE
|
|
7
|
+
Keywords: Geometry,Simple,calc,geometry,simple
|
|
8
|
+
Description-Content-Type: text/markdown
|
|
9
|
+
|
|
10
|
+
# SimpleGeometry
|
|
11
|
+
A simple python library to calculate variables of shapes with only one input.
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
# Pip
|
|
16
|
+
|
|
17
|
+
now hopefully available via pip install ShapeCalc
|
|
18
|
+
|
|
19
|
+
:pray:
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Made by Tatpoato
|
|
3
|
+
|
|
4
|
+
This python library helps you with the math of different shapes:
|
|
5
|
+
Commands:
|
|
6
|
+
formulas(shape) -- formulas allows you to rewiew the formulas of either a square or a circle (if you forgot them)
|
|
7
|
+
allesumcircle(r=,d=,c=,a=) -- allesumcircle allows you to input either the radius (r) or the diameter (d) or the circumference (c) or the area (a) and gain access to all the other variables with the simple command. you can also turn printing off by doing Print=False.
|
|
8
|
+
allesumsquare(s=,a=,p=,d=, Print=False) -- allesumsquare allows you to input either the sides (s) or the area (a) or the perimeter (p) or the diagonal (d) and gain access to all the other variables. you can also turn printing off by doing Print=False.
|
|
9
|
+
Variables that come with this library:
|
|
10
|
+
pi -- the pi variable is just your standard pi (3.14159265358979323846264338)
|
|
11
|
+
"""
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def formulas(shape):
|
|
15
|
+
print("Info:")
|
|
16
|
+
print("I currently give you all the ways to get to one base which i base the rest of the formulas off")
|
|
17
|
+
print("translation:")
|
|
18
|
+
print("-- / is to divide", "-- * is to multiply", "-- ** is to take something to the power of something else", "-- ** 0.5 is the square root of something", "", sep="\n")
|
|
19
|
+
if shape == "circle":
|
|
20
|
+
print("Circle:")
|
|
21
|
+
print("Everything for the radius:")
|
|
22
|
+
print("r = diameter / 2", "r = circumference / pi (3.14) / 2", "r = Area / pi (3.14)", sep="\n")
|
|
23
|
+
print("Diameter formula")
|
|
24
|
+
print("d = radius * 2 (the diameter is double the radius.)")
|
|
25
|
+
print("Area formula")
|
|
26
|
+
print("a = pi (3.14) * radius ** 2")
|
|
27
|
+
print("Circumference formula")
|
|
28
|
+
print("c = 2 * pi (3.14) * r")
|
|
29
|
+
if shape == "square":
|
|
30
|
+
print("Everything for the sides")
|
|
31
|
+
print("s = Perimeter / 4", "s = Area ** 0.5", "s = diagonal / 2 ** 0.5")
|
|
32
|
+
print("Perimeter formula")
|
|
33
|
+
print("p = Side * 4")
|
|
34
|
+
print("Area formula")
|
|
35
|
+
print("a = side * side (side ** 2)")
|
|
36
|
+
print("Diagonal formula (Pythagoras)")
|
|
37
|
+
print("d = 2 ** 0.5 * s")
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
pi = 3.14159265358979323846264338
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
def allesumcircle(r=None, d=None,c=None,a=None, Print=True, Dict=False):
|
|
44
|
+
actuallyinputtedstuff = True
|
|
45
|
+
if r is not None:
|
|
46
|
+
circ = 2 * pi * r
|
|
47
|
+
diam = r * 2
|
|
48
|
+
a = pi * r **2
|
|
49
|
+
woah = (f"Circumference = {circ}\n"
|
|
50
|
+
f"Radius = {r}\n"
|
|
51
|
+
f"Diameter = {diam}\n"
|
|
52
|
+
f"Area = {a}\n")
|
|
53
|
+
elif d is not None:
|
|
54
|
+
diam = d
|
|
55
|
+
r = d / 2
|
|
56
|
+
circ = 2 * pi * r
|
|
57
|
+
a = pi * r ** 2
|
|
58
|
+
woah = (f"Circumference = {circ}\n"
|
|
59
|
+
f"Radius = {r}\n"
|
|
60
|
+
f"Diameter = {diam}\n"
|
|
61
|
+
f"Area = {a}\n")
|
|
62
|
+
elif c is not None:
|
|
63
|
+
diam = c / pi / 2
|
|
64
|
+
r = diam / 2
|
|
65
|
+
a = pi * r ** 2
|
|
66
|
+
woah = (f"Circumference = {c}\n"
|
|
67
|
+
f"Radius = {r}\n"
|
|
68
|
+
f"Diameter = {diam}\n"
|
|
69
|
+
f"Area = {a}\n")
|
|
70
|
+
elif a is not None:
|
|
71
|
+
r = a / pi
|
|
72
|
+
r = r ** 0.5
|
|
73
|
+
circ = 2 * pi * r
|
|
74
|
+
diam = r * 2
|
|
75
|
+
woah = (f"Circumference = {circ}\n"
|
|
76
|
+
f"Radius = {r}\n"
|
|
77
|
+
f"Diameter = {diam}\n"
|
|
78
|
+
f"Area = {a}\n")
|
|
79
|
+
else:
|
|
80
|
+
woah = "D:"
|
|
81
|
+
actuallyinputtedstuff = False
|
|
82
|
+
|
|
83
|
+
if Print == False and Dict == False:
|
|
84
|
+
return woah
|
|
85
|
+
elif Print == True:
|
|
86
|
+
print(woah)
|
|
87
|
+
elif Dict == True and actuallyinputtedstuff != False:
|
|
88
|
+
return {"radius": r, "diameter": diam, "circumference": circ, "area": a}
|
|
89
|
+
else:
|
|
90
|
+
woah = "How did you reach this?"
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
def allesumsquare(s=None, a=None, p=None, d=None, Print=True, Dict=False):
|
|
97
|
+
actuallyinputtedstuff = True
|
|
98
|
+
if s is not None:
|
|
99
|
+
a = s * s
|
|
100
|
+
p = s * 4
|
|
101
|
+
d = 2 ** 0.5 * s
|
|
102
|
+
woah = (f"Side = {s}\n"
|
|
103
|
+
f"Area = {a}\n"
|
|
104
|
+
f"Perimeter = {p}\n"
|
|
105
|
+
f"Diagonal = {d}\n")
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
elif a is not None:
|
|
109
|
+
s = a ** 0.5
|
|
110
|
+
p = s * 4
|
|
111
|
+
d = 2 ** 0.5 * s
|
|
112
|
+
woah = (f"Side = {s}\n"
|
|
113
|
+
f"Area = {a}\n"
|
|
114
|
+
f"Perimeter = {p}\n"
|
|
115
|
+
f"Diagonal = {d}\n")
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
elif p is not None:
|
|
119
|
+
s = p / 4
|
|
120
|
+
a = s * s
|
|
121
|
+
d = 2 ** 0.5 * s
|
|
122
|
+
woah = (f"Side = {s}\n"
|
|
123
|
+
f"Area = {a}\n"
|
|
124
|
+
f"Perimeter = {p}\n"
|
|
125
|
+
f"Diagonal = {d}\n")
|
|
126
|
+
|
|
127
|
+
elif d is not None:
|
|
128
|
+
s = d / 2 ** 0.5
|
|
129
|
+
a = s * s
|
|
130
|
+
p = s * 4
|
|
131
|
+
woah = (f"Side = {s}\n"
|
|
132
|
+
f"Area = {a}\n"
|
|
133
|
+
f"Perimeter = {p}\n"
|
|
134
|
+
f"Diagonal = {d}\n")
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
else:
|
|
138
|
+
woah = "D:"
|
|
139
|
+
actuallyinputtedstuff = False
|
|
140
|
+
|
|
141
|
+
if Print == False and Dict == False:
|
|
142
|
+
return woah
|
|
143
|
+
elif Print == True:
|
|
144
|
+
print(woah)
|
|
145
|
+
elif Dict == True and actuallyinputtedstuff != False:
|
|
146
|
+
return {"side": s, "area": a, "perimeter": p, "diagonal": d}
|
|
147
|
+
else:
|
|
148
|
+
print("How did you reach this?")
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["hatchling >= 1.26"]
|
|
3
|
+
build-backend = "hatchling.build"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "SimpleGeometryCalc"
|
|
7
|
+
version = "0.0.2"
|
|
8
|
+
description = "A small library to calculate most variables of shapes from just one!"
|
|
9
|
+
authors = [
|
|
10
|
+
{ name = "Tatpoato" }
|
|
11
|
+
]
|
|
12
|
+
keywords = ["Geometry", "Simple", "simple", "geometry", "calc"]
|
|
13
|
+
readme = "README.md"
|
|
14
|
+
# license = "Custom / Non modifiable for Commercial use."
|
|
15
|
+
|
|
16
|
+
[tool.hatch.build.targets.wheel]
|
|
17
|
+
packages = ["SimpleGeometry"]
|