@@ -54,7 +54,7 @@ Finally, install all development dependencies:
5454
5555.. code :: sh
5656
57- $ pip install -e " .[dev]"
57+ $ python -m pip install -e " .[dev]"
5858 $ pre-commit install
5959
6060
@@ -74,64 +74,34 @@ To start up the test environment, run:
7474 This will build a Docker container set up with an environment to run the
7575Python test code.
7676
77- .. note ::
78-
79- This container does not have `go-ethereum ` installed, so you cannot run
80- the go-ethereum test suite.
81-
82- To run the Python tests from your local machine:
77+ To run the core tests from your local machine:
8378
8479.. code :: sh
8580
86- $ docker compose exec sandbox bash -c ' pytest -n 4 -f -k "not goethereum" '
81+ $ docker compose exec sandbox bash -c ' pytest tests/core '
8782
8883
89- You can run arbitrary commands inside the Docker container by using the
90- ` bash -c ` prefix .
84+ The container does not have `` go-ethereum `` installed, so you can exclude those tests
85+ by using the `` -k "not goethereum" `` flag .
9186
9287.. code :: sh
9388
94- $ docker compose exec sandbox bash -c ' '
89+ $ docker compose exec sandbox bash -c ' pytest tests/integration -k "not goethereum" '
9590
9691
97- Or, if you would like to open a session to the container, run:
92+ You can run arbitrary commands inside the Docker container by using the
93+ ``bash -c `` prefix.
9894
9995.. code :: sh
10096
101- $ docker compose exec sandbox bash
102-
103-
104- Code Style
105- ~~~~~~~~~~
97+ $ docker compose exec sandbox bash -c ' pwd && ls'
10698
107- We value code consistency. To ensure your contribution conforms to the style
108- being used in this project, we encourage you to read our `style guide `_.
10999
110- We use Black for linting. To ignore the commits that introduced Black in
111- git history, you can configure your git environment like so:
100+ Or, if you would like to open a session to the container, run:
112101
113102.. code :: sh
114103
115- git config blame.ignoreRevsFile .git-blame-ignore-revs
116-
117-
118- Type Hints
119- ~~~~~~~~~~
120-
121- This code base makes use of `type hints `_. Type hints make it easy to prevent
122- certain types of bugs, enable richer tooling, and enhance the documentation,
123- making the code easier to follow.
124-
125- All new code is required to include type hints, with the exception of tests.
126-
127- All parameters, as well as the return type of functions, are expected to be typed,
128- with the exception of ``self `` and ``cls `` as seen in the following example.
129-
130- .. code :: python
131-
132- def __init__ (self , wrapped_db : DatabaseAPI) -> None :
133- self .wrapped_db = wrapped_db
134- self .reset()
104+ $ docker compose exec sandbox bash
135105
136106
137107 Running The Tests
@@ -144,7 +114,8 @@ First, install the test dependencies:
144114
145115.. code :: sh
146116
147- $ pip install -e " .[test]"
117+ $ python -m pip install -e " .[test]"
118+
148119
149120 You can run all tests with:
150121
@@ -161,15 +132,8 @@ Typically, you'll just want to run a subset instead, like:
161132 $ pytest tests/core/eth-module/test_accounts.py
162133
163134
164- You can use ``tox `` to run all the tests for a given version of Python:
165-
166- .. code :: sh
167-
168- $ tox -e py38-core
169-
170-
171- Linting is also performed by the CI. You can save yourself some time by checking for
172- linting errors locally:
135+ Linting is also performed by the CI and locally with each commit. You can save yourself
136+ some time by checking for linting errors manually:
173137
174138.. code :: sh
175139
@@ -256,12 +220,11 @@ Arguments for the script are:
256220
257221
258222To run the script, you will need the ``py-solc-x `` library for compiling the files
259- as well as ``black `` for code formatting. You can install those independently or
260- install the full ``[dev] `` package extra as shown below.
223+ as well as ``black `` for code formatting. You can install those with:
261224
262225.. code :: sh
263226
264- $ pip install " web3[dev] "
227+ $ python -m pip install py-solc-x black
265228
266229 The following example compiles all the contracts and generates their respective
267230contract data that is used across our test files for the test suites. This data gets
@@ -304,7 +267,35 @@ you can install it from your development directory:
304267
305268.. code :: sh
306269
307- $ pip install -e ../path/to/web3py
270+ $ python -m pip install -e ../path/to/web3py
271+
272+
273+ Code Style
274+ ~~~~~~~~~~
275+
276+ We use `pre-commit <https://pre-commit.com/ >`_ to enforce a consistent code style across
277+ the library. This tool runs automatically with every commit, but you can also run it
278+ manually with:
279+
280+ .. code :: sh
281+
282+ $ make lint
283+
284+
285+ If you need to make a commit that skips the ``pre-commit `` checks, you can do so with
286+ ``git commit --no-verify ``.
287+
288+ We use Black as part of our linting. To ignore the commits that introduced Black in
289+ git history, you can configure your git environment like so:
290+
291+ .. code :: sh
292+
293+ $ git config blame.ignoreRevsFile .git-blame-ignore-revs
294+
295+
296+ This library uses `type hints `_, which are enforced by the ``mypy `` tool (part of the
297+ ``pre-commit `` checks). All new code is required to land with type hints, with the
298+ exception of code within the ``tests `` directory.
308299
309300
310301Documentation
@@ -352,7 +343,7 @@ Before generating new fixtures, make sure you have the test dependencies install
352343
353344.. code :: sh
354345
355- $ pip install -e " .[test]"
346+ $ python -m pip install -e " .[test]"
356347
357348 .. note ::
358349
@@ -436,8 +427,8 @@ Before releasing a new version, build and test the package that will be released
436427
437428.. code :: sh
438429
439- git checkout main && git pull
440- make package-test
430+ $ git checkout main && git pull
431+ $ make package-test
441432
442433 This will build the package and install it in a temporary virtual environment. Follow
443434the instructions to activate the venv and test whatever you think is important.
@@ -446,13 +437,13 @@ Review the documentation that will get published:
446437
447438.. code :: sh
448439
449- make docs
440+ $ make docs
450441
451442 Validate and preview the release notes:
452443
453444.. code :: sh
454445
455- make validate-newsfragments
446+ $ make validate-newsfragments
456447
457448 Build the release notes
458449^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -463,7 +454,7 @@ release notes.
463454
464455.. code :: sh
465456
466- make notes bump=$$ VERSION_PART_TO_BUMP$$
457+ $ make notes bump=$$ VERSION_PART_TO_BUMP$$
467458
468459 If there are any errors, be sure to re-run make notes until it works.
469460
@@ -474,7 +465,7 @@ After confirming that the release package looks okay, release a new version:
474465
475466.. code :: sh
476467
477- make release bump=$$ VERSION_PART_TO_BUMP$$
468+ $ make release bump=$$ VERSION_PART_TO_BUMP$$
478469
479470 This command will:
480471
@@ -497,10 +488,10 @@ beta).
497488If you are in a beta version, ``make release bump=stage `` will switch to a stable.
498489
499490To issue an unstable version when the current version is stable, specify the new version
500- explicitly, like ``make release bump="--new-version 4.0.0-alpha.1" ``
491+ explicitly, like ``make release bump="--new-version 4.0.0-alpha.1" ``.
501492
502493You can see what the result of bumping any particular version part would be with
503- ``bump-my-version show-bump ``
494+ ``bump-my-version show-bump ``.
504495
505496.. _Python Discord server : https://discord.gg/GHryRvPB84
506497.. _style guide : https://github.com/ethereum/snake-charmers-tactical-manual/blob/main/style-guide.md
0 commit comments