Skip to content

Commit

Permalink
Merge pull request #41 from CityOfZion/feature/releaseMethods
Browse files Browse the repository at this point in the history
Feature/release methods
  • Loading branch information
lllwvlvwlll committed Jun 13, 2020
2 parents ed254fb + a0aeb12 commit 9e79f42
Show file tree
Hide file tree
Showing 6 changed files with 201 additions and 4 deletions.
8 changes: 8 additions & 0 deletions .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[bumpversion]
current_version = 0.0.1
commit = True
tag = True

[bumpversion:file:./boa3/__init__.py]
search = __version__ = '{current_version}'
replace = __version__ = '{new_version}'
75 changes: 73 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,78 @@ jobs:
command: python -m unittest discover boa3_test
name: Test

build_deploy: &build_deploy
working_directory: ~/neo3-boa
docker:
- image: circleci/python:3.6.4
steps:
- checkout

- run:
name: Setup Environment
command: |
python3 -m venv venv
source venv/bin/activate
- run:
name: Install Deps
command: |
sudo pip install -r requirements_dev.txt
- run:
name: Build .pypirc
command: |
echo -e "[$PYPI_REPO]" >> ~/.pypirc
echo -e "username = $PYPI_USERNAME" >> ~/.pypirc
echo -e "password = $PYPI_PASSWORD" >> ~/.pypirc
- run:
name: Build Package
command: |
python3 setup.py sdist bdist_wheel
twine check dist/*
- run:
name: Push to TestPyPi
command:
python3 -m twine upload --repository $PYPI_REPO dist/*
build_deploy_test:
<<: *build_deploy
build_deploy_prod:
<<: *build_deploy

workflows:
main:
version: 2
build_test_deploy:
jobs:
- unit-test
- unit-test:
filters:
tags:
only: /.*/
- build_deploy_test:
context: pypi_test
requires:
- unit-test
filters:
tags:
only: /^v.*/
branches:
only: master
- approve-release:
type: approval
requires:
- build_deploy_test
filters:
tags:
only: /^v.*/
branches:
only: master
- build_deploy_prod:
context: pypi_prod
requires:
- approve-release
filters:
tags:
only: /^v.*/
branches:
only: master
111 changes: 111 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@

============================================
Python compiler for the Neo3 Virtual Machine
============================================

- `Overview <#overview>`__

Overview
--------

The ``neo3-boa`` compiler is a tool for compiling Python files to the
``.nef`` and ``.manisfest.json`` formats for usage in the `Neo Virtual
Machine <https://github.com/neo-project/neo-vm/>`__ which is used to
execute contracts on the `Neo
Blockchain <https://github.com/neo-project/neo/>`__.

What it currently does...
^^^^^^^^^^^^^^^^^^^^^^^^^

- Compiles a subset of the Python language to the ``.nef`` and
``.manisfest.json`` format for use in the `Neo Virtual
Machine <https://github.com/neo-project/neo-vm>`__

- Works for Python 3.6+

- Logs compiler errors and warnings

- Logs when the main method is analysed

- Logs method inclusions in ``.abi`` file to work with Neo Debuggers.

- Converts Functions

- Converts Local Variable Declarations and Assignments
``foo: int = 42 bar = foo``
- Converts Number Arithmetic Operations (``+``, ``-``, ``*``, ``//``,
``%``)

- Converts Numeric Arithmetic Augmented assignment Operators (``+=``,
``-=``, ``*=``, ``//=``, ``%=``)

- Converts Relational Operations (``==``, ``!=``, ``<``, ``<=``, ``>``,
``>=``)

- Converts Boolean Logic Operations and chained comparisons (``and``,
``or``, ``not``)

- Converts Tuple type (``get`` and ``set`` operations)

- Converts List type

- Converts While Statement

.. code:: python
foo = 0
while condition:
foo = foo + 2
- Converts If, elif, else Statements

.. code:: python
if condition1:
foo = 0
elif condition2:
foo = 1
else:
bar = 2
- Converts For Statement

.. code:: python
for x in (1, 2, 3):
...
- Converts Function Call

.. code:: python
def Main(num: int):
a = foo(num)
...
def foo(num: int) -> int:
...
- Converts ``len()`` for ``str``, ``tuple`` and ``list``

- Converts Multiple Expressions in the same line
(``i = i + h; a = 1; b = 3 + a; count = 0``)

- Converts String Slicing (``x = 'example'[2:4]``,
``x = 'example'[:4]``, ``x = 'example'[4:]``, ``x = 'example'[:]``)

What it will do...
^^^^^^^^^^^^^^^^^^

- ``continue``, ``break`` and ``pass``

- Convert Numeric Arithmetic Augmented assignment Operators (``/=``)

- Convert Number Arithmetic Operations (``/``, ``**``)

- Convert Relational Operations (``is``, ``is not``)

- Convert String Slicing (``x = 'example'[2:4:2]``,
``x = 'example'[::2]``)


2 changes: 1 addition & 1 deletion boa3/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import logging

logging.basicConfig(format='%(levelname)s: %(message)s', level=logging.DEBUG)
__version__ = '0.0.1-dev'
__version__ = '0.0.1'
6 changes: 6 additions & 0 deletions requirements_dev.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
autopep8==1.4.4
bumpversion==0.6.0
coverage==4.5.4
pycodestyle==2.5.0
twine>=1.10.0
wheel>=0.30.0
3 changes: 2 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
here = path.abspath(path.dirname(__file__))

# Get the long description from the README file
with open(path.join(here, 'README.md'), encoding='utf-8') as f:
with open(path.join(here, 'README.rst'), encoding='utf-8') as f:
long_description = f.read()


Expand All @@ -24,6 +24,7 @@

description='A Python compiler for the Neo3 Virtual Machine',
long_description=long_description,
long_description_content_type='text/x-rst',

# The project's main homepage.
url='https://github.com/CityOfZion/neo3-boa',
Expand Down

0 comments on commit 9e79f42

Please sign in to comment.