Skip to main content

Create schedule images of your weekly classes

Project description

week_schedule

A python little package for creating a schedule of my weekly classes from a JSON file using matplotlib.

Install it from the python package index:

pip install week_schedule

How it works

Save your classes in a .json file with the structure:

{
	"class name":{
		"[class days initials]":"[start time]-[end time]"
	}
}

[class days initials] can be any letter of an user-defined week abbreviations characters. For instance, you can treat your week like a piano, and put A,B,C,D,E,F,G as abbreviations for monday,tuesday,...,sunday. One sensible choice (and the default choice) are the labels MTWRFSD, Monday, Tuesday, Wednesday, ThuRsday, Friday, Saturday, SunDay. Sunday is usually ommited, as it is not likely that you have some fixed thing to do that day. Days labels count from monday for that reason.

[start time] and [end time] can be hour strings such as "11:00". By default, a 24-hour clock is assumed. You can specify am or pm: "11:00pm". Minutes are optional "11", "3pm", and seconds are allowed just for fun: "11:59:59am". Pretty much the only restriction is no spaces allowed, and a separating '-'.

You can include multiple days on the same hour. These are equivalent:

{
	"my favorite class":{
		"MW":"1pm-2pm"
	}
}
{
	"my favorite class":{
		"M":"1pm-2pm",
		"W":"1pm-2pm"
	}
}

This syntax allows a class with different days and hours, and you still could write the repeated days together. For examaple, let's say you have a class with two magistral sessions and one lab session.

{
	"Fungi lectures":{
		"TR":"8-9:30",    // Tuesday and Thursday cool fungi slideshows
		"S":"2pm-5:15pm"  // let's grow fungi on saturday
	}
}

Like everything in JSON you separate your things with commas. Here is an example of a full schedule

{
	"Fungi lectures":{
		"TR":"8-9:30",
		"S":"2pm-5:15pm"
	},
	"Acquire a taste for free form jazz":{
		"MWF":"6pm-7:15pm"
	},
	"Shitpost masterclass with reddit entrepreneur":{
		"MW":"11-12:30"
	},
	"frog and toad shenaniganry II":{
		"TR":"10-11:45"
	},
	"childhood traumas with 4chan experts":{
		"TWRF":"13-15"
	}
}

You can found it in ./tests/test.json. Then you go to python

>>> from week_schedule import schedule_figure
>>> schedule_figure("./tests/test.json").savefig("./tests/test.png")

which results in

schedule_figure parameters

You can pass parameters to control various visual styles:

  • schedule_path: path of the .json file
  • day_names: ordered names of the weekdays. Defaults are "MTWRFS"
  • font_dict: additional font tweaks; the same keyword arguments accepted by matplotlib.pyplot.text. Defaults used by this function are:
    • fontweight: bold
    • horizontalalignment: center
    • verticalalignment: center
    • fontsize: 7
    • color: white
  • text_stroke outward black stroke for better reading of the text on all background colors. Default is True
  • major_minor_intervals: interval of major and minor ticks, in hours. Defaults are 1 hour for major ticks and 15 minutes (1/4 hour) for minor ticks. Major tickss interval must be an integer number of hours, else a ValueError is raised.
  • cmap_name: color palette to use on the subject backgrounds. Default is "plasma". Options are in the matplotlib docs for colormap reference.
  • cmap_range: min and max output range of the colormap. In other words, portion of the colors to use. Default is (0,0.9), almost the full range of colors ((0,1)).

TODOs

  • extend JSON format to allow optional hex colors and fontsizes for each subject. Currently the only two options if one of the classes names is too long are:
    1. Use abbreviations
    2. Change the global fontsize on font_dict
  • add checks for conflicting class hours

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

week_schedule-2.1.tar.gz (6.4 kB view details)

Uploaded Source

Built Distribution

week_schedule-2.1-py3-none-any.whl (7.0 kB view details)

Uploaded Python 3

File details

Details for the file week_schedule-2.1.tar.gz.

File metadata

  • Download URL: week_schedule-2.1.tar.gz
  • Upload date:
  • Size: 6.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.9.6

File hashes

Hashes for week_schedule-2.1.tar.gz
Algorithm Hash digest
SHA256 94bf9a517b85aed9473a4c53aee239a8b1fd446c7c95fd83fbdab7c722815e8c
MD5 9546ea06d01596c61fe4fc9a0ac467b2
BLAKE2b-256 074d66b016ba392f3fd6fb83c350751bea7d0a63be5b6f4e5c1c6349791087e5

See more details on using hashes here.

File details

Details for the file week_schedule-2.1-py3-none-any.whl.

File metadata

  • Download URL: week_schedule-2.1-py3-none-any.whl
  • Upload date:
  • Size: 7.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.9.6

File hashes

Hashes for week_schedule-2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 6faa2ebe4300b83274a99f70c237a7ebef482f8d68f190d06fd4ebe9aafd45d0
MD5 5ced75b9bd08aa2174ebf70849ab22d7
BLAKE2b-256 d3f132abc6058b35d4c3dc3fcdad8e5ad930bbc8cf33dda0f79491b176bca831

See more details on using hashes here.

Supported by

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