Skip to content

Commit 69a05df

Browse files
committed
merge template, fill vars, run lint
2 parents d6b8617 + 788305f commit 69a05df

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+246
-171
lines changed

.bumpversion.cfg

Lines changed: 0 additions & 22 deletions
This file was deleted.

.circleci/config.yml

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -121,15 +121,11 @@ docs: &docs
121121
command: |
122122
python -m pip install --upgrade pip
123123
python -m pip install tox
124-
# latexpdf turned off for now - won't build due to long line lengths
125-
# - run:
126-
# name: install latexpdf dependencies
127-
# command: |
128-
# sudo apt-get update
129-
# sudo apt-get install latexmk tex-gyre texlive-fonts-extra texlive-xetex xindy
130124
- run:
131125
name: run tox
132126
command: python -m tox run -r
127+
- store_artifacts:
128+
path: /home/circleci/repo/docs/_build
133129
- save_cache:
134130
paths:
135131
- .tox

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
exclude: '.project-template|docs/conf.py|.bumpversion.cfg'
1+
exclude: '.project-template|docs/conf.py'
22
repos:
33
- repo: https://github.com/pre-commit/pre-commit-hooks
44
rev: v4.5.0

.readthedocs.yaml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ version: 2
33
build:
44
os: ubuntu-22.04
55
tools:
6-
python: "3.9"
6+
python: "3.10"
77

88
sphinx:
99
configuration: docs/conf.py
@@ -16,9 +16,6 @@ python:
1616
extra_requirements:
1717
- docs
1818

19-
# Build all formats for RTD Downloads - htmlzip, pdf, epub
20-
# formats: all
21-
# Turning off pdf for now - won't build due to long line lengths
2219
formats:
2320
- epub
2421
- htmlzip

Makefile

Lines changed: 51 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,16 @@ CURRENT_SIGN_SETTING := $(shell git config commit.gpgSign)
55
help:
66
@echo "clean-build - remove build artifacts"
77
@echo "clean-pyc - remove Python file artifacts"
8+
@echo "clean - run clean-build and clean-pyc"
9+
@echo "dist - build package and cat contents of the dist directory"
810
@echo "lint - fix linting issues with pre-commit"
911
@echo "test - run tests quickly with the default Python"
12+
@echo "benchmark - run benchmark tests"
1013
@echo "docs - generate docs and open in browser (linux-docs for version on linux)"
1114
@echo "autobuild-docs - live update docs when changes are saved"
12-
@echo "notes - consume towncrier newsfragments/ and update release notes in docs/"
13-
@echo "release - package and upload a release (does not run notes target)"
14-
@echo "dist - package"
15-
16-
clean: clean-build clean-pyc
15+
@echo "package-test - build package and install it in a venv for manual testing"
16+
@echo "notes - consume towncrier newsfragments and update release notes in docs - requires bump to be set"
17+
@echo "release - package and upload a release (does not run notes target) - requires bump to be set"
1718

1819
clean-build:
1920
rm -fr build/
@@ -26,6 +27,12 @@ clean-pyc:
2627
find . -name '*~' -exec rm -f {} +
2728
find . -name '__pycache__' -exec rm -rf {} +
2829

