|
| 1 | +# EEST Dependency Management and Packaging |
| 2 | + |
| 3 | +EEST uses [`uv`](https://docs.astral.sh/uv/) to manage and pin its dependencies. |
| 4 | + |
| 5 | +## Managing Dependencies |
| 6 | + |
| 7 | +We aim to provide specific [version specifiers](https://peps.python.org/pep-0440/#version-specifiers) for each of our direct and extra dependencies. |
| 8 | +!!! note "Packages should be managed via `uv`" |
| 9 | + |
| 10 | + Dependencies should be managed using `uv` on the command-line to ensure that version compatibility is ensured across all dependencies and that `uv.lock` is updated as required. |
| 11 | + |
| 12 | +### Adding/modifying direct dependencies |
| 13 | + |
| 14 | +These are packages listed in the project's direct dependencies, i.e., in `pyproject.toml` `[project]` section: |
| 15 | + |
| 16 | +```toml |
| 17 | +[project] |
| 18 | +... |
| 19 | +dependencies = [ |
| 20 | + "click>=8.1.0,<9", |
| 21 | + ... |
| 22 | + "pytest-regex>=0.2.0,<0.3", |
| 23 | +] |
| 24 | +``` |
| 25 | + |
| 26 | +or, for source package dependencies (directly installed via a `git+` specifier from Github), in the `[tool.uv.sources]` section: |
| 27 | + |
| 28 | +```toml |
| 29 | +[tool.uv.sources] |
| 30 | +ethereum-spec-evm-resolver = { git = "https://github.com/petertdavies/ethereum-spec-evm-resolver", rev = \ |
| 31 | +... |
| 32 | +``` |
| 33 | + |
| 34 | +!!! example "Example: Updating direct dependencies" |
| 35 | + |
| 36 | + Example of a package dependency update: |
| 37 | + ```console |
| 38 | + uv add "requests>=2.31,<2.33" |
| 39 | + ``` |
| 40 | + |
| 41 | + Example of a source dependency update: |
| 42 | + ```console |
| 43 | + uv add "ethereum-spec-evm-resolver @ git+https://github.com/petertdavies/ethereum-spec-evm-resolver@623ac4565025e72b65f45b926da2a3552041b469" |
| 44 | + ``` |
| 45 | + |
| 46 | +### Adding/modifying optional dependencies |
| 47 | + |
| 48 | +These are packages in the optional "extra" groups: `lint`, `docs`, `test`, defined in the `pyproject.toml`: |
| 49 | + |
| 50 | +```toml |
| 51 | +[project.optional-dependencies] |
| 52 | +test = ["pytest-cov>=4.1.0,<5"] |
| 53 | +lint = [ |
| 54 | + "ruff==0.9.4", |
| 55 | + "mypy>=1.15.0,<1.16", |
| 56 | + "types-requests>=2.31,<2.33", |
| 57 | +] |
| 58 | +docs = [ |
| 59 | + ... |
| 60 | +] |
| 61 | +``` |
| 62 | + |
| 63 | +!!! example "Example: Updating an optional dependency" |
| 64 | + |
| 65 | + ``` |
| 66 | + uv add --optional lint "types-requests>=2.31,<2.33" |
| 67 | + ``` |
0 commit comments