We recomend using Conda or pyenv to create a new environment.
Example with Conda: conda create -n omegaconf38 python=3.8 -qy
Activate your new conda environment: conda activate omegaconf38
Install development dependencies: pip install -r requirements/dev.txt -e .
The optional omegaconf-pydevd debugger plugin lives in
subprojects/omegaconf-pydevd/ and has its own packaging and tests.
Optionally install commit hooks: pre-commit install
pre-commit will verify your code lints cleanly when you commit. You can use git commit -n to skip the pre-commit hook for a specific commit.
OmegaConf is compatible with Python 3.8 and newer.
One way to install multiple Python versions on Mac to to use pyenv. The instructions here will provide full details. It shows how to use pyenv on Mac to install multiple versions of Python and have pyenv make specific versions available in specific directories automatically. This plays well with Conda, which supports a single Python version. Pyenv will provide the versions not installed by Conda (which are used when running nox).
Run tests directly with pytest.
Run all CI tests with nox:
$ nox -l
Sessions defined in /home/omry/dev/omegaconf/noxfile.py:
* omegaconf-3.10
* docs
* coverage-3.10
* lint-3.10
* test_jupyter_notebook-3.10
To run a specific session use -s, for example nox -s lint will run linting
OmegaConf is formatted with black, to format your code automatically use black .
Imports are sorted using isort, use isort . to sort all imports prior to pushing.
To build the docs execute nox -s docs or make(inside docs folder). Make gives you different options, for example, you can build the docs as html files with make html. Once the docs are built you can open index.html in the build directory to view the generated docs with your browser.
When submitting a PR please ensure that it includes:
- automated tests for any new feature or bugfix
- documentation for any user-facing change
- a one-line news fragment under the
newsfolder (valid extensions are:.feature,.bugfix,.api_change,.docs,.misc)
In order to change the Jupyter notebook you first need to open it with jupyter notebook.
Change the cell you want and then, execute it so the expected output is shown.
Note that the output after you execute the cell is saved as expected ouput for further
testing.
In case that the in[number] of cells aren't in order you should go to the kernel in the toolbar and restart it.
OmegaConf uses GitHub Actions with PyPI Trusted Publishers for automated releases.
Prerequisites (one-time setup):
-
Configure Trusted Publisher on PyPI (project maintainers only):
- Go to https://pypi.org/manage/project/omegaconf/settings/publishing/
- Add GitHub as a trusted publisher with:
- Owner:
omry(or your organization) - Repository name:
omegaconf - Workflow name:
publish.yml - Environment name:
pypi-publish
- Owner:
- Repeat for the
omegaconf-pydevdPyPI project if you want the plugin package published by the same workflow.
-
Configure Trusted Publisher for dev releases on PyPI (project maintainers only):
- Add GitHub as a trusted publisher with:
- Owner:
omry(or your organization) - Repository name:
omegaconf - Workflow name:
publish_dev.yml - Environment name:
pypi-publish-dev
- Owner:
- Repeat for the
omegaconf-pydevdPyPI project if you want dev plugin releases published too.
- Add GitHub as a trusted publisher with:
-
Create the
pypi-publishenvironment in GitHub repository settings (optional but recommended):- Add protection rules (e.g., require manual approval)
-
Create the
pypi-publish-devenvironment in GitHub repository settings:- Allow publishing from the development branch you use for dev releases
(for example
master) - Add protection rules (e.g., require manual approval)
- Allow publishing from the development branch you use for dev releases
(for example
Official release process:
- Bump the version with
bump-my-version, for example:bump-my-version bump patchbump-my-version bump minorbump-my-version bump --new-version X.Y.Z
- Update
NEWS.mdwith release notes (usetowncrier build --version X.Y.Z) - Commit changes and push to main branch
- Create a new release on GitHub:
- Go to https://github.com/omry/omegaconf/releases/new
- Create a new tag (e.g.,
v2.4.0) - Add release notes
- Publish release
- GitHub Actions will automatically build and publish to PyPI
The workflow handles:
- Installing Java (required for ANTLR parser generation)
- Building source distribution and wheel for both
omegaconfandomegaconf-pydevd - Verifying artifacts for both packages with
twine check - Publishing to PyPI via Trusted Publishers (no API tokens needed)
Development release process:
- Bump the dev version with
bump-my-version bump pre_n - Commit changes and push to the branch you use for dev releases
- Run the
Publish dev release to PyPIworkflow manually from GitHub Actions - Approve the
pypi-publish-devenvironment if required
Manual release (fallback): If you need to publish manually:
rm -rf dist/ omegaconf.egg-info/
python -m build
python -m build subprojects/omegaconf-pydevd
twine check dist/* subprojects/omegaconf-pydevd/dist/*
twine upload dist/* subprojects/omegaconf-pydevd/dist/*