30+
clean: clean-build clean-pyc
31+
32+
dist: clean
33+
python -m build
34+
ls -l dist
35+
2936
lint:
3037
@pre-commit run --all-files --show-diff-on-failure || ( \
3138
echo "\n\n\n * pre-commit should have fixed the errors above. Running again to make sure everything is good..." \
@@ -38,66 +45,72 @@ test:
3845
benchmark:
3946
python -m tox run -e benchmark
4047

48+
# docs commands
49+
50+
docs: check-docs
51+
open docs/_build/html/index.html
52+
53+
linux-docs: check-docs
54+
xdg-open docs/_build/html/index.html
55+
4156
autobuild-docs:
4257
sphinx-autobuild --open-browser docs docs/_build/html
4358

44-
build-docs:
45-
sphinx-apidoc -o docs/ . setup.py "*conftest*" "tests" "web3/tools/*"
46-
$(MAKE) -C docs clean
47-
$(MAKE) -C docs html
48-
$(MAKE) -C docs doctest
49-
50-
build-docs-ci:
51-
# pdf turned off for now - long line lengths break the build
52-
# $(MAKE) -C docs latexpdf
53-
$(MAKE) -C docs epub
59+
# docs helpers
5460

5561
validate-newsfragments:
5662
python ./newsfragments/validate_files.py
5763
towncrier build --draft --version preview
5864

5965
check-docs: build-docs validate-newsfragments
6066

67+
build-docs:
68+
sphinx-apidoc -o docs/ . setup.py "*conftest*"
69+
$(MAKE) -C docs clean
70+
$(MAKE) -C docs html
71+
$(MAKE) -C docs doctest
72+
6173
check-docs-ci: build-docs build-docs-ci validate-newsfragments
6274

63-
docs: check-docs
64-
open docs/_build/html/index.html
75+
build-docs-ci:
76+
$(MAKE) -C docs epub
6577

66-
linux-docs: check-docs
67-
xdg-open docs/_build/html/index.html
78+
# release commands
6879

69-
check-bump:
70-
ifndef bump
71-
$(error bump must be set, typically: major, minor, patch, or devnum)
72-
endif
80+
package-test: clean
81+
python -m build
82+
python scripts/release/test_package.py
7383

74-
notes: check-bump validate-newsfragments
84+
notes: check-bump
7585
# Let UPCOMING_VERSION be the version that is used for the current bump
76-
$(eval UPCOMING_VERSION=$(shell bumpversion $(bump) --dry-run --list | grep new_version= | sed 's/new_version=//g'))
86+
$(eval UPCOMING_VERSION=$(shell bump-my-version bump --dry-run $(bump) -v | awk -F"'" '/New version will be / {print $$2}'))
7787
# Now generate the release notes to have them included in the release commit
7888
towncrier build --yes --version $(UPCOMING_VERSION)
7989
# Before we bump the version, make sure that the towncrier-generated docs will build
8090
make build-docs
8191
git commit -m "Compile release notes for v$(UPCOMING_VERSION)"
8292

83-
release: check-bump clean
84-
# require that upstream is configured for ethereum/web3.py
85-
@git remote -v | grep "upstream[[:space:]][email protected]:ethereum/web3.py.git (push)\|upstream[[:space:]]https://github.com/ethereum/web3.py (push)"
86-
# verify that docs build correctly
93+
release: check-bump check-git clean
94+
# verify that notes command ran correctly
8795
./newsfragments/validate_files.py is-empty
88-
make build-docs
8996
CURRENT_SIGN_SETTING=$(git config commit.gpgSign)
9097
git config commit.gpgSign true
91-
bumpversion $(bump)
98+
bump-my-version bump $(bump)
9299
python -m build
100+
git config commit.gpgSign "$(CURRENT_SIGN_SETTING)"
93101
git push upstream && git push upstream --tags
94102
twine upload dist/*
95-
git config commit.gpgSign "$(CURRENT_SIGN_SETTING)"
96103

97-
dist: clean
98-
python -m build
99-
ls -l dist
104+
# release helpers
100105

101-
package: clean
102-
python -m build
103-
python web3/scripts/release/test_package.py
106+
check-bump:
107+
ifndef bump
108+
$(error bump must be set, typically: major, minor, patch, or devnum)
109+
endif
110+
111+
check-git:
112+
# require that upstream is configured for ethereum/web3.py
113+
@if ! git remote -v | grep "upstream[[:space:]][email protected]:ethereum/web3.py.git (push)\|upstream[[:space:]]https://github.com/ethereum/web3.py (push)"; then \
114+
echo "Error: You must have a remote named 'upstream' that points to 'web3.py'"; \
115+
exit 1; \
116+
fi

README.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,18 @@ web3.py allows you to interact with the Ethereum blockchain using Python, enabli
1212

1313
- Python 3.8+ support
1414

15-
______________________________________________________________________
15+
## Installation
16+
17+
```sh
18+
python -m pip install web3
19+
```
1620

17-
## Quickstart
21+
## Documentation
1822

1923
[Get started in 5 minutes](https://web3py.readthedocs.io/en/latest/quickstart.html) or
2024
[take a tour](https://web3py.readthedocs.io/en/latest/overview.html) of the library.
2125

22-
## Documentation
26+
View the [change log](https://web3py.readthedocs.io/en/latest/release_notes.html).
2327

2428
For additional guides, examples, and APIs, see the [documentation](https://web3py.readthedocs.io/en/latest/).
2529

docs/contributing.rst

Lines changed: 46 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ Finally, install all development dependencies:
5555
.. code:: sh
5656
5757
$ pip install -e ".[dev]"
58+
$ pre-commit install
5859
5960
6061
Using Docker
@@ -424,93 +425,82 @@ published and the test runs are updated to use the new stable version.
424425
Releasing
425426
~~~~~~~~~
426427

427-
Final Test Before Each Release
428-
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
428+
Releases are typically done from the ``main`` branch, except when releasing a beta (in
429+
which case the beta is released from ``main``, and the previous stable branch is
430+
released from said branch).
429431

430-
Before releasing a new version, build and test the package that will be released.
431-
There's a script to build and install the wheel locally, then generate a temporary
432-
virtualenv for smoke testing:
432+
Final test before each release
433+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
433434

434-
.. code:: sh
435-
436-
$ git checkout main && git pull
437-
438-
$ make package
435+
Before releasing a new version, build and test the package that will be released:
439436

440-
# in another shell, navigate to the virtualenv mentioned in output of ^
441-
442-
# load the virtualenv with the packaged web3.py release
443-
$ source package-smoke-test/bin/activate
444-
445-
# smoke test the release
446-
$ pip install ipython
447-
$ ipython
448-
>>> from web3 import Web3, IPCProvider
449-
>>> w3 = Web3(IPCProvider(provider_url))
450-
>>> w3.is_connected()
451-
>>> ...
437+
.. code:: sh
452438
439+
git checkout main && git pull
440+
make package-test
453441
454-
Verify The Latest Documentation
455-
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
442+
This will build the package and install it in a temporary virtual environment. Follow
443+
the instructions to activate the venv and test whatever you think is important.
456444

457-
To preview the documentation that will get published:
445+
Review the documentation that will get published:
458446

459447
.. code:: sh
460448
461-
$ make docs
449+
make docs
462450
463-
464-
Preview The Release Notes
465-
^^^^^^^^^^^^^^^^^^^^^^^^^
451+
Validate and preview the release notes:
466452

467453
.. code:: sh
468454
469-
$ towncrier build --draft
470-
455+
make validate-newsfragments
471456
472-
Compile The Release Notes
473-
^^^^^^^^^^^^^^^^^^^^^^^^^
457+
Build the release notes
458+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
474459

475-
After confirming that the release package looks okay, compile the release notes:
460+
Before bumping the version number, build the release notes. You must include the part of
461+
the version to bump (see below), which changes how the version number will show in the
462+
release notes.
476463

477464
.. code:: sh
478465
479-
$ make notes bump=$$VERSION_PART_TO_BUMP$$
480-
466+
make notes bump=$$VERSION_PART_TO_BUMP$$
481467
482-
You may need to fix up any broken release note fragments before committing. Keep
483-
running ``make build-docs`` until it passes, then commit and carry on.
468+
If there are any errors, be sure to re-run make notes until it works.
484469

470+
Push the release to github & pypi
471+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
485472

486-
Push The Release to GitHub & PyPI
487-
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
488-
489-
After committing the compiled release notes and pushing them to the main
490-
branch, release a new version:
473+
After confirming that the release package looks okay, release a new version:
491474

492475
.. code:: sh
493476
494-
$ make release bump=$$VERSION_PART_TO_BUMP$$
477+
make release bump=$$VERSION_PART_TO_BUMP$$
478+
479+
This command will:
495480

481+
- Bump the version number as specified in ``.pyproject.toml`` and ``setup.py``.
482+
- Create a git commit and tag for the new version.
483+
- Build the package.
484+
- Push the commit and tag to github.
485+
- Push the new package files to pypi.
496486

497-
Which Version Part to Bump
498-
^^^^^^^^^^^^^^^^^^^^^^^^^^
487+
Which version part to bump
488+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
499489

500-
The version format for this repo is ``{major}.{minor}.{patch}`` for
501-
stable, and ``{major}.{minor}.{patch}-{stage}.{devnum}`` for unstable
502-
(``stage`` can be alpha or beta).
490+
``$$VERSION_PART_TO_BUMP$$`` must be one of: ``major``, ``minor``, ``patch``, ``stage``,
491+
or ``devnum``.
503492

504-
During a release, specify which part to bump, like
505-
``make release bump=minor`` or ``make release bump=devnum``.
493+
The version format for this repo is ``{major}.{minor}.{patch}`` for stable, and
494+
``{major}.{minor}.{patch}-{stage}.{devnum}`` for unstable (``stage`` can be alpha or
495+
beta).
506496

507-
If you are in an alpha version, ``make release bump=stage`` will bump to beta.
508-
If you are in a beta version, ``make release bump=stage`` will bump to a stable
509-
version.
497+
If you are in a beta version, ``make release bump=stage`` will switch to a stable.
510498

511-
To issue an unstable version when the current version is stable, specify the new
512-
version explicitly, like ``make release bump="--new-version 4.0.0-alpha.1 devnum"``.
499+
To 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"``
513501

502+
You can see what the result of bumping any particular version part would be with
503+
``bump-my-version show-bump``
514504

515505
.. _Python Discord server: https://discord.gg/GHryRvPB84
516506
.. _style guide: https://github.com/ethereum/snake-charmers-tactical-manual/blob/main/style-guide.md

docs/index.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ block data, and a variety of other use cases.
1616
For project updates, follow `@EthereumPython`_ and sign up
1717
for new post notifications on the `blog`_.
1818

19+
.. toctree::
20+
:maxdepth: 1
21+
:caption: Community
1922

2023
Getting Started
2124
---------------

0 commit comments

Comments
 (0)