Skip to content

Commit

Permalink
Merge pull request #78 from fametrano/pr
Browse files Browse the repository at this point in the history
tested Python 3.11, fixed OpenSSL 3.x issue, and more
  • Loading branch information
fametrano authored Dec 31, 2022
2 parents a667604 + cc4306f commit 786b0e2
Show file tree
Hide file tree
Showing 128 changed files with 340 additions and 200 deletions.
1 change: 1 addition & 0 deletions .flake8
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,4 @@ ignore = E203, E501, W503
# emit a warning for high McCabe complexity
# See https://en.wikipedia.org/wiki/Cyclomatic_complexity
# max-complexity = 10
per-file-ignores = __init__.py:F401
12 changes: 8 additions & 4 deletions .github/workflows/experimental.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,21 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
# avoid early failure notice for windows
os: [ubuntu-latest, macos-latest]
experimental: [true]
steps:
- uses: actions/checkout@v2
- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: 3.11-dev
python-version: 3.12-dev
- name: Install requirements
run: |
pip install -U -r requirements-dev.txt
pip install -U -r requirements.txt
- name: Run Tox
run: tox -e py
- name: Run Test # tox
# tox with 3.12-dev fails because of pylint
# in general, better to receive early failure notice only for tests
# run: tox -e py
run: pytest --cov-report term-missing:skip-covered --cov=btclib --cov=tests
15 changes: 7 additions & 8 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,13 @@ on:
- dev

jobs:

test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python: ["3.7", "3.8", "3.9", "3.10"]
python: ["3.7", "3.8", "3.9", "3.10", "3.11"]
steps:
- uses: actions/checkout@v2
- name: Setup Python
Expand All @@ -45,9 +44,9 @@ jobs:
needs: test
runs-on: ubuntu-latest
steps:
- name: Upload to coveralls.io
run: |
pip install coveralls
coveralls --finish
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload to coveralls.io
run: |
pip install coveralls
coveralls --finish
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
123 changes: 123 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
# How to contribute to btclib

Thank you for investing your time in contributing to our project.
We are glad you are reading this, because we need volunteer developers
to help this project come to fruition.

If you haven't already:

