Hull dock worker Jamie Riley has been jailed for growing cannabis with an estimated street value of £16,000.
Riley, 27, was caught by police after they raided the flat he shared with his girlfriend, Cody Kellaway, in Holderness Road, east Hull.
Kellaway was also arrested and charged with permitting her premises for the production of cannabis.
Police entered a room from a flight of stairs leading from the living room of the flat above Pizza Expert and found 31 plants and growing equipment, including ten lights, at 7.50am on November 16.
Prosecuting at Hull Crown Court, Stephen Welch said Riley at one time smoked £100 worth of cannabis a day and had been living with Kellaway for four months.
He said: "Kellaway was present. There was a flight of stairs from the living room to another room and in it there were 31 plants in the process of being produced.
"Both defendants were arrested and subsequently interviewed.
"Miss Kellaway stated she hadn't gone into the room upstairs at the location and denied any responsibility for the cannabis plants that were there.
"She later entered a guilty plea to permitting premises to be used."
He said Riley had a record of drug- related offences, including intent to supply and possession of heroin in 2004, for which he spent time in a young offenders' institute.
In mitigation, Ian Phillip said Riley had now stopped using cannabis, was employed, and settled down with Kellaway.
He said: "At the time the defendant was a heavy user of cannabis, he grew it for his own use but accepts some was being sold.
"His attitude towards drug-taking has changed and it is perhaps, for these reasons, in the past six months his life has changed."
The Honorary Recorder of Hull and the East Riding, Judge Michael Mettyear, sentenced Kellaway to an 18-month conditional discharge but said he had no choice but to hand Riley a custodial sentence.
Sentencing him to six months in jail, Judge Mettyear said: "This was quite a considerable amount being grown. The weight in value was substantial and you have to admit some would have been sold.
"With your record you just cannot get involved in drugs. I have come to the conclusion it is impossible to deal with you without a custodial sentence. You cannot afford to do this anymore."
• Follow us on Facebook and Twitter