From 0517e445819c2bbf462fb2bba29b42ee08bb38ee Mon Sep 17 00:00:00 2001 From: Christopher Greening Date: Fri, 20 Oct 2023 21:59:49 +0200 Subject: [PATCH 01/10] ADD: added setup for PyPI launch of double pendula --- setup.py | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 setup.py diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..9b18910 --- /dev/null +++ b/setup.py @@ -0,0 +1,25 @@ +"""Setup script for publishing package to PyPI""" + +import setuptools + +with open("README.md", "r", encoding='UTF-8') as fh: + long_description = fh.read() + +setuptools.setup( + name="double-pendula", + version="0.1.0", + author="Chris Greening", + author_email="chris@christophergreening.com", + description="Library for animating double pendula in Python", + long_description=long_description, + long_description_content_type="text/markdown", + url="https://github.com/chris-greening/double-pendula", + packages=setuptools.find_packages(), + install_requires=["numpy"], + classifiers=[ + "Programming Language :: Python :: 3", + "License :: OSI Approved :: MIT License", + "Operating System :: OS Independent", + ], + python_requires=">=3.7", +) From b2a0b16358fbc76ece25b2a963f8a991bcb31150 Mon Sep 17 00:00:00 2001 From: Christopher Greening Date: Fri, 20 Oct 2023 22:03:17 +0200 Subject: [PATCH 02/10] ADD: added PyPI script for uploading to PyPI --- bin/pypi | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 bin/pypi diff --git a/bin/pypi b/bin/pypi new file mode 100644 index 0000000..7f7c3b4 --- /dev/null +++ b/bin/pypi @@ -0,0 +1,24 @@ +#!/bin/bash + +#Automate the process of uploading package to PyPI + +#Delete older version build directories +directories=("dist/" "build/" "double-pendula.egg-info/") +for d in ${directories[@]}; +do + if [ -d $d ]; + then + rm -rf $d + echo "$d deleted!" + fi +done + +# cd docs +# sphinx-apidoc -o source/ ../spyrograph/ --separate +# make clean +# make html +# cd .. + +#Setup package and initiate upload to PyPI +python3 setup.py sdist bdist_wheel +twine upload dist/* From 29cb7d4e8af4418d2691ed4b601e1dd245937e5b Mon Sep 17 00:00:00 2001 From: Christopher Greening Date: Fri, 20 Oct 2023 22:15:34 +0200 Subject: [PATCH 03/10] ADD: added pandas and scipy to install requires --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 9b18910..90bc412 100644 --- a/setup.py +++ b/setup.py @@ -15,7 +15,7 @@ long_description_content_type="text/markdown", url="https://github.com/chris-greening/double-pendula", packages=setuptools.find_packages(), - install_requires=["numpy"], + install_requires=["numpy", "pandas", "scipy"], classifiers=[ "Programming Language :: Python :: 3", "License :: OSI Approved :: MIT License", From e6e69557af8fa3c1b20fb901be088ff10663d907 Mon Sep 17 00:00:00 2001 From: Christopher Greening Date: Fri, 20 Oct 2023 22:15:52 +0200 Subject: [PATCH 04/10] ADD: added pandas and scipy to install requires --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 90bc412..3755c45 100644 --- a/setup.py +++ b/setup.py @@ -7,7 +7,7 @@ setuptools.setup( name="double-pendula", - version="0.1.0", + version="0.1.1", author="Chris Greening", author_email="chris@christophergreening.com", description="Library for animating double pendula in Python", From 17e39b4b46c034465540091c4cf5423f207d2213 Mon Sep 17 00:00:00 2001 From: Christopher Greening Date: Fri, 20 Oct 2023 22:19:15 +0200 Subject: [PATCH 05/10] MODIFY: changed version number and name of package as it appears for the import --- setup.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index 3755c45..4d1c466 100644 --- a/setup.py +++ b/setup.py @@ -6,8 +6,8 @@ long_description = fh.read() setuptools.setup( - name="double-pendula", - version="0.1.1", + name="double_pendula", + version="0.1.2", author="Chris Greening", author_email="chris@christophergreening.com", description="Library for animating double pendula in Python", From a99e93045f34626acac462eee2259c84eeb793a8 Mon Sep 17 00:00:00 2001 From: Christopher Greening Date: Fri, 20 Oct 2023 22:26:29 +0200 Subject: [PATCH 06/10] MODIFY: changed the name double-pendula --- setup.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index 4d1c466..357f0b2 100644 --- a/setup.py +++ b/setup.py @@ -6,8 +6,8 @@ long_description = fh.read() setuptools.setup( - name="double_pendula", - version="0.1.2", + name="double-pendula", + version="0.1.3", author="Chris Greening", author_email="chris@christophergreening.com", description="Library for animating double pendula in Python", From d3de39a73aec818751efcd67dca9b9cfd7196dae Mon Sep 17 00:00:00 2001 From: Christopher Greening Date: Fri, 20 Oct 2023 22:27:30 +0200 Subject: [PATCH 07/10] ADD: added __init__ --- double_pendula/__init__.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 double_pendula/__init__.py diff --git a/double_pendula/__init__.py b/double_pendula/__init__.py new file mode 100644 index 0000000..e69de29 From 610100e90d8ef747f8ec131ef9e3a5696b6f1073 Mon Sep 17 00:00:00 2001 From: Christopher Greening Date: Fri, 20 Oct 2023 22:31:42 +0200 Subject: [PATCH 08/10] FIX: fixed imports to be relative --- double_pendula/double_pendulum.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/double_pendula/double_pendulum.py b/double_pendula/double_pendulum.py index 6f0c09b..5db3ff8 100644 --- a/double_pendula/double_pendulum.py +++ b/double_pendula/double_pendulum.py @@ -8,8 +8,8 @@ import numpy as np from scipy import constants -from pendulum import Pendulum -from equations import derivative, solve_ode +from .pendulum import Pendulum +from .equations import derivative, solve_ode class DoublePendulum: """Model of a double pendulum""" From 04781ef112bf53ee9949936b3dad0f40c0f99e0f Mon Sep 17 00:00:00 2001 From: Christopher Greening Date: Fri, 20 Oct 2023 22:35:40 +0200 Subject: [PATCH 09/10] MODIFY: renamed anywhere that says pendulum to pendula where approp --- double_pendula/{double_pendulum.py => double_pendula.py} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename double_pendula/{double_pendulum.py => double_pendula.py} (99%) diff --git a/double_pendula/double_pendulum.py b/double_pendula/double_pendula.py similarity index 99% rename from double_pendula/double_pendulum.py rename to double_pendula/double_pendula.py index 5db3ff8..8b1df57 100644 --- a/double_pendula/double_pendulum.py +++ b/double_pendula/double_pendula.py @@ -11,7 +11,7 @@ from .pendulum import Pendulum from .equations import derivative, solve_ode -class DoublePendulum: +class DoublePendula: """Model of a double pendulum""" # pylint: disable=too-many-instance-attributes tmax = 15.0 From ea85b1b4913a662a83f56ec036e501281a519299 Mon Sep 17 00:00:00 2001 From: Christopher Greening Date: Fri, 20 Oct 2023 22:39:22 +0200 Subject: [PATCH 10/10] MODIFY: changed the location of animate func --- ...animate_double_pendula.py => animate_double_pendula.py | 8 ++++---- setup.py | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) rename double_pendula/animate_double_pendula.py => animate_double_pendula.py (92%) diff --git a/double_pendula/animate_double_pendula.py b/animate_double_pendula.py similarity index 92% rename from double_pendula/animate_double_pendula.py rename to animate_double_pendula.py index 0567614..8ee45b9 100644 --- a/double_pendula/animate_double_pendula.py +++ b/animate_double_pendula.py @@ -12,7 +12,7 @@ import matplotlib.pyplot as plt from matplotlib import animation -from double_pendulum import DoublePendulum +from double_pendula.double_pendula import DoublePendula def random_hex() -> str: """Return a random hex color i.e. #FFFFFF""" @@ -43,7 +43,7 @@ def animate(i): def create_axes( fig: "matplotlib.figure.Figure", - pendula: List["DoublePendulum"] + pendula: List["DoublePendula"] ) -> List["matplotlib.axes._subplots.AxesSubplot"]: """Create all the individual axes for the double pendula""" axes = [] @@ -61,7 +61,7 @@ def create_axes( return axes def _create_individual_axis( - longest_double_pendulum: "DoublePendulum", + longest_double_pendulum: "DoublePendula", fig: "matplotlib.figure.Figure", i: int ) -> None: @@ -88,7 +88,7 @@ def _create_individual_axis( if __name__ == "__main__": # Create the pendula fig = plt.figure() - pendula = DoublePendulum.create_multiple_double_pendula(num_pendula=10) + pendula = DoublePendula.create_multiple_double_pendula(num_pendula=10) axes = create_axes(fig=fig, pendula=pendula) pendula_axes = list(zip(pendula, axes)) diff --git a/setup.py b/setup.py index 357f0b2..13badbf 100644 --- a/setup.py +++ b/setup.py @@ -7,7 +7,7 @@ setuptools.setup( name="double-pendula", - version="0.1.3", + version="0.1.4", author="Chris Greening", author_email="chris@christophergreening.com", description="Library for animating double pendula in Python",