Closed Bug 1471888 Opened 4 years ago Closed 4 years ago

[mozprofile] Add support for Python 3


(Testing :: Mozbase, enhancement, P3)

Version 3


(firefox64 fixed)

Tracking Status
firefox64 --- fixed


(Reporter: davehunt, Assigned: slepushkin, Mentored)



(Keywords: good-first-bug)


(2 files)

+++ This bug was initially created as a clone of Bug #1425399 +++

Without dropping support for legacy python, we need to add support for Python 3. Whilst some aspects were taken care of in bug 1425399 we are now able to run the unit tests against Python 3, and many of these are failing.

To work on this bug you will need to install and configure Mercurial, which will enable you to download the Firefox source code. It will also be used to commit your changes locally and prepare a patch for review. See the installation guide at for help getting Mercurial on your system. Once installed, there are some extensions we recommend installing, details of these can be found here:

To clone the Firefox source code we recommend using the unified repository. Details of this and how to create a bookmark for your work can be found here:

As this bug relates to Python 3, you will need to have this installed on your system. Our continuous integration is currently using Python 3.5, so for best results we recommend using the same version locally. There are a number of ways to install Python, and they vary depending on your environment. We suggest reading over the guides at to find the best method for you. Note that we also need to maintain support for Python 2, so you'll also need to have Python 2.7 installed.

Whilst we're moving towards adding support for Python 3, we've disabled any tests that fail against this version. This means that in order to work on this bug you will need to enable the tests. This can be done by removing "skip-if = python == 3" from the manifest file in `testing/mozbase/mozprofile/tests/manifest.ini`

To run the tests against Python 3, execute the following command:

mach python-test --python=3.5 testing/mozbase/mozprofile

Work through the test failures, and update the tests and source code for the package to simultaneously support Python 2.7 and Python 3.5. You can always check that your changes have not inadvertently broken support for Python 2 by using `--python=2.7` on the command line. 

If you're new to Python 3, the guide at may help you to get started with understanding the differences. To assist with supporting both Python 2 and 3, we have vendored the "six" package. You can read more about this and how to use it at

Note that this package depends on others that may not yet support Python 3. If these dependencies are preventing tests from passing, then we can block this bug on getting support in those packages. If there are circular dependencies then we may need to coordinate landing a sequence of patches between bugs,

Once the package supports Python 3 and the tests pass, we will also need to prepare for a new release. Bump the version number in `testing/mozbase/mozprofile/` to "2.0.0", and update the classifiers so they reflect the versions of Python that we now support.

Finally, to prepare a universal distribution, create a `testing/mozbase/mozprofile/setup.cfg` file with the following contents:


When your patch(es) are ready, you will need to push them for review. We are use MozReview for this, and instructions for how to prepare your machine and how to structure your commit messages can be found in our guide:

There may be some review issues to address, but once your contribution has been approved and subsequently landed, we will release the new version of the package!
Depends on: 1428709
Priority: -- → P3
Hello! I'd like to fix this bug , in case no one is working on this .
I did setup the build environment for Firefox, and any further mentoring would be great!
Hi. Can I work on this or should I choose something else?
(In reply to Pavel Slepushkin from comment #2)
> Hi. Can I work on this or should I choose something else?

I'll assign this to you Pavel, but would you first be able to look at bug 1483794?
Assignee: nobody → slepushkin
FYI: Patch is ready, but is down for second day in row and I cannot push it
Sorry, but please note that Mozreview has been shutdown by last week. From now on you will have to use Phabricator to submit your patches. Have a look at in how to set it up.
I've submitted patch for review

There's 1 obvious error - I've submitted 3 files (.arcconfig , .hgignore, .gitignore)  - it was my first time with arcanist and diff was submitted as a result of 'arc diff --preview'
And now I don't know how to delete these files from diff or my diff as a whole.
Also the patch somehow is not attached to this bug as it was with mercurial.
Bug 1471888 - [mozprofile] Add support for Python 3.
I've submitted the patch, fixed all issues from reviewbot and waiting for review.
Please let me know if I've missed anything.
Flags: needinfo?(dave.hunt)
Flags: needinfo?(dave.hunt)
Comment on attachment 9007020 [details]
Bug 1471888 - [mozprofile] Add support for Python 3. r=davehunt

Dave Hunt [:davehunt] ⌚️UTC+1 has approved the revision.
Attachment #9007020 - Flags: review+
Pushed by
[mozprofile] Add support for Python 3. r=davehunt
I keep forgetting the dependency version identifiers! Pavel, could you please update the following files: - to pin to ==2.0.0 - to pin to >=1.1.0,<3

Thanks, and sorry for the failures.
No worries, I've updated my revision.
Flags: needinfo?(slepushkin)
Pushed by
[mozprofile] Add support for Python 3. r=davehunt
Pushed by
Update mozprofile version used by raptor; r=rwood
Comment on attachment 9008204 [details]
Bug 1471888 - Update mozprofile version used by raptor; r?rwood

Robert Wood [:rwood] has approved the revision.
Attachment #9008204 - Flags: review+
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla64
I've released mozprofile 2.0.0 to PyPI. Thank you Pavel for your contribution! Are you interested in picking another bug that's blocking bug 1093212? Maybe bug 1471648?
Yes, sure, I'd like to work on another one.
Please assign it to me.
(In reply to Pavel Slepushkin from comment #22)
> Yes, sure, I'd like to work on another one.
> Please assign it to me.

Done. I've also mentioned you in the upcoming 'Friends of the Tree' as this is your first contribution, and we really appreciate it! You can watch the weekly meeting on Monday live to hear your name read out at or use the same link to watch later, and you can see the agenda here:

Thanks again!
Bumping the version of mozprofile in tps/ causes TPS to fail to launch, because mozrunner 7.0.1 still depends on mozprofile<2 D:
You need to log in before you can comment on or make changes to this bug.