- see the [README](./README.md) file to get an overview of the project
- read our [Code of Conduct](./CODE_OF_CONDUCT.md) to keep our community approachable and respectable
- come find us on [Slack](https://bbt-training.slack.com/archives/C01CCJ85AES).

In this guide you will get an overview of the contribution workflow from opening an issue, creating a PR, reviewing, and merging the PR.

## New contributor guide

Here are some resources to help you get started with open source contributions:

- [Finding ways to contribute to open source on GitHub](https://docs.github.com/en/get-started/exploring-projects-on-github/finding-ways-to-contribute-to-open-source-on-github)
- [Set up Git](https://docs.github.com/en/get-started/quickstart/set-up-git)
- [GitHub flow](https://docs.github.com/en/get-started/quickstart/github-flow)
- [Collaborating with pull requests](https://docs.github.com/en/github/collaborating-with-pull-requests)

## Getting started

Development tools are required to develop and test btclib;
they can be installed with:

python -m pip install --upgrade -r requirements-dev.txt

Developers might also consider installing btclib in editable way:

python -m pip install --upgrade -e ./

Finally, additional packages are needed to build the documentation:

python -m pip install --upgrade -r docs/requirements.txt

As an annotated python project, btclib is very strict on code formatting
([isort](https://pycqa.github.io/isort/),
[black](https://github.com/psf/black),
[pylint](https://pylint.pycqa.org/en/latest/),
[bandit](https://github.com/PyCQA/bandit),
[flake8](https://flake8.pycqa.org/en/latest/),
and [check-manifest](https://pypi.org/project/check-manifest/))
and proper type definition
([mypy](https://mypy-lang.org/)):
warnings are not tolerated and should be taken care of.
This might be annoying at first, but enforcing formatting rules can be done
easily once you're finished with coding or, even better, automatically
taken care of while coding, especially if you properly setup your development environment.
Type definition improves code readability and helps in spotting bugs.

Moreover, [unit tests](https://github.com/pytest-dev/pytest/) must pass at any time with 100% [coverage](https://coverage.readthedocs.io/) of both the
library and the test suite.

These requirements are easily checked (and partially fixed) if you test
the impact of your contribution with [tox](https://tox.wiki/).

We also like the contribution of [sourcery](https://sourcery.ai/): you might too.

Finally, even when it comes to mark-down (*.md files),
please use [markdownlint](https://github.com/DavidAnson/markdownlint).

\[To do: document how to do it in VS Code\]

### Issues

#### Create a new issue

Did you find a bug?
*Do not open up a GitHub issue if the bug is a security vulnerability*,
and instead refer to our [security policy](README.md).

For any other problem,
[search](https://docs.github.com/en/github/searching-for-information-on-github/searching-on-github/searching-issues-and-pull-requests)
first if an [issue](https://github.com/btclib-org/btclib/issues) (or a [fixing pull request](https://github.com/btclib-org/btclib/pulls), also known as a PR) already exists.
If a related issue/PR does not exist,
please open a new issue.

#### Solve an issue

Scan through our [existing issues](https://github.com/btclib-org/btclib/issues) to find one that interests you. As a general rule, we don’t assign issues to anyone. If you find an issue to work on, you are welcome to open a PR with a fix.

### Make Changes

Work locally on your fork of btclib,
until you are satisfied. Ensure that tox has no issue
with your modified codebase.

### Commit your update

Commit the changes to your fork once you are happy with them.

### Pull Request

When you're finished with the changes, create a pull request (PR).

- Don't forget to
[link PR to issue](https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue)
if you are solving one.
- Enable the checkbox to
[allow maintainer edits](https://docs.github.com/en/github/collaborating-with-issues-and-pull-requests/allowing-changes-to-a-pull-request-branch-created-from-a-fork) so the branch can be updated for a merge.
Once you submit your PR, team members will review your proposal.
We may ask questions or request additional information.
- We may ask for changes to be made before a PR can be merged, either using
[suggested changes](https://docs.github.com/en/github/collaborating-with-issues-and-pull-requests/incorporating-feedback-in-your-pull-request)
or pull request comments.
You can apply suggested changes directly through the UI.
You can make any other changes in your fork, then commit them to your branch.
- [Sourcery](https://sourcery.ai/) might suggest changes, please accept them.
- As you update your PR and apply changes, mark each conversation as
[resolved](https://docs.github.com/en/github/collaborating-with-issues-and-pull-requests/commenting-on-a-pull-request#resolving-conversations).
- If you run into any merge issues, checkout this
[git tutorial](https://github.com/skills/resolve-merge-conflicts)
to help you resolve merge conflicts and other issues.

### Your PR is merged

Congratulations :tada::tada: The btclib team thanks you :sparkles:.

Once your PR is merged, your contributions will be publicly visible on the
[contributors page](https://github.com/btclib-org/btclib/graphs/contributors).
24 changes: 16 additions & 8 deletions HISTORY.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,29 +5,37 @@ Notable changes to the codebase are documented here.
Release names follow [*calendar versioning*](https://calver.org/):
full year, short month, short day (YYYY-M-D)

## v2022.12.31

Major changes include:

- added support for Python 3.11
- fixed the OpenSSL 3.x RIPEMD160 issue in btclib/hashes.py
- added CONTRIBUTING and SECURITY
- solved issue #73 [Re-import Tx subclasses into btclib.tx](https://github.com/btclib-org/btclib/issues/73)

## v2022.7.20

Major changes include:

- by default ssa, dsa and point multiplication are now sped up using btclib_libsecp256k1;
this provides an 8 times speed up in benchmarks and 3 times in real world applications.


## v2022.5.3
## v2022.5.3

Major changes includes:

- dropped python 3.6 support
- added support for btclib_libsecp256k1
- the hashes.fingerprint function, removed in the previous version,
has been reinstated in the to_pub_key module
- encode_num and decode_num have been moved from
- the hashes.fingerprint function, removed in the previous version,
has been reinstated in the to_pub_key module
- encode_num and decode_num have been moved from
script.op_codes to utils
- op_pushdata and op_str have been renamed to
- op_pushdata and op_str have been renamed to
serialize_bytes_command and serialize_str_command
- script.op_codes has been removed and its functions merged in script
- script serialization is now more consistent: all integers, even small
ones, are now considered like bytes. To put small integers on the stack
ones, are now considered like bytes. To put small integers on the stack
OP_X must be used explicitly. Using integers directly will lead to larger
scripts that will be likely to be rejected by the network as not standard
- check_validity is now correctly propagated inside each function
Expand Down Expand Up @@ -108,7 +116,7 @@ Major changes includes:
bip32.deserialize(xkey), now it is bip32.BIP32KeyData.deserialize(xkey)
- bip32: added str_from_bip32_path and bytes_from_bip32_path
- bip3: made bip32 index an int (not bytes) to avoid byteorder ambiguity.
Consequently, where previously it was xkey_dict["index"][0] < 0x80,
Consequently, where previously it was xkey_dict\["index"\][0] < 0x80,
now it is xkey_dict.index < 0x80000000
- bip32: local "./" derivation, opposed to absolute "m/" derivation,
is not available anymore
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2017-2022 Ferdinando M. Ametrano and btclib contributors
Copyright (c) 2017-2023 Ferdinando M. Ametrano and btclib contributors

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
15 changes: 3 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,16 +115,7 @@ Windows Git bash shell:
cd ../..
python -m pip install --upgrade btclib

Some development tools are required to develop and test btclib;
they can be installed with:
See [CONTRIBUTING](./CONTRIBUTING.md) if you are interested
in btclib develoment.

python -m pip install --upgrade -r requirements-dev.txt

Some additional packages are needed to build the documentation:

python -m pip install --upgrade -r docs/requirements.txt


Developers might also consider installing btclib in editable way:

python -m pip install --upgrade -e ./
See [SECURITY](./SECURITY.md) if you have found a security vulnerability.
41 changes: 23 additions & 18 deletions RELEASE.md
Original file line number Diff line number Diff line change
@@ -1,31 +1,36 @@
# Release

1. Run tox to verify that we pass all the tests (at least on our local machine)
01. Run tox to verify that you pass all the tests (at least on your local machine)

2. Set appropriate version inside btclib/__init__.py and docs/source/conf.py
01. Set appropriate version inside btclib/__init__.py and docs/source/conf.py

3. Follow docs/README.rst and test that the documentation builds without problems
01. Follow docs/README.rst and test that the documentation builds without problems

4. Add every major change since the previous version to HISTORY.md, if it wasn't already added.
01. Add every major changes since the previous version to HISTORY.md, if they were not already there.

5. Push to Github. Verify that the documentation builds without failing on [read the docs](https://readthedocs.org/projects/btclib/builds/).
Also check that the [website](https://btclib.org) and the [documentation](https://btclib.readthedocs.io/en/latest/) are displayed correctly in a browser
01. Push to GitHub.

6. Build the package distribution files:
Verify that the documentation builds without failing on
[read the docs](https://readthedocs.org/projects/btclib/builds/).

```rm -r btclib.egg-info/ build/ dist/ && python setup.py sdist bdist_wheel```

7. Push the package files to PyPi:
Also check that the [website](https://btclib.org) and the
[documentation](https://btclib.readthedocs.io/en/latest/) are displayed correctly in a browser.

01. Build the package distribution files:

```rm -r btclib.egg-info/ build/ dist/ && python setup.py sdist bdist_wheel```

01. Push the package files to PyPi:

```twine upload dist/*```

8. Create a new release on Github:
01. Create a new release on GitHub:

Use the version as the title, and the history as the description.
Also upload the files in the dist/ folder as release attachments.

Use the version as the title, and the history as the description. Also upload the files in the dist/ folder
as the release attachments

9. Prepare for a new generic version:
01. Prepare for a new generic version:

Choose a new version without specifying the day (es. if the previous release was 2022.2.9, choose 2022.3)\
Then set the version in btclib/__init__.py and docs/source/conf.py to this new version. \
Use this new version name in HISTORY.md, specifying that it is in development
Choose a new version without specifying the day (es. if the previous release was 2022.2.9, choose 2022.3).
Then set the version in btclib/__init__.py and docs/source/conf.py to this new version.
Use this new version name in HISTORY.md, specifying that it is in development.
5 changes: 5 additions & 0 deletions SECURITY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Security policy

If you have found a security vulnerability,
please do not open up a GitHub issue; instead,
please provide responsible disclosure emailing _security at btclib dot org_.
6 changes: 3 additions & 3 deletions btclib/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env python3

# Copyright (C) 2020-2022 The btclib developers
# Copyright (C) 2020-2023 The btclib developers
#
# This file is part of btclib. It is subject to the license terms in the
# LICENSE file found in the top-level directory of this distribution.
Expand All @@ -11,8 +11,8 @@
"__init__ module for the btclib package."

name = "btclib"
__version__ = "2022.7.20"
__version__ = "2022.12.31"
__author__ = "The btclib developers"
__author_email__ = "[email protected]"
__copyright__ = "Copyright (C) 2017-2022 The btclib developers"
__copyright__ = "Copyright (C) 2017-2023 The btclib developers"
__license__ = "MIT License"
2 changes: 1 addition & 1 deletion btclib/alias.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env python3

# Copyright (C) 2017-2022 The btclib developers
# Copyright (C) 2017-2023 The btclib developers
#
# This file is part of btclib. It is subject to the license terms in the
# LICENSE file found in the top-level directory of this distribution.
Expand Down
2 changes: 1 addition & 1 deletion btclib/amount.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env python3

# Copyright (C) 2017-2022 The btclib developers
# Copyright (C) 2017-2023 The btclib developers
#
# This file is part of btclib. It is subject to the license terms in the
# LICENSE file found in the top-level directory of this distribution.
Expand Down
2 changes: 1 addition & 1 deletion btclib/b32.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.

# Copyright (C) 2019-2022 The btclib developers
# Copyright (C) 2019-2023 The btclib developers
#
# This file is part of btclib. It is subject to the license terms in the
# LICENSE file found in the top-level directory of this distribution.
Expand Down
2 changes: 1 addition & 1 deletion btclib/b58.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env python3

# Copyright (C) 2017-2022 The btclib developers
# Copyright (C) 2017-2023 The btclib developers
#
# This file is part of btclib. It is subject to the license terms in the
# LICENSE file found in the top-level directory of this distribution.
Expand Down
2 changes: 1 addition & 1 deletion btclib/base58.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env python3

# Copyright (C) 2017-2022 The btclib developers
# Copyright (C) 2017-2023 The btclib developers
#
# This file is part of btclib. It is subject to the license terms in the
# LICENSE file found in the top-level directory of this distribution.
Expand Down
2 changes: 1 addition & 1 deletion btclib/bech32.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.

# Copyright (C) 2019-2022 The btclib developers
# Copyright (C) 2019-2023 The btclib developers
#
# This file is part of btclib. It is subject to the license terms in the
# LICENSE file found in the top-level directory of this distribution.
Expand Down
Loading

0 comments on commit 786b0e2

Please sign in to comment.