diff --git a/CHANGELOG.md b/CHANGELOG.md index d333f35..65af676 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ +# pyvarint 0.0.1a3 (UNRELEASED) + +# pyvarint 0.0.1a2 (2020-07-07 + +- Migrate pyproject configuration + # pyvarint 0.0.1a1 (2020-06-30) -## Project Announcements - - The first alpha development release is made! diff --git a/MANIFEST.in b/MANIFEST.in deleted file mode 100644 index ae15510..0000000 --- a/MANIFEST.in +++ /dev/null @@ -1 +0,0 @@ -include LICENSE README.md CHANGELOG.md diff --git a/README.md b/README.md index e024ee5..f9a0b3c 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,22 @@ ## Varints, a method of serializing integers using one or more bytes +## Install + ```sh $ pip install pyvarint ``` + +## Example + +```python +from random import sample +from pyvarint import decode, encode + +ten_rand_ints = sample(range(100), 10) + +for rand_int in ten_rand_ints: + encoded = encode(rand_int) + decoded = decode(encoded) + assert decoded == rand_int +``` diff --git a/mypy.ini b/mypy.ini deleted file mode 100644 index ab4ef1a..0000000 --- a/mypy.ini +++ /dev/null @@ -1,4 +0,0 @@ -[mypy] -python_version = 3.8 -platform = linux -ignore_missing_imports = True diff --git a/pyproject.toml b/pyproject.toml index 50cb059..3c43566 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,11 +1,75 @@ [build-system] -requires = [ - "setuptools", - "setuptools-scm", - "wheel", -] -build-backend = "setuptools.build_meta" +requires = ["poetry>=1.0.9,<2.0"] +build-backend = "poetry.masonry.api" + +[tool.poetry] +name = "pyvarint" +version = "0.0.1a2" +description = "Varints, a method of serializing integers using one or more bytes " +authors = ["decentral1se "] +maintainers = ["decentral1se "] +license = "GPLv3" +readme = "README.md" +repository = "https://github.com/hyperpy/pyvarint" +keywords = ["hypercore", "hypercore-protocol"] + +[tool.poetry.dependencies] +python = "^3.6" + +[tool.poetry.dev-dependencies] +black = "^19.10b0" +flake8 = "^3.8.3" +isort = "^5.0.2" [tool.black] line-length = 80 target-version = ["py38"] +include = '\.pyi?$' + +[tool.isort] +include_trailing_comma = true +known_first_party = "pyvarint" +known_third_party = "pytest" +line_length = 80 +multi_line_output = 3 +skip = ".venv,.tox" + +[tool.tox] +legacy_tox_ini = """ +[tox] +envlist = + {py36,py37,py38} + lint + sort + format + type +skip_missing_interpreters = True +isolated_build = True + +[testenv] +deps = + pytest + pytest-cov + pytest-mock +commands = pytest test/ --cov={toxinidir}/pyvarint/ --no-cov-on-fail {posargs} + +[testenv:lint] +skipdist = True +deps = flake8 +commands = flake8 {posargs:--max-line-length 80} pyvarint/ test/ + +[testenv:sort] +skipdist = True +deps = isort +commands = isort {posargs:-c} pyvarint/ test/ + +[testenv:format] +skipdist = True +deps = black +commands = black {posargs:--check} pyvarint/ test/ + +[testenv:type] +skipdist = True +deps = mypy +commands = mypy {posargs:--ignore-missing-imports} pyvarint/ test/ +""" diff --git a/pyvarint/__init__.py b/pyvarint/__init__.py index ce42d89..907037f 100644 --- a/pyvarint/__init__.py +++ b/pyvarint/__init__.py @@ -3,14 +3,3 @@ from pyvarint.varint import decode, encode, encoding_length # noqa __all__ = ["encode", "decode", "encoding_length"] - -try: - import pkg_resources -except ImportError: - pass - - -try: - __version__ = pkg_resources.get_distribution("pyvarint").version -except Exception: - __version__ = "unknown" diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index a9fcc3d..0000000 --- a/setup.cfg +++ /dev/null @@ -1,46 +0,0 @@ -[tool:pytest] -testpaths = test - -[flake8] -max-line-length = 80 - -[isort] -known_first_party = pyvarint -known_third_party = pytest -line_length = 80 -multi_line_output = 3 -skip = .venv, .tox -include_trailing_comma = True - -[metadata] -name = pyvarint -author = decentral1se -author_email = hi@decentral1.se -maintainer = decentral1se -maintainer_email = hi@decentral1.se -url = https://git.autonomic.zone/hyperpy/pyvarint -project_urls = - Source Code = https://git.autonomic.zone/hyperpy/pyvarint -description = Varints, a method of serializing integers using one or more bytes -long_description = file: README.md -license = GPLv3 -license_file = LICENSE -classifiers = - Programming Language :: Python :: 3 - Programming Language :: Python :: 3.6 - Programming Language :: Python :: 3.7 - Programming Language :: Python :: 3.8 - -[options] -use_scm_version = True -python_requires = >=3.6 -setup_requires = - setuptools_scm - setuptools_scm_git_archive -package_dir = - = . -packages = find: -zip_safe = False - -[options.packages.find] -where = . diff --git a/setup.py b/setup.py deleted file mode 100644 index d5d43d7..0000000 --- a/setup.py +++ /dev/null @@ -1,3 +0,0 @@ -from setuptools import setup - -setup(use_scm_version=True) diff --git a/test/test_version.py b/test/test_version.py deleted file mode 100644 index 62886fa..0000000 --- a/test/test_version.py +++ /dev/null @@ -1,10 +0,0 @@ -"""Version test module.""" - - -def test_version_fails_gracefully(mocker): - target = "pkg_resources.get_distribution" - mocker.patch(target, side_effect=Exception()) - - from pyvarint.__init__ import __version__ - - assert __version__ == "unknown" diff --git a/tox.ini b/tox.ini deleted file mode 100644 index c8abb33..0000000 --- a/tox.ini +++ /dev/null @@ -1,48 +0,0 @@ -[tox] -envlist = - {py36,py37,py38} - lint - sort - format - type -skip_missing_interpreters = True -isolated_build = True - -[testenv] -deps = - pytest - pytest-cov - pytest-mock -commands = pytest test/ --cov={toxinidir}/pyvarint/ --no-cov-on-fail {posargs} - -[testenv:lint] -skipdist = True -deps = flake8 -commands = flake8 {posargs} pyvarint/ test/ - -[testenv:sort] -skipdist = True -deps = isort -commands = isort {posargs:-rc -c} -sp setup.cfg pyvarint/ test/ - -[testenv:format] -skipdist = True -basepython = python3.8 -deps = black -commands = black {posargs:--check} pyvarint/ test/ - -[testenv:type] -basepython = python3.8 -skipdist = True -deps = mypy -commands = mypy pyvarint/ test/ - -[testenv:release] -deps = twine -commands = - rm -rf {toxworkdir}/dist - python -m setup sdist --dist-dir {toxworkdir}/dist bdist_wheel - python -m setup sdist --dist-dir {toxworkdir}/dist bdist_egg - twine upload {toxworkdir}/dist/* -whitelist_externals = - rm