Fixes issue #15. All tests successful with Python3.9. Review required though

This commit is contained in:
Sangat Das 2022-01-26 14:02:24 +00:00
parent 4ddfcb0d8d
commit 5db16c8b3b
23 changed files with 93 additions and 122 deletions

View File

@ -24,7 +24,7 @@ If applicable, add add textual content to help explain your problem.
- Bigchaindb version:
- Tendermint version:
- Mongodb version:
- Python full version: [e.g. Python 3.6.6]
- Python full version: [e.g. Python 3.9.3]
**Additional context**
Add any other context about the problem here.

View File

@ -7,5 +7,5 @@ build:
image: latest
python:
version: 3.6
version: 3.9
pip_install: true

View File

@ -14,9 +14,7 @@ language: python
cache: pip
python:
- 3.6
- 3.7
- 3.8
- 3.9
env:
global:
@ -28,40 +26,16 @@ env:
matrix:
fast_finish: true
include:
- python: 3.6
- python: 3.9
env:
- PLANETMINT_DATABASE_BACKEND=localmongodb
- PLANETMINT_DATABASE_SSL=
- python: 3.6
- python: 3.9
env:
- PLANETMINT_DATABASE_BACKEND=localmongodb
- PLANETMINT_DATABASE_SSL=
- PLANETMINT_CI_ABCI=enable
- python: 3.6
env:
- PLANETMINT_ACCEPTANCE_TEST=enable
- python: 3.7
env:
- PLANETMINT_DATABASE_BACKEND=localmongodb
- PLANETMINT_DATABASE_SSL=
- python: 3.7
env:
- PLANETMINT_DATABASE_BACKEND=localmongodb
- PLANETMINT_DATABASE_SSL=
- PLANETMINT_CI_ABCI=enable
- python: 3.7
env:
- PLANETMINT_ACCEPTANCE_TEST=enable
- python: 3.8
env:
- PLANETMINT_DATABASE_BACKEND=localmongodb
- PLANETMINT_DATABASE_SSL=
- python: 3.8
env:
- PLANETMINT_DATABASE_BACKEND=localmongodb
- PLANETMINT_DATABASE_SSL=
- PLANETMINT_CI_ABCI=enable
- python: 3.8
- python: 3.9
env:
- PLANETMINT_ACCEPTANCE_TEST=enable

View File

@ -1,4 +1,4 @@
FROM python:3.6
FROM python:3.9
LABEL maintainer "contact@ipdb.global"
RUN mkdir -p /usr/src/app
COPY . /usr/src/app/

View File

@ -1,4 +1,4 @@
ARG python_version=3.6
ARG python_version=3.9
FROM python:${python_version}
LABEL maintainer "contact@ipdb.global"

View File

@ -1,4 +1,4 @@
FROM python:3.6.3
FROM python:3.9
RUN mkdir -p /src
RUN pip install --upgrade \

View File

@ -42,7 +42,7 @@ This Code of Conduct applies both within project spaces and in public spaces
when an individual is representing the project or its community.
Instances of abusive, harassing, or otherwise unacceptable behavior directed at yourself or another community member may be
reported by contacting a project maintainer at [contact@bigchaindb.com](mailto:contact@bigchaindb.com). All
reported by contacting a project maintainer at [contact@planetmint.com](mailto:contact@planetmint.com). All
complaints will be reviewed and investigated and will result in a response that
is appropriate to the circumstances. Maintainers are
obligated to maintain confidentiality with regard to the reporter of an

View File

