|
| 1 | +# mxdev Example Configuration |
| 2 | + |
| 3 | +This directory contains example configuration files that demonstrate various mxdev features. |
| 4 | + |
| 5 | +## Files |
| 6 | + |
| 7 | +- **example.ini** - Main mxdev configuration file demonstrating various features |
| 8 | +- **requirements-infile.txt** - Example input requirements file |
| 9 | +- **constraints-infile.txt** - Example input constraints file |
| 10 | + |
| 11 | +## Running the Example |
| 12 | + |
| 13 | +To use this example configuration: |
| 14 | + |
| 15 | +```bash |
| 16 | +# From the example directory |
| 17 | +cd example |
| 18 | + |
| 19 | +# Run mxdev with the example configuration |
| 20 | +mxdev -c example.ini |
| 21 | + |
| 22 | +# This will: |
| 23 | +# 1. Read requirements-infile.txt and constraints-infile.txt |
| 24 | +# 2. Fetch source repositories defined in example.ini |
| 25 | +# 3. Generate requirements-outfile.txt and constraints-outfile.txt |
| 26 | +# |
| 27 | +# Note: The example uses placeholder repositories that don't exist. |
| 28 | +# Replace them with real repositories to actually run it. |
| 29 | +``` |
| 30 | + |
| 31 | +## Features Demonstrated |
| 32 | + |
| 33 | +### Settings Section |
| 34 | + |
| 35 | +The `[settings]` section demonstrates: |
| 36 | + |
| 37 | +- **Input/Output files**: Custom names for requirements and constraints |
| 38 | +- **main-package**: Defining the main package being developed |
| 39 | +- **version-overrides**: Overriding specific package versions from upstream constraints |
| 40 | +- **ignores**: Excluding packages from constraints (e.g., your main package) |
| 41 | +- **default-target**: Custom directory for checked out sources |
| 42 | +- **threads**: Parallel fetching for faster checkouts |
| 43 | +- **Variable substitution**: Reusable variables like `${settings:github}` |
| 44 | + |
| 45 | +### Package Sections |
| 46 | + |
| 47 | +Different package configurations showcase: |
| 48 | + |
| 49 | +1. **foo.bar** - Basic package with branch and extras |
| 50 | +2. **plone.behavior** - Shallow clone with `depth=1` (useful for CI) |
| 51 | +3. **package.with.submodules** - Git submodules with `submodules=recursive` |
| 52 | +4. **package.not.in.root** - Package in subdirectory using `subdirectory` |
| 53 | +5. **package.skip.install** - Clone only, skip pip install with `install-mode=skip` |
| 54 | +6. **package.custom.location** - Custom target directory with `target` |
| 55 | + |
| 56 | +## Git-Specific Features |
| 57 | + |
| 58 | +### Shallow Clones (depth) |
| 59 | + |
| 60 | +```ini |
| 61 | +[plone.behavior] |
| 62 | +url = ${settings:github}plone/plone.behavior.git |
| 63 | +depth = 1 # Only fetch latest commit |
| 64 | +``` |
| 65 | + |
| 66 | +Or set globally via environment variable: |
| 67 | +```bash |
| 68 | +export GIT_CLONE_DEPTH=1 |
| 69 | +``` |
| 70 | + |
| 71 | +### Submodules |
| 72 | + |
| 73 | +```ini |
| 74 | +[package.with.submodules] |
| 75 | +url = ${settings:github}orga/package.with.submodules.git |
| 76 | +submodules = recursive # Options: always (default), checkout, recursive |
| 77 | +``` |
| 78 | + |
| 79 | +### Subdirectories |
| 80 | + |
| 81 | +For monorepos where the Python package is not in the repository root: |
| 82 | + |
| 83 | +```ini |
| 84 | +[package.not.in.root] |
| 85 | +url = ${settings:github}orga/monorepo.git |
| 86 | +subdirectory = packages/mypackage |
| 87 | +``` |
| 88 | + |
| 89 | +## Installation Modes |
| 90 | + |
| 91 | +### Skip Installation |
| 92 | + |
| 93 | +Just clone the repository, don't install with pip (useful for configuration repositories): |
| 94 | + |
| 95 | +```ini |
| 96 | +[package.skip.install] |
| 97 | +url = ${settings:github}orga/config-only.git |
| 98 | +install-mode = skip |
| 99 | +``` |
| 100 | + |
| 101 | +### Direct Installation (default) |
| 102 | + |
| 103 | +Install package with `pip install -e PACKAGEPATH`: |
| 104 | + |
| 105 | +```ini |
| 106 | +[foo.bar] |
| 107 | +url = ${settings:github}orga/foo.bar.git |
| 108 | +# install-mode = direct # This is the default |
| 109 | +``` |
| 110 | + |
| 111 | +## Version Overrides |
| 112 | + |
| 113 | +Override versions from upstream constraints files: |
| 114 | + |
| 115 | +```ini |
| 116 | +[settings] |
| 117 | +version-overrides = |
| 118 | + baz.baaz==1.9.32 |
| 119 | + somepackage==3.0.0 |
| 120 | +``` |
| 121 | + |
| 122 | +**Note**: If using [uv](https://pypi.org/project/uv/), use its native override support instead: |
| 123 | + |
| 124 | +```bash |
| 125 | +# Create overrides.txt with version overrides |
| 126 | +uv pip install --override overrides.txt -r requirements-mxdev.txt |
| 127 | +``` |
| 128 | + |
| 129 | +## Ignoring Packages |
| 130 | + |
| 131 | +Exclude packages from constraints (useful for your main package): |
| 132 | + |
| 133 | +```ini |
| 134 | +[settings] |
| 135 | +ignores = |
| 136 | + my.mainpackage |
| 137 | + package.to.ignore |
| 138 | +``` |
| 139 | + |
| 140 | +## Custom Variables |
| 141 | + |
| 142 | +Define reusable variables in the settings section: |
| 143 | + |
| 144 | +```ini |
| 145 | +[settings] |
| 146 | +github = git+ssh://git@github.com/ |
| 147 | +gitlab = git+ssh://git@gitlab.com/ |
| 148 | + |
| 149 | +[foo] |
| 150 | +url = ${settings:github}orga/foo.git |
| 151 | + |
| 152 | +[bar] |
| 153 | +url = ${settings:gitlab}company/bar.git |
| 154 | +``` |
| 155 | + |
| 156 | +## Real-World Examples |
| 157 | + |
| 158 | +For real production examples, see: |
| 159 | + |
| 160 | +- [plone.org backend](https://github.com/plone/plone.org/tree/main/backend) |
| 161 | +- [Conestack](https://github.com/conestack/conestack/) |
| 162 | + |
| 163 | +## Additional Resources |
| 164 | + |
| 165 | +See the main [README.md](../README.md) for complete documentation of all configuration options. |
0 commit comments