All you need to do is run
pip install /opt/mypackage
and pip will search /opt/mypackage for a setup.py or pyproject.toml, build a wheel, then install it.
The problem with using the -e flag for pip install as suggested in the comments and this answer is that this requires that the original source directory stay in place for as long as you want to use the module. It’s great if you’re a developer working on the source, but if you’re just trying to install a package, it’s the wrong choice.
Alternatively, you don’t even need to download the repo from Github first. pip supports installing directly from VCS (version control systems) repos like git using a variety of protocols including HTTP, HTTPS, and SSH, among others. See the docs for examples.
To see all of the pip install command options, run
pip install --help