Niyama (Sanskrit: नियमniyama, "restraint", "observance", "rule", "restriction", (in abl.[clarification needed]) "certainly", "necessarily") generally denotes a duty or obligation adopted by a spiritual aspirant (or community of same), or prescribed by a guru or by scripture (notably, the niyamas of raja yoga). The semantic range above reflects the breadth of the term's application in practice, and in the Buddhist sense extends to the determinations of nature, as in the Buddhistniyama dhammas. In Pāli the spelling niyāma is often used.
In numerous scriptures including the Shandilya and Varuha Upanishads, Hatha Yoga Pradipika by Gorakshanatha, the Tirumantiram of Tirumular and the Yoga Sutras of Patanjali, a set of prescribed actions are codified as niyamas, observances, requirements, obligations. In the above texts, these are ten in number, except in Patanjali's work, which lists only five.
The ten traditional Niyamas are:
Hri: remorse, being modest and showing shame for misdeeds;
Santosha: contentment; being satisfied with the resources at hand - therefore not desiring more;
In Buddhist commentary (from the 5th to 13th centuries CE) we find the pañcavidha niyama, fivefold niyama which occurs in the following texts:
In the Aṭṭhasālinī (272-274), the commentary attributed to Buddhaghosa on the Dhammasangaṅi, the first book of the Theravāda Abhidhamma Piṭaka;
In the Sumaṅgala-Vilāsinī (DA 2.431), Buddhaghosa’s commentary on the Dīgha Nikāya;
In the Abhidhammāvatāra (PTS p.54), a verse summary of Abhidhamma by Buddhaghosa’s contemporary, Buddhadatta.
Abhidhammamātika Internal Commentary. (p. 58) The Abhidhamma-mātika is a matrix of abstracts for the Abhidhamma, with lists of pairs and triplets of terms from which the whole of the text can theoretically be reconstructed. The passage on the niyamas is from an internal commentary on the mātika associated with the Dhammasaṅgaṇī (the niyāmas don’t appear to be mentioned in the mātrix itself, but only in this appendix.); and was composed in South India by Coḷaraṭṭha Kassapa (12th–13th century).
Abhidhammāvatāra-purāṇatīkā (p.1.68). Composed by in Sri Lanka by Vācissara Mahāsāmi c. 13th century or Sāriputta c. 12th century. This text is a commentary on the text of the Abhidhammāvatāra Nāmarūpa-parichedo (ṭīka) so is technically a sub-sub-commentary. This commentary is an incomplete word by word commentary.
utu-niyāma “the constraint of the seasons”, i.e. in certain regions of the earth at certain periods the flowering and fruiting of trees all at one time (ekappahāreneva), the blowing or ceasing of wind, the degree of the heat of the sun, the amount of rain-fall, some flowers like the lotuses opening during the day and closing at night and so on;
bīja-niyāma “the constraint of seeds or germs”, i.e. a seed producing its own kind as barley seed produces barley;
kammaniyāma “the constraint of kamma”, i.e. good actions produce good results and bad actions produce bad results. This constraint is said to be epitomised by [Dhammapada] verse 127 which explains that the consequences of actions are inescapable;
citta-niyāma “the constraint of mind”, i.e. the order of the process of mind-activities as the preceding thought-moment causing and conditioning the succeeding one in a cause and effect relation;
dhamma-niyāma “the constraint of dhammas”, i.e. such events like the quaking of the ten thousand world-systems at the Bodhisatta’s conception in his mother’s womb and at his birth. At the end of the discussion Sumaṅgalavilāsinī passage the Commentary says that dhammaniyāma explains the term dhammatā in the text of the Mahāpadāna Sutta (D ii.12) (Cf. S 12.20 for a discussion of the use of the word dhammaniyamatā in the suttas)
In these texts the fivefold niyama was introduced into commentarial discussions not to illustrate that the universe was intrinsically ethical but as a list that demonstrated the universal scope of paṭicca-samuppāda. The original purpose of expounding fivefold niyama was, according to Ledi Sayadaw, neither to promote or to demote the law of karma, but to show the scope of natural law as an alternative to the claims of theism.
C.A.F. Rhys Davids was the first western scholar to draw attention to the list of pañcavidha niyama, in her little book of 1912 entitled simply Buddhism. Her reason for mentioning it was to emphasise how for Buddhism we exist in a "moral universe" in which actions lead to just consequences according to a natural moral order, a situation she calls a "cosmodicy" in contrast with the Christian theodicy.:
In Mrs Rhys Davids scheme the niyamas become:
kamma niyama: ("action") consequences of one's actions
utu niyama: ("time, season") seasonal changes and climate, law of non-living matter
bīja niyama: ("seed") laws of heredity
citta niyama:("mind") will of mind
dhamma niyama: ("law") nature's tendency to perfect
This is similar to the scheme proposed by Ledi Sayadaw. Western Buddhist Sangharakshita has taken up Mrs Rhys Davids conception of the niyamas and made it an important aspect of his own teachings on Buddhism. 
In Pāli the word is spelled both niyama and niyāma, and the Pali Text Society Dictionary says that the two forms, which must have originally been distinct, have become confused. It is likely that niyāma is from a causative form of the verb ni√i.