Import packages and modules from the root of a monorepo
Instructions:
- First create a file named
.monorepo_rootat the root of your monorepo. - Use
monorepo.load_package(ormonorepo.load_module) to load packages (or modules) from anywhere in your monorepo.
Example usage for load_package:
import monorepo
# The `load_package` function will search up from the current directory for a
# file named `.monorepo_root`, which is used to determine the root directory
# from which to load the package:
monorepo.load_package("pkg1")
# The pkg1 package can be used directly:
from pkg1 import mymodule1
# Also works with sub-packages:
monorepo.load_package("pkg1.pkg2")
from pkg2 import mymodule2
# Also works with renaming packages (useful for invalid package names or for name clashes):
monorepo.load_package("invalid-namge", package_name = "pkg3")
from pkg3 import mymodule3
Example usage for load_module:
import monorepo
# The `load_module` function will search up from the current directory for a
# file named `.monorepo_root`, which is used to determine the root directory
# from which to load the module:
mymodule = monorepo.load_module("pkg1.module1")
mymodule.my_function()
mymodule2 = monorepo.load_module("pkg1.pkg2.module2")
mymodule2.my_function()
Metadata
Release files for monorepo 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| monorepo-0.2.0.tar.gz | 2.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| monorepo-0.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 5.7 kB
Release files / monorepo-0.2.0.tar.gz
| Download URL | monorepo-0.2.0.tar.gz |
|---|---|
| Size | 2.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9eaa97b35df5b45f6102faf41d6238b19ac0ff909e237ffd1c27f11f25993c12
|
|
BLAKE2b-256 checksum How to use checksums |
9bd374b0b68d3d3280643a18b7f1c8abfdc1635b0e5b8d5288aae4a3f0b91bd4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.0 CPython/3.12.2
|
Release files / monorepo-0.2.0-py3-none-any.whl
| Download URL | monorepo-0.2.0-py3-none-any.whl |
|---|---|
| Size | 3.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
00172b14c2e78f09271eac5689f187c46604817cc5662681b2e3c4c0e8fc22d2
|
|
BLAKE2b-256 checksum How to use checksums |
59dbe855a2c22fcd43fd996f0dadcd7ad99b5a2d1a5e6acb5ba16bb60013ace5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.0 CPython/3.12.2
|