Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add PyPI configuration #20

Merged
merged 10 commits into from
Oct 20, 2023
Original file line number Diff line number Diff line change
Expand Up @@ -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"""
Expand Down Expand Up @@ -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 = []
Expand All @@ -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:
Expand All @@ -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))

Expand Down
24 changes: 24 additions & 0 deletions bin/pypi
Original file line number Diff line number Diff line change
@@ -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/*
Empty file added double_pendula/__init__.py
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
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:
class DoublePendula:
"""Model of a double pendulum"""
# pylint: disable=too-many-instance-attributes
tmax = 15.0
Expand Down
25 changes: 25 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -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.4",
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", "pandas", "scipy"],
classifiers=[
"Programming Language :: Python :: 3",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
],
python_requires=">=3.7",
)