From 3df12e286963e01b82633a02cb5e816727d7970f Mon Sep 17 00:00:00 2001 From: Vladimir Domnich Date: Fri, 23 Sep 2022 13:01:38 +0400 Subject: [PATCH] [#3] Add tools required to build PyPI package Signed-off-by: Vladimir Domnich --- .gitignore | 7 +++++- README.md | 28 +++++++++++++--------- pyproject.toml | 44 ++++++++++++++++++++++++++++++++++- requirements.txt | 12 ++++++++-- src/neofs_testlib/__init__.py | 1 + 5 files changed, 77 insertions(+), 15 deletions(-) create mode 100644 src/neofs_testlib/__init__.py diff --git a/.gitignore b/.gitignore index 743b23b1..8a7034d4 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,10 @@ # ignore IDE files .vscode -# ignore caches under any path +# ignore temp files under any path +.DS_Store **/__pycache__ + +# ignore build artifacts +/dist +*.egg-info diff --git a/README.md b/README.md index 995c9463..bd92d6e5 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,17 @@ # neofs-testlib This library provides building blocks and utilities to facilitate development of automated tests for NeoFS system. -## Repository structure -TODO - ## Installation -TODO +Library can be installed via pip: +```shell +$ pip install neofs-testlib +``` + +## Library structure +The library provides the following primary components: + * `cli` - wrappers on top of neoFS command-line tools. These wrappers execute on a shell and provide type-safe interface for interacting with the tools. + * `reporter` - abstraction on top of test reporting tool like Allure. Components of the library will report their steps and attach artifacts to the configured reporter instance. + * `shell` - shells that can be used to execute commands. Currently library provides local shell (on machine that runs the code) or SSH shell that connects to a remote machine via SSH. ## Contributing Any contributions to the library should conform to the [contribution guideline](https://github.com/nspcc-dev/neofs-node/blob/master/CONTRIBUTING.md). @@ -14,21 +20,21 @@ Any contributions to the library should conform to the [contribution guideline]( To setup development environment for `neofs-testlib`, please, take the following steps: 1. Prepare virtualenv -``` +```shell $ virtualenv --python=python3.9 venv $ source venv/bin/activate ``` 2. Install all dependencies: -``` +```shell $ pip install -r requirements.txt ``` 3. Setup pre-commit hooks to run code formatters on staged files before you run a `git commit` command: -``` -pre-commit install +```shell +$ pre-commit install ``` Optionally you might want to integrate code formatters with your code editor to apply formatters to code files as you go: @@ -37,8 +43,8 @@ Optionally you might want to integrate code formatters with your code editor to ### Unit Tests Before submitting any changes to the library, please, make sure that all unit tests are passing. To run the tests, please, use the following command: -``` -python -m unittest discover --start-directory tests +```shell +$ python -m unittest discover --start-directory tests ``` To enable tests that interact with SSH server, please, setup SSH server and set the following environment variables before running the tests: @@ -78,4 +84,4 @@ To upload package to actual PyPI, please, use command: ```shell $ twine upload dist/* ``` -It will prompt for your username and password. You would need to [create account](https://pypi.org/account/register/) in order to execute it. +It will prompt for your username and password. You would need to [create PyPI account](https://pypi.org/account/register/) in order to execute it. diff --git a/pyproject.toml b/pyproject.toml index bd0087bd..7d5b913d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,8 +1,50 @@ +[build-system] +requires = ["setuptools>=63.0.0", "wheel"] +build-backend = "setuptools.build_meta" + +[project] +name = "neofs-testlib" +version = "0.1.0" +description = "Building blocks and utilities to facilitate development of automated tests for NeoFS system" +readme = "README.md" +authors = [{ name = "NSPCC", email = "info@nspcc.ru" }] +license = { text = "GNU General Public License v3 (GPLv3)" } +classifiers = [ + "License :: OSI Approved :: GNU General Public License v3 (GPLv3)", + "Programming Language :: Python", + "Programming Language :: Python :: 3", +] +keywords = ["neofs", "test"] +dependencies = [ + "allure-python-commons>=2.9.45", + "paramiko>=2.10.3", + "pexpect>=4.8.0", +] +requires-python = ">=3.9" + +[project.optional-dependencies] +dev = ["black", "bumpver", "isort", "pre-commit"] + +[project.urls] +Homepage = "https://github.com/nspcc-dev/neofs-testlib" + [tool.isort] profile = "black" -src_paths = ["reporter", "shell", "tests"] +src_paths = ["src", "tests"] line_length = 100 [tool.black] line-length = 100 target-version = ["py39"] + +[tool.bumpver] +current_version = "0.1.0" +version_pattern = "MAJOR.MINOR.PATCH" +commit_message = "Bump version {old_version} -> {new_version}" +commit = false +tag = false +push = false + +[tool.bumpver.file_patterns] +"pyproject.toml" = ['current_version = "{version}"', 'version = "{version}"'] +"src/neofs_testlib/__init__.py" = ["{version}"] diff --git a/requirements.txt b/requirements.txt index 5e623715..9b7968cc 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,6 +1,14 @@ allure-python-commons==2.9.45 -black==22.8.0 -isort==5.10.1 paramiko==2.10.3 pexpect==4.8.0 + +# Dev dependencies +black==22.8.0 +bumpver==2022.1118 +isort==5.10.1 pre-commit==2.20.0 + +# Packaging dependencies +build==0.8.0 +setuptools==63.2.0 +twine==4.0.1 diff --git a/src/neofs_testlib/__init__.py b/src/neofs_testlib/__init__.py new file mode 100644 index 00000000..3dc1f76b --- /dev/null +++ b/src/neofs_testlib/__init__.py @@ -0,0 +1 @@ +__version__ = "0.1.0"