Skip to content

Commit

Permalink
Merge pull request #193 from multiversx/feat/next
Browse files Browse the repository at this point in the history
Merge Feat/next into main
  • Loading branch information
popenta authored Jan 27, 2025
2 parents 057c29f + 3160a10 commit 1dfb580
Show file tree
Hide file tree
Showing 294 changed files with 37,919 additions and 11,025 deletions.
3 changes: 2 additions & 1 deletion .flake8
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
[flake8]
ignore = E501, E722
extend-ignore = E501, E722, E203
exclude = transaction_pb2*
24 changes: 15 additions & 9 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,18 @@ name: CI

on:
pull_request:
push:
branches: [main, feat/*]
workflow_dispatch:

jobs:
coverage:
runs-on: ubuntu-latest
runs-on: ${{ matrix.os }}

strategy:
matrix:
os: [ubuntu-latest, macos-latest]
python-version: [3.11]
max-parallel: 1 # This ensures jobs run sequentially, not concurrently

name: Check coverage
permissions:
# Gives the action the necessary permissions for publishing new
Expand All @@ -17,34 +23,34 @@ jobs:
# python-coverage-comment-action branch, and for editing existing
# comments (to avoid publishing multiple comments in the same PR)
contents: write

steps:
- uses: actions/checkout@v3

- name: Set up Python
id: setup-python
uses: actions/setup-python@v4
with:
python-version: 3.11
python-version: ${{ matrix.python-version }}

- name: Install deps
run: |
pip install -r requirements.txt
pip install -r requirements-dev.txt
- name: Launch tests & generate report
run: coverage run -m pytest .
run: coverage run -m pytest -m "not mainnet"

- name: Coverage comment
id: coverage_comment
if: matrix.os == 'ubuntu-latest' # Run only on Ubuntu
uses: py-cov-action/python-coverage-comment-action@v3
with:
GITHUB_TOKEN: ${{ github.token }}

- name: Store Pull Request comment to be posted
uses: actions/upload-artifact@v3
if: steps.coverage_comment.outputs.COMMENT_FILE_WRITTEN == 'true'
if: matrix.os == 'ubuntu-latest' && steps.coverage_comment.outputs.COMMENT_FILE_WRITTEN == 'true' # Run only on Ubuntu
uses: actions/upload-artifact@v4
with:
# If you use a different name, update COMMENT_ARTIFACT_NAME accordingly
name: python-coverage-comment-action
# If you use a different name, update COMMENT_FILENAME accordingly
path: python-coverage-comment-action.txt
2 changes: 1 addition & 1 deletion .github/workflows/linter-flake8.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@ jobs:
pip install -r requirements-dev.txt
- name: Lint with flake8
run: |
flake8 multiversx_sdk
flake8 multiversx_sdk --exclude=transaction_pb2*
continue-on-error: true
32 changes: 0 additions & 32 deletions .github/workflows/test.yml

This file was deleted.

25 changes: 18 additions & 7 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,24 +1,35 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
rev: v5.0.0
hooks:
- id: check-yaml
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/hhatto/autopep8
rev: v2.0.4
- repo: https://github.com/psf/black
rev: 24.10.0
hooks:
- id: autopep8
args:
- "-i"
- id: black
args: [--line-length=120]
- repo: https://github.com/pycqa/isort
rev: 5.13.2
hooks:
- id: isort
name: isort (python)
args: ["--profile", "black", "--filter-files"]
- repo: https://github.com/PyCQA/flake8
rev: 7.0.0
rev: 7.1.1
hooks:
- id: flake8
args:
- "--config=.flake8"
- repo: https://github.com/PyCQA/autoflake
rev: v2.3.1
hooks:
- id: autoflake
args:
- --in-place
- --remove-all-unused-imports
- repo: https://github.com/RobertCraigie/pyright-python
rev: v1.1.392
hooks:
- id: pyright
6 changes: 3 additions & 3 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
"python.testing.pytestEnabled": true,
"editor.formatOnSave": true,
"[python]": {
"editor.defaultFormatter": "ms-python.autopep8"
"editor.defaultFormatter": "ms-python.black-formatter"
},
"editor.defaultFormatter": "ms-python.autopep8",
"editor.codeActionsOnSave": {
"source.organizeImports": "explicit"
},
"files.insertFinalNewline": true,
"files.trimTrailingWhitespace": true,
"python.languageServer": "Pylance"
"python.languageServer": "Pylance",
"black-formatter.args": ["--line-length=120"]
}
12 changes: 11 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ Install development dependencies, as well:
pip install -r ./requirements-dev.txt --upgrade
```

Allow `pre-commit` to automatically run on `git commit`:
```
pre-commit install
```

Above, `requirements.txt` should mirror the **dependencies** section of `pyproject.toml`.

If using VSCode, restart it or follow these steps:
Expand All @@ -46,6 +51,11 @@ If you want to skip network interaction tests run:
pytest -m "not networkInteraction"
```

We have some tests fetching mainnet transactions that are quite time consuming. To skip those, run this command:
```
pytest -m "not mainnet"
```

### Generate test coverage report

First, we run the tests using coverage:
Expand All @@ -67,7 +77,7 @@ coverage html

Each time a new module/submodule is added it needs to be added to the docs, as well. To do so `cd` in the root directory then run the following command:
```bash
sphinx-apidoc -f -o docs/ multiversx_sdk/ *_test.py *constants.py
sphinx-apidoc -f -o docs/ multiversx_sdk/ '*_test.py' '*constants.py'
```

This command will regenerate the `.rst` files for each module, excluding the tests and the `constants.py` files.
Expand Down
18 changes: 9 additions & 9 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,23 @@

sys.path.insert(0, os.path.abspath(".."))

project = 'multiversx-sdk'
copyright = '2024, MultiversX'
author = 'MultiversX'
release = '0.19.0'
project = "multiversx-sdk"
copyright = "2024, MultiversX"
author = "MultiversX"
release = "1.0.0"

# -- General configuration ---------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration

extensions = ["sphinx.ext.todo", "sphinx.ext.viewcode", "sphinx.ext.autodoc"]

templates_path = ['_templates']
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
templates_path = ["_templates"]
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]


# -- Options for HTML output -------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output

html_theme = 'sphinx_rtd_theme'
html_static_path = ['_static']
autoclass_content = 'both'
html_theme = "sphinx_rtd_theme"
html_static_path = ["_static"]
autoclass_content = "both"
16 changes: 16 additions & 0 deletions docs/multiversx_sdk.abi.rst
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,22 @@ multiversx\_sdk.abi.list\_value module
:undoc-members:
:show-inheritance:

multiversx\_sdk.abi.managed\_decimal\_signed\_value module
----------------------------------------------------------

.. automodule:: multiversx_sdk.abi.managed_decimal_signed_value
:members:
:undoc-members:
:show-inheritance:

multiversx\_sdk.abi.managed\_decimal\_value module
--------------------------------------------------

.. automodule:: multiversx_sdk.abi.managed_decimal_value
:members:
:undoc-members:
:show-inheritance:

multiversx\_sdk.abi.multi\_value module
---------------------------------------

Expand Down
29 changes: 29 additions & 0 deletions docs/multiversx_sdk.account_management.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
multiversx\_sdk.account\_management package
===========================================

Submodules
----------

multiversx\_sdk.account\_management.account\_controller module
--------------------------------------------------------------

.. automodule:: multiversx_sdk.account_management.account_controller
:members:
:undoc-members:
:show-inheritance:

multiversx\_sdk.account\_management.account\_transactions\_factory module
-------------------------------------------------------------------------

.. automodule:: multiversx_sdk.account_management.account_transactions_factory
:members:
:undoc-members:
:show-inheritance:

Module contents
---------------

.. automodule:: multiversx_sdk.account_management
:members:
:undoc-members:
:show-inheritance:
29 changes: 29 additions & 0 deletions docs/multiversx_sdk.accounts.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
multiversx\_sdk.accounts package
================================

Submodules
----------

multiversx\_sdk.accounts.account module
---------------------------------------

.. automodule:: multiversx_sdk.accounts.account
:members:
:undoc-members:
:show-inheritance:

multiversx\_sdk.accounts.ledger\_account module
-----------------------------------------------

.. automodule:: multiversx_sdk.accounts.ledger_account
:members:
:undoc-members:
:show-inheritance:

Module contents
---------------

.. automodule:: multiversx_sdk.accounts
:members:
:undoc-members:
:show-inheritance:
29 changes: 29 additions & 0 deletions docs/multiversx_sdk.builders.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
multiversx\_sdk.builders package
================================

Submodules
----------

multiversx\_sdk.builders.token\_transfers\_data\_builder module
---------------------------------------------------------------

.. automodule:: multiversx_sdk.builders.token_transfers_data_builder
:members:
:undoc-members:
:show-inheritance:

multiversx\_sdk.builders.transaction\_builder module
----------------------------------------------------

.. automodule:: multiversx_sdk.builders.transaction_builder
:members:
:undoc-members:
:show-inheritance:

Module contents
---------------

.. automodule:: multiversx_sdk.builders
:members:
:undoc-members:
:show-inheritance:
Loading

0 comments on commit 1dfb580

Please sign in to comment.