From 0ce3ece77e9bcc57eb78bee1902696b0f3e7eaed Mon Sep 17 00:00:00 2001 From: alexferl Date: Thu, 5 Oct 2023 19:00:18 -0400 Subject: [PATCH 1/2] add Pipfile Signed-off-by: alexferl --- .github/workflows/test.yaml | 30 +++++ .pre-commit-config.yaml | 28 +++-- .travis.yml | 19 --- Makefile | 43 ++----- Pipfile | 9 ++ Pipfile.lock | 233 ++++++++++++++++++++++++++++++++++++ README.md | 4 +- VERSION | 1 + dev_requirements.txt | 3 - pyproject.toml | 3 + requirements-dev.txt | 19 +++ requirements.txt | 1 + setup.cfg | 28 ++++- 13 files changed, 354 insertions(+), 67 deletions(-) create mode 100644 .github/workflows/test.yaml delete mode 100644 .travis.yml create mode 100644 Pipfile create mode 100644 Pipfile.lock create mode 100644 VERSION delete mode 100644 dev_requirements.txt create mode 100644 pyproject.toml create mode 100644 requirements-dev.txt create mode 100644 requirements.txt diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml new file mode 100644 index 0000000..1e81815 --- /dev/null +++ b/.github/workflows/test.yaml @@ -0,0 +1,30 @@ +name: Test +on: + push: + branches: + - master + pull_request: + branches: + - master +jobs: + build: + runs-on: '${{ matrix.os }}' + strategy: + matrix: + os: + - ubuntu-latest + python-version: + - '3.8' + - '3.9' + - '3.10' + - '3.11' + steps: + - name: 'Set up Python ${{ matrix.python-version }}' + uses: actions/setup-python@v2 + with: + python-version: '${{ matrix.python-version }}' + - uses: actions/checkout@v2 + - run: pip install pytest-cov codecov + - run: pip install -r requirements-dev.txt + - run: pytest --cov=./vyper + - run: codecov diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index bfc220a..f22cd0e 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,9 +1,21 @@ repos: -- repo: local - hooks: - - id: black - name: black - stages: [commit] - language: system - entry: venv/bin/black -t py37 --exclude venv . - types: [python] + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.4.0 + hooks: + - id: trailing-whitespace + - id: end-of-file-fixer + - id: mixed-line-ending + args: ['--fix=lf'] + description: Forces to replace line ending by the UNIX 'lf' character. + - repo: https://github.com/psf/black + rev: 23.9.1 + hooks: + - id: black + language_version: python3 + - repo: https://github.com/d-ryzhykau/pipenv-lock-pre-commit + rev: 0.5.0 + hooks: + - id: pipenv-lock + - id: pipenv-verify + - id: pipenv-requirements + - id: pipenv-requirements-dev diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 4924d20..0000000 --- a/.travis.yml +++ /dev/null @@ -1,19 +0,0 @@ -language: python -sudo: required -dist: bionic -python: - - "3.7" - - "3.8" - - "3.9" -cache: pip -before_install: - - python --version - - pip install -U pip - - pip install -U pytest - - pip install -U pytest-cov - - pip install -U codecov -install: - - pip install -r dev_requirements.txt -script: pytest --cov=./xid -after_success: - - codecov diff --git a/Makefile b/Makefile index 9b919a3..291af74 100644 --- a/Makefile +++ b/Makefile @@ -1,41 +1,24 @@ -.PHONY: help dev clean update test lint - -VENV_NAME?=venv -VENV_ACTIVATE=. $(VENV_NAME)/bin/activate -PYTHON=${VENV_NAME}/bin/python3 +.PHONY: help dev test lint pre-commit .DEFAULT: help help: @echo "make dev" - @echo " prepare development environment, use only once" - @echo "make clean" - @echo " delete development environment" - @echo "make update" - @echo " update dependencies" + @echo " prepare development environment" @echo "make test" - @echo " run tests" + @echo " run tests" @echo "make lint" - @echo " run black" + @echo " run black" + @echo "make pre-commit" + @echo " run pre-commit hooks" dev: - make venv - -venv: $(VENV_NAME)/bin/activate -$(VENV_NAME)/bin/activate: - test -d $(VENV_NAME) || virtualenv -p python3 $(VENV_NAME) - ${PYTHON} -m pip install -U pip - ${PYTHON} -m pip install -r dev_requirements.txt - $(VENV_NAME)/bin/pre-commit install - touch $(VENV_NAME)/bin/activate - -clean: - rm -rf venv + pipenv install --dev -update: - ${PYTHON} -m pip install -r dev_requirements.txt +test: + pipenv run pytest -test: venv - ${PYTHON} -m pytest +lint: + pipenv run black . -lint: venv - $(VENV_NAME)/bin/black -t py37 --exclude $(VENV_NAME) . +pre-commit: + pipenv run pre-commit diff --git a/Pipfile b/Pipfile new file mode 100644 index 0000000..39095d0 --- /dev/null +++ b/Pipfile @@ -0,0 +1,9 @@ +[[source]] +url = "https://pypi.org/simple" +verify_ssl = true +name = "pypi" + +[dev-packages] +black = "==23.9.1" +pre-commit = "==3.4.0" +pytest = "==7.4.2" diff --git a/Pipfile.lock b/Pipfile.lock new file mode 100644 index 0000000..8c11411 --- /dev/null +++ b/Pipfile.lock @@ -0,0 +1,233 @@ +{ + "_meta": { + "hash": { + "sha256": "68a00fb3357fefedc09a51a02c52c3f14e126979d7fcf7da686f1605f4473a6a" + }, + "pipfile-spec": 6, + "requires": {}, + "sources": [ + { + "name": "pypi", + "url": "https://pypi.org/simple", + "verify_ssl": true + } + ] + }, + "default": {}, + "develop": { + "black": { + "hashes": [ + "sha256:031e8c69f3d3b09e1aa471a926a1eeb0b9071f80b17689a655f7885ac9325a6f", + "sha256:13a2e4a93bb8ca74a749b6974925c27219bb3df4d42fc45e948a5d9feb5122b7", + "sha256:13ef033794029b85dfea8032c9d3b92b42b526f1ff4bf13b2182ce4e917f5100", + "sha256:14f04c990259576acd093871e7e9b14918eb28f1866f91968ff5524293f9c573", + "sha256:24b6b3ff5c6d9ea08a8888f6977eae858e1f340d7260cf56d70a49823236b62d", + "sha256:403397c033adbc45c2bd41747da1f7fc7eaa44efbee256b53842470d4ac5a70f", + "sha256:50254ebfa56aa46a9fdd5d651f9637485068a1adf42270148cd101cdf56e0ad9", + "sha256:538efb451cd50f43aba394e9ec7ad55a37598faae3348d723b59ea8e91616300", + "sha256:638619a559280de0c2aa4d76f504891c9860bb8fa214267358f0a20f27c12948", + "sha256:6a3b50e4b93f43b34a9d3ef00d9b6728b4a722c997c99ab09102fd5efdb88325", + "sha256:6ccd59584cc834b6d127628713e4b6b968e5f79572da66284532525a042549f9", + "sha256:75a2dc41b183d4872d3a500d2b9c9016e67ed95738a3624f4751a0cb4818fe71", + "sha256:7d30ec46de88091e4316b17ae58bbbfc12b2de05e069030f6b747dfc649ad186", + "sha256:8431445bf62d2a914b541da7ab3e2b4f3bc052d2ccbf157ebad18ea126efb91f", + "sha256:8fc1ddcf83f996247505db6b715294eba56ea9372e107fd54963c7553f2b6dfe", + "sha256:a732b82747235e0542c03bf352c126052c0fbc458d8a239a94701175b17d4855", + "sha256:adc3e4442eef57f99b5590b245a328aad19c99552e0bdc7f0b04db6656debd80", + "sha256:c46767e8df1b7beefb0899c4a95fb43058fa8500b6db144f4ff3ca38eb2f6393", + "sha256:c619f063c2d68f19b2d7270f4cf3192cb81c9ec5bc5ba02df91471d0b88c4c5c", + "sha256:cf3a4d00e4cdb6734b64bf23cd4341421e8953615cba6b3670453737a72ec204", + "sha256:cf99f3de8b3273a8317681d8194ea222f10e0133a24a7548c73ce44ea1679377", + "sha256:d6bc09188020c9ac2555a498949401ab35bb6bf76d4e0f8ee251694664df6301" + ], + "index": "pypi", + "markers": "python_version >= '3.8'", + "version": "==23.9.1" + }, + "cfgv": { + "hashes": [ + "sha256:b7265b1f29fd3316bfcd2b330d63d024f2bfd8bcb8b0272f8e19a504856c48f9", + "sha256:e52591d4c5f5dead8e0f673fb16db7949d2cfb3f7da4582893288f0ded8fe560" + ], + "markers": "python_version >= '3.8'", + "version": "==3.4.0" + }, + "click": { + "hashes": [ + "sha256:ae74fb96c20a0277a1d615f1e4d73c8414f5a98db8b799a7931d1582f3390c28", + "sha256:ca9853ad459e787e2192211578cc907e7594e294c7ccc834310722b41b9ca6de" + ], + "markers": "python_version >= '3.7'", + "version": "==8.1.7" + }, + "distlib": { + "hashes": [ + "sha256:2e24928bc811348f0feb63014e97aaae3037f2cf48712d51ae61df7fd6075057", + "sha256:9dafe54b34a028eafd95039d5e5d4851a13734540f1331060d31c9916e7147a8" + ], + "version": "==0.3.7" + }, + "filelock": { + "hashes": [ + "sha256:08c21d87ded6e2b9da6728c3dff51baf1dcecf973b768ef35bcbc3447edb9ad4", + "sha256:2e6f249f1f3654291606e046b09f1fd5eac39b360664c27f5aad072012f8bcbd" + ], + "markers": "python_version >= '3.8'", + "version": "==3.12.4" + }, + "identify": { + "hashes": [ + "sha256:afe67f26ae29bab007ec21b03d4114f41316ab9dd15aa8736a167481e108da54", + "sha256:f302a4256a15c849b91cfcdcec052a8ce914634b2f77ae87dad29cd749f2d88d" + ], + "markers": "python_version >= '3.8'", + "version": "==2.5.30" + }, + "iniconfig": { + "hashes": [ + "sha256:2d91e135bf72d31a410b17c16da610a82cb55f6b0477d1a902134b24a455b8b3", + "sha256:b6a85871a79d2e3b22d2d1b94ac2824226a63c6b741c88f7ae975f18b6778374" + ], + "markers": "python_version >= '3.7'", + "version": "==2.0.0" + }, + "mypy-extensions": { + "hashes": [ + "sha256:4392f6c0eb8a5668a69e23d168ffa70f0be9ccfd32b5cc2d26a34ae5b844552d", + "sha256:75dbf8955dc00442a438fc4d0666508a9a97b6bd41aa2f0ffe9d2f2725af0782" + ], + "markers": "python_version >= '3.5'", + "version": "==1.0.0" + }, + "nodeenv": { + "hashes": [ + "sha256:d51e0c37e64fbf47d017feac3145cdbb58836d7eee8c6f6d3b6880c5456227d2", + "sha256:df865724bb3c3adc86b3876fa209771517b0cfe596beff01a92700e0e8be4cec" + ], + "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4, 3.5, 3.6'", + "version": "==1.8.0" + }, + "packaging": { + "hashes": [ + "sha256:048fb0e9405036518eaaf48a55953c750c11e1a1b68e0dd1a9d62ed0c092cfc5", + "sha256:8c491190033a9af7e1d931d0b5dacc2ef47509b34dd0de67ed209b5203fc88c7" + ], + "markers": "python_version >= '3.7'", + "version": "==23.2" + }, + "pathspec": { + "hashes": [ + "sha256:1d6ed233af05e679efb96b1851550ea95bbb64b7c490b0f5aa52996c11e92a20", + "sha256:e0d8d0ac2f12da61956eb2306b69f9469b42f4deb0f3cb6ed47b9cce9996ced3" + ], + "markers": "python_version >= '3.7'", + "version": "==0.11.2" + }, + "platformdirs": { + "hashes": [ + "sha256:cf8ee52a3afdb965072dcc652433e0c7e3e40cf5ea1477cd4b3b1d2eb75495b3", + "sha256:e9d171d00af68be50e9202731309c4e658fd8bc76f55c11c7dd760d023bda68e" + ], + "markers": "python_version >= '3.7'", + "version": "==3.11.0" + }, + "pluggy": { + "hashes": [ + "sha256:cf61ae8f126ac6f7c451172cf30e3e43d3ca77615509771b3a984a0730651e12", + "sha256:d89c696a773f8bd377d18e5ecda92b7a3793cbe66c87060a6fb58c7b6e1061f7" + ], + "markers": "python_version >= '3.8'", + "version": "==1.3.0" + }, + "pre-commit": { + "hashes": [ + "sha256:6bbd5129a64cad4c0dfaeeb12cd8f7ea7e15b77028d985341478c8af3c759522", + "sha256:96d529a951f8b677f730a7212442027e8ba53f9b04d217c4c67dc56c393ad945" + ], + "index": "pypi", + "markers": "python_version >= '3.8'", + "version": "==3.4.0" + }, + "pytest": { + "hashes": [ + "sha256:1d881c6124e08ff0a1bb75ba3ec0bfd8b5354a01c194ddd5a0a870a48d99b002", + "sha256:a766259cfab564a2ad52cb1aae1b881a75c3eb7e34ca3779697c23ed47c47069" + ], + "index": "pypi", + "markers": "python_version >= '3.7'", + "version": "==7.4.2" + }, + "pyyaml": { + "hashes": [ + "sha256:04ac92ad1925b2cff1db0cfebffb6ffc43457495c9b3c39d3fcae417d7125dc5", + "sha256:062582fca9fabdd2c8b54a3ef1c978d786e0f6b3a1510e0ac93ef59e0ddae2bc", + "sha256:0d3304d8c0adc42be59c5f8a4d9e3d7379e6955ad754aa9d6ab7a398b59dd1df", + "sha256:1635fd110e8d85d55237ab316b5b011de701ea0f29d07611174a1b42f1444741", + "sha256:184c5108a2aca3c5b3d3bf9395d50893a7ab82a38004c8f61c258d4428e80206", + "sha256:18aeb1bf9a78867dc38b259769503436b7c72f7a1f1f4c93ff9a17de54319b27", + "sha256:1d4c7e777c441b20e32f52bd377e0c409713e8bb1386e1099c2415f26e479595", + "sha256:1e2722cc9fbb45d9b87631ac70924c11d3a401b2d7f410cc0e3bbf249f2dca62", + "sha256:1fe35611261b29bd1de0070f0b2f47cb6ff71fa6595c077e42bd0c419fa27b98", + "sha256:28c119d996beec18c05208a8bd78cbe4007878c6dd15091efb73a30e90539696", + "sha256:326c013efe8048858a6d312ddd31d56e468118ad4cdeda36c719bf5bb6192290", + "sha256:40df9b996c2b73138957fe23a16a4f0ba614f4c0efce1e9406a184b6d07fa3a9", + "sha256:42f8152b8dbc4fe7d96729ec2b99c7097d656dc1213a3229ca5383f973a5ed6d", + "sha256:49a183be227561de579b4a36efbb21b3eab9651dd81b1858589f796549873dd6", + "sha256:4fb147e7a67ef577a588a0e2c17b6db51dda102c71de36f8549b6816a96e1867", + "sha256:50550eb667afee136e9a77d6dc71ae76a44df8b3e51e41b77f6de2932bfe0f47", + "sha256:510c9deebc5c0225e8c96813043e62b680ba2f9c50a08d3724c7f28a747d1486", + "sha256:5773183b6446b2c99bb77e77595dd486303b4faab2b086e7b17bc6bef28865f6", + "sha256:596106435fa6ad000c2991a98fa58eeb8656ef2325d7e158344fb33864ed87e3", + "sha256:6965a7bc3cf88e5a1c3bd2e0b5c22f8d677dc88a455344035f03399034eb3007", + "sha256:69b023b2b4daa7548bcfbd4aa3da05b3a74b772db9e23b982788168117739938", + "sha256:6c22bec3fbe2524cde73d7ada88f6566758a8f7227bfbf93a408a9d86bcc12a0", + "sha256:704219a11b772aea0d8ecd7058d0082713c3562b4e271b849ad7dc4a5c90c13c", + "sha256:7e07cbde391ba96ab58e532ff4803f79c4129397514e1413a7dc761ccd755735", + "sha256:81e0b275a9ecc9c0c0c07b4b90ba548307583c125f54d5b6946cfee6360c733d", + "sha256:855fb52b0dc35af121542a76b9a84f8d1cd886ea97c84703eaa6d88e37a2ad28", + "sha256:8d4e9c88387b0f5c7d5f281e55304de64cf7f9c0021a3525bd3b1c542da3b0e4", + "sha256:9046c58c4395dff28dd494285c82ba00b546adfc7ef001486fbf0324bc174fba", + "sha256:9eb6caa9a297fc2c2fb8862bc5370d0303ddba53ba97e71f08023b6cd73d16a8", + "sha256:a0cd17c15d3bb3fa06978b4e8958dcdc6e0174ccea823003a106c7d4d7899ac5", + "sha256:afd7e57eddb1a54f0f1a974bc4391af8bcce0b444685d936840f125cf046d5bd", + "sha256:b1275ad35a5d18c62a7220633c913e1b42d44b46ee12554e5fd39c70a243d6a3", + "sha256:b786eecbdf8499b9ca1d697215862083bd6d2a99965554781d0d8d1ad31e13a0", + "sha256:ba336e390cd8e4d1739f42dfe9bb83a3cc2e80f567d8805e11b46f4a943f5515", + "sha256:baa90d3f661d43131ca170712d903e6295d1f7a0f595074f151c0aed377c9b9c", + "sha256:bc1bf2925a1ecd43da378f4db9e4f799775d6367bdb94671027b73b393a7c42c", + "sha256:bd4af7373a854424dabd882decdc5579653d7868b8fb26dc7d0e99f823aa5924", + "sha256:bf07ee2fef7014951eeb99f56f39c9bb4af143d8aa3c21b1677805985307da34", + "sha256:bfdf460b1736c775f2ba9f6a92bca30bc2095067b8a9d77876d1fad6cc3b4a43", + "sha256:c8098ddcc2a85b61647b2590f825f3db38891662cfc2fc776415143f599bb859", + "sha256:d2b04aac4d386b172d5b9692e2d2da8de7bfb6c387fa4f801fbf6fb2e6ba4673", + "sha256:d483d2cdf104e7c9fa60c544d92981f12ad66a457afae824d146093b8c294c54", + "sha256:d858aa552c999bc8a8d57426ed01e40bef403cd8ccdd0fc5f6f04a00414cac2a", + "sha256:e7d73685e87afe9f3b36c799222440d6cf362062f78be1013661b00c5c6f678b", + "sha256:f003ed9ad21d6a4713f0a9b5a7a0a79e08dd0f221aff4525a2be4c346ee60aab", + "sha256:f22ac1c3cac4dbc50079e965eba2c1058622631e526bd9afd45fedd49ba781fa", + "sha256:faca3bdcf85b2fc05d06ff3fbc1f83e1391b3e724afa3feba7d13eeab355484c", + "sha256:fca0e3a251908a499833aa292323f32437106001d436eca0e6e7833256674585", + "sha256:fd1592b3fdf65fff2ad0004b5e363300ef59ced41c2e6b3a99d4089fa8c5435d", + "sha256:fd66fc5d0da6d9815ba2cebeb4205f95818ff4b79c3ebe268e75d961704af52f" + ], + "markers": "python_version >= '3.6'", + "version": "==6.0.1" + }, + "setuptools": { + "hashes": [ + "sha256:4ac1475276d2f1c48684874089fefcd83bd7162ddaafb81fac866ba0db282a87", + "sha256:b454a35605876da60632df1a60f736524eb73cc47bbc9f3f1ef1b644de74fd2a" + ], + "markers": "python_version >= '3.8'", + "version": "==68.2.2" + }, + "virtualenv": { + "hashes": [ + "sha256:b80039f280f4919c77b30f1c23294ae357c4c8701042086e3fc005963e4e537b", + "sha256:e8361967f6da6fbdf1426483bfe9fca8287c242ac0bc30429905721cefbff752" + ], + "markers": "python_version >= '3.7'", + "version": "==20.24.5" + } + } +} diff --git a/README.md b/README.md index 0f33ce2..6253dbd 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ -# xid [![Build Status](https://travis-ci.com/alexferl/xid.svg?branch=master)](https://travis-ci.com/alexferl/xid) [![codecov](https://codecov.io/gh/alexferl/xid/branch/master/graph/badge.svg)](https://codecov.io/gh/alexferl/xid) +# xid [![codecov](https://codecov.io/gh/alexferl/xid/branch/master/graph/badge.svg)](https://codecov.io/gh/alexferl/xid) -A Python 3.7+ port of [https://github.com/rs/xid](https://github.com/rs/xid). +A Python 3.8+ port of [https://github.com/rs/xid](https://github.com/rs/xid). # Install diff --git a/VERSION b/VERSION new file mode 100644 index 0000000..0d91a54 --- /dev/null +++ b/VERSION @@ -0,0 +1 @@ +0.3.0 diff --git a/dev_requirements.txt b/dev_requirements.txt deleted file mode 100644 index c1cd754..0000000 --- a/dev_requirements.txt +++ /dev/null @@ -1,3 +0,0 @@ -black==19.10b0 -pre-commit==2.6.0 -pytest==6.0.1 diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..fed528d --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["setuptools"] +build-backend = "setuptools.build_meta" diff --git a/requirements-dev.txt b/requirements-dev.txt new file mode 100644 index 0000000..aac7620 --- /dev/null +++ b/requirements-dev.txt @@ -0,0 +1,19 @@ +-i https://pypi.org/simple +black==23.9.1; python_version >= '3.8' +cfgv==3.4.0; python_version >= '3.8' +click==8.1.7; python_version >= '3.7' +distlib==0.3.7 +filelock==3.12.4; python_version >= '3.8' +identify==2.5.30; python_version >= '3.8' +iniconfig==2.0.0; python_version >= '3.7' +mypy-extensions==1.0.0; python_version >= '3.5' +nodeenv==1.8.0; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4, 3.5, 3.6' +packaging==23.2; python_version >= '3.7' +pathspec==0.11.2; python_version >= '3.7' +platformdirs==3.11.0; python_version >= '3.7' +pluggy==1.3.0; python_version >= '3.8' +pre-commit==3.4.0; python_version >= '3.8' +pytest==7.4.2; python_version >= '3.7' +pyyaml==6.0.1; python_version >= '3.6' +setuptools==68.2.2; python_version >= '3.8' +virtualenv==20.24.5; python_version >= '3.7' diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..e4f81fa --- /dev/null +++ b/requirements.txt @@ -0,0 +1 @@ +-i https://pypi.org/simple diff --git a/setup.cfg b/setup.cfg index 2e5bec5..8381cab 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,24 @@ -[tool:pytest] -testpaths=tests +[metadata] +name = py-xid +version = file: VERSION +author = Alexandre Ferland +author_email = me@alexferl.com +url = https://github.com/alexferl/xid +description = A globally unique id generator +long_description = file: README.md +long_description_content_type = text/markdown +license = MIT +classifiers = + Intended Audience :: Developers + License :: OSI Approved :: MIT License + Operating System :: OS Independent + Programming Language :: Python :: 3.8 + Programming Language :: Python :: 3.9 + Programming Language :: Python :: 3.10 + Programming Language :: Python :: 3.11 + Topic :: Software Development :: Libraries :: Python Modules -[pep8] -ignore=E128,E226,E302 -max-line-length = 120 +[options] +zip_safe = False +include_package_data = True +python_requires = >=3.8 From 5cd2dd5b745af392c07c504fef00db1dae91b664 Mon Sep 17 00:00:00 2001 From: alexferl Date: Thu, 5 Oct 2023 19:26:37 -0400 Subject: [PATCH 2/2] fix bug Signed-off-by: alexferl --- VERSION | 2 +- setup.cfg | 2 +- setup.py | 25 ------------------------- tests/test_xid.py | 8 ++++++++ xid/xid.py | 2 +- 5 files changed, 11 insertions(+), 28 deletions(-) delete mode 100644 setup.py diff --git a/VERSION b/VERSION index 0d91a54..3eefcb9 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.3.0 +1.0.0 diff --git a/setup.cfg b/setup.cfg index 8381cab..d2941b0 100644 --- a/setup.cfg +++ b/setup.cfg @@ -4,7 +4,7 @@ version = file: VERSION author = Alexandre Ferland author_email = me@alexferl.com url = https://github.com/alexferl/xid -description = A globally unique id generator +description = Globally unique identifier generator library long_description = file: README.md long_description_content_type = text/markdown license = MIT diff --git a/setup.py b/setup.py deleted file mode 100644 index 3d285c3..0000000 --- a/setup.py +++ /dev/null @@ -1,25 +0,0 @@ -from setuptools import setup - -setup( - name="py-xid", - version="0.3.0", - description="", - url="http://github.com/alexferl/xid", - author="Alexandre Ferland", - author_email="aferlandqc@gmail.com", - license="MIT", - packages=["xid"], - zip_safe=False, - install_requires=[], - setup_requires=["pytest-runner>=5.2"], - tests_require=["pytest>=6.0.1"], - platforms="any", - classifiers=[ - "Intended Audience :: Developers", - "License :: OSI Approved :: MIT License", - "Operating System :: OS Independent", - "Programming Language :: Python :: 3.7", - "Programming Language :: Python :: 3.8", - "Topic :: Software Development :: Libraries :: Python Modules", - ], -) diff --git a/tests/test_xid.py b/tests/test_xid.py index 4244349..513f525 100644 --- a/tests/test_xid.py +++ b/tests/test_xid.py @@ -129,3 +129,11 @@ def test_compare(): assert xid1 <= xid2 assert xid2 > xid1 assert xid2 >= xid1 + + +def test_len_from_str(): + xid1 = XID() + xid2 = xid1.bytes() + xid2_from_str = XID(xid1.string()).bytes() + + assert len(xid2) == len(xid2_from_str) diff --git a/xid/xid.py b/xid/xid.py index 46ee60b..9123bdb 100644 --- a/xid/xid.py +++ b/xid/xid.py @@ -140,7 +140,7 @@ def _decode(xid: XID, src: bytes, dec=None) -> XID: else: dec = DECODING_MAP - id_ = bytearray(ENCODED_LEN) + id_ = bytearray(RAW_LEN) if len(src) != ENCODED_LEN: raise InvalidXID()