Migrate to pyproject config
All checks were successful
continuous-integration/drone/tag Build is passing

This commit is contained in:
Luke Murphy 2020-07-07 15:59:42 +02:00
parent ae4a4761c5
commit aaa760ff99
No known key found for this signature in database
GPG Key ID: 5E2EF5A63E3718CC
10 changed files with 92 additions and 131 deletions

View File

@ -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) # pyvarint 0.0.1a1 (2020-06-30)
## Project Announcements
- The first alpha development release is made! - The first alpha development release is made!

View File

@ -1 +0,0 @@
include LICENSE README.md CHANGELOG.md

View File

@ -4,6 +4,22 @@
## Varints, a method of serializing integers using one or more bytes ## Varints, a method of serializing integers using one or more bytes
## Install
```sh ```sh
$ pip install pyvarint $ 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
```

View File

@ -1,4 +0,0 @@
[mypy]
python_version = 3.8
platform = linux
ignore_missing_imports = True

View File

@ -1,11 +1,75 @@
[build-system] [build-system]
requires = [ requires = ["poetry>=1.0.9,<2.0"]
"setuptools", build-backend = "poetry.masonry.api"
"setuptools-scm",
"wheel", [tool.poetry]
] name = "pyvarint"
build-backend = "setuptools.build_meta" version = "0.0.1a2"
description = "Varints, a method of serializing integers using one or more bytes "
authors = ["decentral1se <hi@decentral1.se>"]
maintainers = ["decentral1se <hi@decentral1.se>"]
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] [tool.black]
line-length = 80 line-length = 80
target-version = ["py38"] 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/
"""

View File

@ -3,14 +3,3 @@
from pyvarint.varint import decode, encode, encoding_length # noqa from pyvarint.varint import decode, encode, encoding_length # noqa
__all__ = ["encode", "decode", "encoding_length"] __all__ = ["encode", "decode", "encoding_length"]
try:
import pkg_resources
except ImportError:
pass
try:
__version__ = pkg_resources.get_distribution("pyvarint").version
except Exception:
__version__ = "unknown"

View File

@ -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 = .

View File

@ -1,3 +0,0 @@
from setuptools import setup
setup(use_scm_version=True)

View File

@ -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"

48
tox.ini
View File

@ -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