Skip to main content

No project description provided

Project description

classFunctions

A few simple functions that I use for teaching and demonstrations. Some of them are quite useful beyond those settings.

There are also instructions for publishing your own functions to PyPI.org so that you can easily use them on multiple computers and share them with others.

Publish to PyPI

First, run the terminal command if you don't already have these packages installed.

pip install setuptools wheel twine

In addition to the .py file that contains the functions, you will want to create other files with the file structure shown below, but using the folder and function names that are unique to your package.

File structure

  • class_functions/
    • class_functions/
      • init.py
      • main.py
    • setup.py
    • README.md
    • requirements.txt

init.py

from .main import tidyUpCols, assignmentPlots, relocate

main.py

This file contains the code for the class_functions package.

setup.py

from setuptools import setup, find_packages

# For using the README.md file as the project description
with open("README.md", "r") as f:
    description = f.read()

setup(
    name="class_functions",
    version="0.2.0", # Make sure to update this and the location of the whl file for each modification
    packages=find_packages(),
    install_requires=["pandas", "matplotlib", "seaborn"],
    # These next two lines are also needed to turn the README.md file into the project description
    long_description=description,
    long_description_content_type="text/markdown",
)

README.md

This is the README.md file.

requirements.txt

setuptools wheel twine

Create the distribution and whl files

Run the following terminal command in the folder where setup.py is located:

python setup.py sdist bdist_wheel

Test locally

You can install this on your computer where your other Python libraries are located using the following terminal command from the folder where the setup.py file is located:

pip install dist/class_functions-0.1-py3-none-any.whl

If you need to reinstall it, run it with --force-reinstall to force installation of the whl file.

You can now run the terminal command pip list to see the package listed with the others on your computer. You can also try using functions in a new IPYNB or PY file just like any other package.

Upload to PyPI

First create an account on PyPI.org and create an API token. It's free to do so.

Then upload it using the following terminal command from the same folder as your setup.py file:

twine upload dist/*

Be prepared to enter your API token. Alternatively, you can set environment variables so that they can be accessed as part of a workflow that does not need manual intervention by running the following terminal commands: export TWINE_USERNAME=__token__ export TWINE_PASSWORD=[api_token]

Once It is uploaded, anyone can download and install the package using the terminal command:

pip install classFunctions

Hattip

Thanks to pixegami for the wonderful video detailing how to do this.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

class_functions-0.2.2.tar.gz (4.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

class_functions-0.2.2-py3-none-any.whl (4.6 kB view details)

Uploaded Python 3

File details

Details for the file class_functions-0.2.2.tar.gz.

File metadata

  • Download URL: class_functions-0.2.2.tar.gz
  • Upload date:
  • Size: 4.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.0

File hashes

Hashes for class_functions-0.2.2.tar.gz
Algorithm Hash digest
SHA256 923baef41dc2d8988805ffcc3600398a55c8b1d841999840fb06082ad9ae3f73
MD5 41849f0832bc087a4ee3e1ac7452d131
BLAKE2b-256 0f78f35d9184e5b73093cd70678b1c650d5a00f64d583ee8fb00c7c29b0244fa

See more details on using hashes here.

File details

Details for the file class_functions-0.2.2-py3-none-any.whl.

File metadata

File hashes

Hashes for class_functions-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 35be747ffef12a0374bbfbec0e790dcc5cfdf96f22046a53c6147d97ba7552c9
MD5 799996651b3bce692b16cd489fa5b8cb
BLAKE2b-256 64dc58a451890c123002dd75597533e4ee70807dcaf8654ac332871b80a3b9f4

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page