From 70183c0ec066e77ee2d4d03ecfd97a69c2ff06e6 Mon Sep 17 00:00:00 2001 From: "v.kaukin" Date: Thu, 22 Dec 2022 09:43:27 +0500 Subject: [PATCH] 1.0.0 --- README.rst | 22 ++++++++++++++++------ _docs/build-requirements.txt | 4 ++++ _docs/packaging_notes.txt | 23 +++++++++++++++++++++++ _docs/release_notes.rst | 12 ++++++++++++ pdf417as_str/__init__.py | 2 +- pdf417as_str/main.py | 6 +++--- runtime.txt | 1 - setup.py | 17 +++++++++++------ test/test.py | 2 +- 9 files changed, 71 insertions(+), 18 deletions(-) create mode 100644 _docs/build-requirements.txt create mode 100644 _docs/packaging_notes.txt create mode 100644 _docs/release_notes.rst delete mode 100644 runtime.txt diff --git a/README.rst b/README.rst index 892fa40..7fe67c8 100644 --- a/README.rst +++ b/README.rst @@ -1,7 +1,9 @@ pdf417as_str ============ -Create pdf417 barcode without using images. +Create pdf417 barcode by special font without using images. + +.. image:: https://img.shields.io/pypi/dm/pdf417as_str.svg?style=social =================== =========================================== Python version 3.3+ @@ -18,16 +20,24 @@ How it works .. code-block:: python - pdf417_encoded_text = pdf417as_str.encode('https://github.com') + pdf417_encoded_text = pdf417as_str.encode417('https://github.com', columns=5) + +3. Paste encoded text into any text editor. + +:: + + +*xfs*prA*kuk*iDo*ixA*sxn*xdw*- + +*yog*slv*Arv*Fyg*tgE*fwg*zew*- + +*uny*BCj*iaw*jcE*AxD*ykx*pDw*- + +*ftw*sgf*AoC*dAc*ajb*ofA*yrx*- -3. Paste encoded text into any text editor and choose "Code PDF417" font. You will receive pdf417 barcode. +4. Choose "Code PDF417" font for text and adjust line spacing. You will receive pdf417 barcode. .. image:: https://github.com/ikvk/pdf417as_str/blob/master/test/barcode.png -NOTE: With some font sizes there will be empty space between rows. -It will not affect to reading barcode, but you can find suited size anyway. +NOTE: Small empty space between rows not affects to reading barcode. Anyway you can find suited size. -Actually you can make png barcode, using pdf417as_str.convert.to_png, but this function not efficient. +Also you can make .png barcode using pdf417as_str.convert.to_png, but this function for tests and not efficient. Installation ------------ diff --git a/_docs/build-requirements.txt b/_docs/build-requirements.txt new file mode 100644 index 0000000..c50c50a --- /dev/null +++ b/_docs/build-requirements.txt @@ -0,0 +1,4 @@ +pip +setuptools +twine +wheel diff --git a/_docs/packaging_notes.txt b/_docs/packaging_notes.txt new file mode 100644 index 0000000..6251143 --- /dev/null +++ b/_docs/packaging_notes.txt @@ -0,0 +1,23 @@ +Packaging +========= + +https://packaging.python.org/tutorials/packaging-projects/ + +* Иногда для применения некоторых настроек билда нужно удалить старые папки билдов + +1. Create .pypirc + C:\Users\v.kaukin\.pypirc + https://docs.python.org/3/distutils/packageindex.html#pypirc + +2. Install/update build libs: + C:\python\venv\pdf417as_str\Scripts\pip install --upgrade -r C:\kvk\develop\Python\pdf417as_str\_docs\build-requirements.txt + +3. Generating distribution archives + cd C:\kvk\develop\Python\pdf417as_str\ + C:\python\venv\pdf417as_str\Scripts\python.exe C:\kvk\develop\Python\pdf417as_str\setup.py sdist + +4. Check the distribution archives: + C:\python\venv\pdf417as_str\Scripts\python.exe -m twine check dist/* + +5. Uploading the distribution archives: + C:\python\venv\pdf417as_str\Scripts\python.exe -m twine upload dist/* diff --git a/_docs/release_notes.rst b/_docs/release_notes.rst new file mode 100644 index 0000000..a4dbdf2 --- /dev/null +++ b/_docs/release_notes.rst @@ -0,0 +1,12 @@ +1.0.0 +===== +* encode fn renamed to encode417 + +0.4.1 +===== +* License changed to LGPL-3.0 +* The license change is agreed with Bazin Jean-Marie. PDF417 font.ttf is re-created. + +0.2 +===== +* First stable version: 7 Oct 2017 diff --git a/pdf417as_str/__init__.py b/pdf417as_str/__init__.py index 308b634..667a870 100644 --- a/pdf417as_str/__init__.py +++ b/pdf417as_str/__init__.py @@ -1 +1 @@ -from .main import encode \ No newline at end of file +from .main import encode417 \ No newline at end of file diff --git a/pdf417as_str/main.py b/pdf417as_str/main.py index 908e2d4..4b46de7 100644 --- a/pdf417as_str/main.py +++ b/pdf417as_str/main.py @@ -1,7 +1,7 @@ import math -def encode(string, columns=-1, security=-1): +def encode417(string, columns=-1, security=-1): """ :param string: str, string to encode :param columns: int, number of data columns, (columns < 1 - auto) @@ -446,7 +446,7 @@ def modulo(): total = 0 for k in range(length): total += ( - ord(string[chain_index + j + k - 1: chain_index + j + k]) * 256 ** (length - 1 - k)) + ord(string[chain_index + j + k - 1: chain_index + j + k]) * 256 ** (length - 1 - k)) # at Visual Basic 6 was this strange code: # chain_mod = Format(total, "general number") # I don't know what's this mean... @@ -555,7 +555,7 @@ def modulo(): mc_correction[j] = (929 - (total * int(coef_rs[security][j * 3: j * 3 + 3])) % 929) % 929 else: mc_correction[j] = (mc_correction[j - 1] + 929 - ( - total * int(coef_rs[security][j * 3:j * 3 + 3])) % 929) % 929 + total * int(coef_rs[security][j * 3:j * 3 + 3])) % 929) % 929 for j in range(k): if mc_correction[j] != 0: mc_correction[j] = 929 - mc_correction[j] diff --git a/runtime.txt b/runtime.txt deleted file mode 100644 index 724a1a9..0000000 --- a/runtime.txt +++ /dev/null @@ -1 +0,0 @@ -python>=3.3 \ No newline at end of file diff --git a/setup.py b/setup.py index e6e6f58..cec02af 100644 --- a/setup.py +++ b/setup.py @@ -1,13 +1,18 @@ from distutils.core import setup +with open("README.rst", "r", encoding='utf-8') as fh: + long_description = fh.read() + setup( - name='pdf417as_str', - version='0.4.1', + name='pdf417as-str', + version='1.0.0', packages=['pdf417as_str'], url='https://github.com/ikvk/pdf417as_str', license='LGPLv3', - long_description=open("README.rst").read(), - author='v.kaukin', - author_email='workkvk@gmail.com', - description='Create pdf417 barcode without using images.', + long_description=long_description, + long_description_content_type="text/x-rst", + author='Vladimir Kaukin', + author_email='KaukinVK@ya.ru', + keywords=['pdf417', 'font', 'barcode', 'generate', 'noimage', 'python'], + description='Create pdf417 barcode by special font without using images', ) diff --git a/test/test.py b/test/test.py index 88508fc..8b8eb40 100644 --- a/test/test.py +++ b/test/test.py @@ -39,7 +39,7 @@ for test_i, test_value in enumerate(test_data): test_text = test_value[0] # make text code - code = main.encode(test_value[0], test_value[1]) + code = main.encode417(test_value[0], test_value[1]) # make png img_name = 'barcode' + str(test_i) image = convert.to_png(code)