@ -16,7 +16,7 @@ Our starting point is [PEP8](https://www.python.org/dev/peps/pep-0008/), the sta
Planetmint uses Python 3.5+, so you can ignore all PEP8 guidelines specific to Python 2.
We use [pre-commit](http://pre-commit.com/) to check some of the rules below before every commit but not everything is realized yet.
The hooks we use can be found in the [.pre-commit-config.yaml](https://github.com/bigchaindb/bigchaindb/blob/master/.pre-commit-config.yaml) file.
The hooks we use can be found in the [.pre-commit-config.yaml](https://github.com/planetmint/planetmint/blob/master/.pre-commit-config.yaml) file.
### Python Docstrings
@ -86,12 +86,12 @@ we use the `format()` version. The [official Python documentation says](https://
We use [Flake8](http://flake8.pycqa.org/en/latest/index.html) to check our Python code style. Once you have it installed, you can run it using:
```text
flake8 --max-line-length 119 bigchaindb/
flake8 --max-line-length 119 planetmint/
```
## Writing and Running (Python) Tests
The content of this section was moved to [`bigchaindb/tests/README.md`](https://github.com/bigchaindb/bigchaindb/blob/master/tests/README.md).
The content of this section was moved to [`planetmint/tests/README.md`](https://github.com/planetmint/planetmint/blob/master/tests/README.md).
Note: We automatically run all tests on all pull requests (using Travis CI), so you should definitely run all tests locally before you submit a pull request. See the above-linked README file for instructions.

View File

@ -25,7 +25,7 @@ to [regular semantic versioning](http://semver.org/), but there's no hyphen, e.g
We use `0.9` and `0.9.0` as example version and short-version values below. You should replace those with the correct values for your new version.
We follow [BEP-1](https://github.com/bigchaindb/BEPs/tree/master/1), which is our variant of C4, the Collective Code Construction Contract, so a release is just a [tagged commit](https://git-scm.com/book/en/v2/Git-Basics-Tagging) on the `master` branch, i.e. a label for a particular Git commit.
We follow [BEP-1](https://github.com/planetmint/BEPs/tree/master/1), which is our variant of C4, the Collective Code Construction Contract, so a release is just a [tagged commit](https://git-scm.com/book/en/v2/Git-Basics-Tagging) on the `master` branch, i.e. a label for a particular Git commit.
The following steps are what we do to release a new version of _BigchainDB Server_. The steps to release the Python Driver are similar but not the same.
@ -37,13 +37,13 @@ The following steps are what we do to release a new version of _BigchainDB Serve
- Update all Docker image tags in all Kubernetes YAML files (in the `k8s/` directory).
For example, in the files:
- `k8s/bigchaindb/bigchaindb-ss.yaml` and
- `k8s/dev-setup/bigchaindb.yaml`
- `k8s/planetmint/planetmint-ss.yaml` and
- `k8s/dev-setup/planetmint.yaml`
find the line of the form `image: bigchaindb/bigchaindb:0.8.1` and change the version number to the new version number, e.g. `0.9.0`. (This is the Docker image that Kubernetes should pull from Docker Hub.)
find the line of the form `image: planetmint/planetmint:0.8.1` and change the version number to the new version number, e.g. `0.9.0`. (This is the Docker image that Kubernetes should pull from Docker Hub.)
Keep in mind that this is a _Docker image tag_ so our naming convention is
a bit different; see Note 2 in the **Notes** section above.
- In `bigchaindb/version.py`:
- In `planetmint/version.py`:
- update `__version__` to e.g. `0.9.0` (with no `.dev` on the end)
- update `__short_version__` to e.g. `0.9` (with no `.dev` on the end)
- In the docs about installing Planetmint (and Tendermint), and in the associated scripts, recommend/install a version of Tendermint that _actually works_ with the soon-to-be-released version of Planetmint. You can find all such references by doing a search for the previously-recommended version number, such as `0.31.5`.
@ -51,7 +51,7 @@ The following steps are what we do to release a new version of _BigchainDB Serve
2. **Wait for all the tests to pass!**
3. Merge the pull request into the `master` branch.
4. Go to the [bigchaindb/bigchaindb Releases page on GitHub](https://github.com/bigchaindb/bigchaindb/releases)
4. Go to the [planetmint/planetmint Releases page on GitHub](https://github.com/planetmint/planetmint/releases)
and click the "Draft a new release" button.
5. Fill in the details:
- **Tag version:** version number preceded by `v`, e.g. `v0.9.1`
@ -59,9 +59,9 @@ The following steps are what we do to release a new version of _BigchainDB Serve
- **Title:** Same as tag version above, e.g `v0.9.1`
- **Description:** The body of the changelog entry (Added, Changed, etc.)
6. Click "Publish release" to publish the release on GitHub.
7. On your local computer, make sure you're on the `master` branch and that it's up-to-date with the `master` branch in the bigchaindb/bigchaindb repository (e.g. `git pull upstream master`). We're going to use that to push a new `bigchaindb` package to PyPI.
7. On your local computer, make sure you're on the `master` branch and that it's up-to-date with the `master` branch in the planetmint/planetmint repository (e.g. `git pull upstream master`). We're going to use that to push a new `planetmint` package to PyPI.
8. Make sure you have a `~/.pypirc` file containing credentials for PyPI.
9. Do `make release` to build and publish the new `bigchaindb` package on PyPI. For this step you need to have `twine` installed. If you get an error like `Makefile:135: recipe for target 'clean-pyc' failed` then try doing
9. Do `make release` to build and publish the new `planetmint` package on PyPI. For this step you need to have `twine` installed. If you get an error like `Makefile:135: recipe for target 'clean-pyc' failed` then try doing
```text
sudo chown -R $(whoami):$(whoami) .
```
@ -80,8 +80,8 @@ The following steps are what we do to release a new version of _BigchainDB Serve
3. Scroll to the bottom of the page and click "Save".
11. Go to [Docker Hub](https://hub.docker.com/) and sign in, then:
- Click on "Organizations"
- Click on "bigchaindb"
- Click on "bigchaindb/bigchaindb"
- Click on "planetmint"
- Click on "planetmint/planetmint"
- Click on "Build Settings"
- Find the row where "Docker Tag Name" equals `latest`
and change the value of "Name" to the name (Git tag)

View File

@ -62,7 +62,7 @@ Set Up Your Local Machine. Here's How.
$ virtualenv -p $(which python3.6) NEW_ENV_NAME
$ . NEW_ENV_NAME/bin/activate
Be sure to use Python 3.6.x as the Python version for your virtualenv. The virtualenv creation process will actually get the
Be sure to use Python 3.9.x as the Python version for your virtualenv. The virtualenv creation process will actually get the
latest ``pip``, ``wheel`` and ``setuptools`` and put them inside the new virtualenv.

View File

@ -300,7 +300,7 @@ full path to the file where error logs should be written.
### log.level_console
The log level used to log to the console. Possible allowed values are the ones
defined by [Python](https://docs.python.org/3.6/library/logging.html#levels),
defined by [Python](https://docs.python.org/3.9/library/logging.html#levels),
but case-insensitive for the sake of convenience:
```text
@ -310,7 +310,7 @@ but case-insensitive for the sake of convenience:
### log.level_logfile
The log level used to log to the log file. Possible allowed values are the ones
defined by [Python](https://docs.python.org/3.6/library/logging.html#levels),
defined by [Python](https://docs.python.org/3.9/library/logging.html#levels),
but case-insensitive for the sake of convenience:
```text
@ -323,7 +323,7 @@ The format string for the date/time portion of a message, when logged to the
console.
For more information on how to construct the format string please consult the
table under [Python's documentation of time.strftime(format[, t])](https://docs.python.org/3.6/library/time.html#time.strftime).
table under [Python's documentation of time.strftime(format[, t])](https://docs.python.org/3.9/library/time.html#time.strftime).
### log.datefmt_logfile
@ -331,7 +331,7 @@ The format string for the date/time portion of a message, when logged to a log
file.
For more information on how to construct the format string please consult the
table under [Python's documentation of time.strftime(format[, t])](https://docs.python.org/3.6/library/time.html#time.strftime).
table under [Python's documentation of time.strftime(format[, t])](https://docs.python.org/3.9/library/time.html#time.strftime).
### log.fmt_console
@ -339,7 +339,7 @@ A string used to format the log messages when logged to the console.
For more information on possible formatting options please consult Python's
documentation on
[LogRecord attributes](https://docs.python.org/3.6/library/logging.html#logrecord-attributes).
[LogRecord attributes](https://docs.python.org/3.9/library/logging.html#logrecord-attributes).
### log.fmt_logfile
@ -347,7 +347,7 @@ A string used to format the log messages when logged to a log file.
For more information on possible formatting options please consult Python's
documentation on
[LogRecord attributes](https://docs.python.org/3.6/library/logging.html#logrecord-attributes).
[LogRecord attributes](https://docs.python.org/3.9/library/logging.html#logrecord-attributes).
### log.granular_levels

View File

@ -74,7 +74,7 @@ $ planetmint --log-level INFO start
The allowed levels are `DEBUG`, `INFO`, `WARNING`, `ERROR`, and `CRITICAL`.
For an explanation regarding these levels please consult the
[Logging Levels](https://docs.python.org/3.6/library/logging.html#levels)
[Logging Levels](https://docs.python.org/3.9/library/logging.html#levels)
section of Python's documentation.
For a more fine-grained control over the logging configuration you can use the

View File

@ -13,7 +13,7 @@ Code is Apache-2.0 and docs are CC-BY-4.0
Planetmint Server requires Python 3.5+ and Python 3.5+ [will run on any modern OS](https://docs.python.org/3.5/using/index.html), but we recommend using an LTS version of [Ubuntu Server](https://www.ubuntu.com/server) or a similarly server-grade Linux distribution.
_Don't use macOS_ (formerly OS X, formerly Mac OS X), because it's not a server-grade operating system. Also, BigchaindB Server uses the Python multiprocessing package and [some functionality in the multiprocessing package doesn't work on Mac OS X](https://docs.python.org/3.6/library/multiprocessing.html#multiprocessing.Queue.qsize).
_Don't use macOS_ (formerly OS X, formerly Mac OS X), because it's not a server-grade operating system. Also, Planetmint Server uses the Python multiprocessing package and [some functionality in the multiprocessing package doesn't work on Mac OS X](https://docs.python.org/3.9/library/multiprocessing.html#multiprocessing.Queue.qsize).
## General Considerations

View File

@ -13,7 +13,7 @@ MongoDB and Tendermint.
## Install Planetmint Server
Planetmint Server requires **Python 3.6+**, so make sure your system has it.
Planetmint Server requires **Python 3.9+**, so make sure your system has it.
Install the required OS-level packages:

View File

@ -1,31 +0,0 @@
# Copyright © 2020 Interplanetary Database Association e.V.,
# Planetmint and IPDB software contributors.
# SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0)
# Code is Apache-2.0 and docs are CC-BY-4.0
---
- name: Check if python3 already installed
shell: which python3
register: chk_py36
ignore_errors: yes
tags: [py36]
- name: Check version of python3
shell: "python3 -c 'import platform; print(platform.python_version())' | cut -d. -f-2"
when: chk_py36.rc == 0
register: py36_ver
tags: [py36]
- name: Creating files for python 3.6 installation
file:
template: src=install_py36.j2 dest=/home/vagrant/install_py36.bash
mode: 0755
when: chk_py36.rc == 0 and (py36_ver.stdout | float < 3.6)
tags: [py36]
- name: Install py36
shell: "bash /home/vagrant/install_py36.bash > install_py36.txt"
register: install_py36
failed_when: "'FAILED' in install_py36.stderr or install_py36.rc != 0"
when: chk_py36.rc == 0 and (py36_ver.stdout | float < 3.6)
tags: [py36]

View File

@ -4,7 +4,7 @@
# Code is Apache-2.0 and docs are CC-BY-4.0
---
- name: Install dependencies py36 | yum
- name: Install dependencies py39 | yum
yum:
name: "{{ item }}"
update_cache: yes
@ -12,15 +12,15 @@
with_items:
- "yum-utils"
- "https://centos7.iuscommunity.org/ius-release.rpm"
tags: [py36]
tags: [py39]
- name: Install py36 | yum
- name: Install py39 | yum
yum:
name: "{{ item }}"
state: present
update_cache: yes
with_items:
- "python36u"
- "python36u-pip"
- "python36u-devel"
tags: [py36]
- "python39u"
- "python39u-pip"
- "python39u-devel"
tags: [py39]

View File

@ -0,0 +1,31 @@
# Copyright © 2020 Interplanetary Database Association e.V.,
# Planetmint and IPDB software contributors.
# SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0)
# Code is Apache-2.0 and docs are CC-BY-4.0
---
- name: Check if python3 already installed
shell: which python3
register: chk_py39
ignore_errors: yes
tags: [py39]
- name: Check version of python3
shell: "python3 -c 'import platform; print(platform.python_version())' | cut -d. -f-2"
when: chk_py39.rc == 0
register: py39_ver
tags: [py39]
- name: Creating files for python 3.9 installation
file:
template: src=install_py39.j2 dest=/home/vagrant/install_py39.bash
mode: 0755
when: chk_py39.rc == 0 and (py39_ver.stdout | float < 3.9)
tags: [py39]
- name: Install py39
shell: "bash /home/vagrant/install_py39.bash > install_py39.txt"
register: install_py39
failed_when: "'FAILED' in install_py39.stderr or install_py39.rc != 0"
when: chk_py39.rc == 0 and (py39_ver.stdout | float < 3.9)
tags: [py39]

View File

@ -6,20 +6,20 @@
---
- name: Check version of python3
shell: "python3 -c 'import platform; print(platform.python_version())' | cut -d. -f-2"
register: py36_ver
tags: [py36]
register: py39_ver
tags: [py39]
- name: Install py36 | dnf
- name: Install py39 | dnf
dnf:
name: "{{ item }}"
state: present
with_items:
- "python36"
- "python39"
- libselinux-python
- policycoreutils-python
- wget
when: py36_ver.stdout | float < 3.6
tags: [py36]
when: py39_ver.stdout | float < 3.9
tags: [py39]
- name: Update fedora
shell: dnf -y update
@ -27,18 +27,18 @@
failed_when: "'FAILED' in update_fed.stderr or update_fed.rc != 0"
args:
warn: no
tags: [py36]
tags: [py39]
- name: Creating files for python 3.6 installation
- name: Creating files for python 3.9 installation
file:
template: src=install_pip36.j2 dest=/home/vagrant/install_pip36.bash
mode: 0755
when: py36_ver.stdout | float < 3.6
tags: [py36]
when: py39_ver.stdout | float < 3.9
tags: [py39]
- name: Install pip36
shell: "bash /home/vagrant/install_pip36.bash > install_pip36.txt"
register: install_pip36
failed_when: "'FAILED' in install_pip36.stderr or install_pip36.rc != 0"
when: py36_ver.stdout | float < 3.6
tags: [py36]
when: py39_ver.stdout | float < 3.9
tags: [py39]

View File

@ -6,11 +6,11 @@
---
- import_tasks: debian.yml
when: stack_type|lower == "local" and (ansible_distribution|lower == "debian" or ansible_distribution|lower == "ubuntu")
tags: [py36]
tags: [py39]
- import_tasks: centos.yml
when: stack_type|lower == "local" and (ansible_distribution|lower == "centos" or ansible_distribution|lower == "red hat enterprise linux")
tags: [py36]
tags: [py39]
- import_tasks: fedora.yml
when: stack_type|lower == "local" and (ansible_distribution|lower == "fedora")

View File

@ -3,6 +3,6 @@
set -ex
export PYTHON_PIP_VERSION=10.0.1
wget -O get-pip.py 'https://bootstrap.pypa.io/get-pip.py'
python3.6 get-pip.py --disable-pip-version-check
python3.9 get-pip.py --disable-pip-version-check
rm -f get-pip.py
{% endraw %}

View File

@ -4,7 +4,7 @@ set -ex
export PATH=/usr/local/bin:$PATH
export LANG=C.UTF-8
export GPG_KEY=0D96DF4D4110E5C43FBFB17F2D347EA6AA65421D
export PYTHON_VERSION=3.6.5
export PYTHON_VERSION=3.9
rm -rf /var/lib/apt/lists/* && \
apt-get update && apt-get install -y --no-install-recommends tcl tk libssl-dev && rm -rf /var/lib/apt/lists/* && \
apt-get update && apt-get install -y dpkg-dev tcl-dev tk-dev --no-install-recommends && rm -rf /var/lib/apt/lists/* && \

View File

@ -13,8 +13,8 @@ For full docs visit https://docs.planetmint.com
import sys
from setuptools import setup, find_packages
if sys.version_info < (3, 6):
sys.exit('Please use Python version 3.6 or higher.')
if sys.version_info < (3, 9):
sys.exit('Please use Python version 3.9 or higher.')
# get the version
version = {}
@ -111,7 +111,7 @@ setup(
author_email='contact@ipdb.global',
license='Apache Software License 2.0',
zip_safe=False,
python_requires='>=3.6',
python_requires='>=3.9',
classifiers=[
'Development Status :: 4 - Beta',
'Intended Audience :: Developers',
@ -120,10 +120,7 @@ setup(
'Topic :: Software Development',
'Natural Language :: English',
'License :: OSI Approved :: Apache Software License',
'Programming Language :: Python :: 3 :: Only',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Operating System :: MacOS :: MacOS X',
'Operating System :: POSIX :: Linux',
],

View File

@ -1,9 +1,9 @@
[tox]
skipsdist = true
envlist = py{36,37,38}, flake8, docsroot
envlist = py{39}, flake8, docsroot
[base]
basepython = python3.8
basepython = python3.9
deps = pip>=9.0.1
[testenv]