Definitive answer! As written by one of the best, Anthony Caponetto of www.acreptiles.com:
Cage Sizes:
Young Hatchlings-
Hatchlings are only usually 10-14 inches long and about the girth of a pencil. To start them off, it’s best to keep them in a small plastic “shoe box” sized enclosure, which are approximately 4-8” wide by 10-14” long and maybe 4" high. I would recommend nothing bigger than that, at least until they have started to accept food on a regular basis.
Hatchlings to Juveniles-
After they have started to feed on a regular basis, you may move them to something a bit larger, such as a 12 quart sweater box, a 10 gallon aquarium with a secure screen to, or even a large plastic "Critter Keeper" type cage.
In rack systems, I’ve housed carpets up to 4 feet long in Rubbermaid 12 quart containers (approximately 12” x 16”) with great results. For carpet pythons up to 5 feet in length, I’d say a 28-32 quart box (approx. 24" x 16”) would be sufficient.
Just a thought…The good old 10 gallon tank
You can afford the snake, but not a cage? A ten gallon aquarium with a screen top will work great and only cost you about $20…and you can pick one up at Wal-Mart on the way home from the reptile show. For an established hatchling (one that’s feeding regularly) to 3.5 foot carpet python, a good old ten gallon fish tank with a screen top is really all you need for a cage. Aquariums can be a pain to keep looking good due to all the glass, but before I started using rack systems they really worked well in a pinch. If you don’t have a small cage laying around, a good old ten gallon tank ($10) and a screen top ($10) is a great, affordable way to house a new carpet python until you can afford a different cage…or until it outgrows the tank. Once they outgrow the ten gallon tank, you may as well start looking at reptile cages instead of fish tanks. Larger aquaria are expensive and heavy, not to mention still a pain to keep looking clean. That said, aquaria larger than 10 gallons are not all that practical…especially when you can buy a cage that’s light weight, easier to clean (not to mention built for reptiles) at a comparable price.
Adults-
Adult Jungle carpets and Irian Jaya carpets should be kept in a cage with a minimum of 4-6 square feet of floor space, such as a 2'x2' or a 3' x 2' cage. Cages should be 15"-24" high. Any taller and the cage will become difficult to maintain a proper heat gradient. As a rule of thumb for pythons in general, some keepers say that one square foot of floor space per foot in length is optimal, but I think slightly less than one square foot is fine for carpets, due to their slim build.
Large Adults-
Adult coastals will require a cage that’s at least 3-4 feet long by 24” deep and 15-24” tall.
Carpet pythons are semi-arboreal as hatchlings and juveniles, and even adults will make use of any perch or branches available. This really is not a necessity, but it does seem to help with the general happiness of the snake. With that in mind, if you aren’t housing a dozen of them, you might consider a cage with sufficient height to facilitate climbing. The cage does not have to be extremely tall to accommodate a sufficient perch. A ten gallon aquarium is more than tall enough to make a hatchling feel like it's far enough off of the ground. With that in mind, some of the smaller plastic sweater boxes are only 3.5 to 4 inches tall, which makes it kind of difficult to provide any kind of perch. In this case, you'll find that a lot of carpets are just as happy to "perch" on top of their hide box.
HE DA MAN!
Good Luck!