diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index fcc8a9a..86dd693 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -12,7 +12,7 @@ jobs: - name: Install autopep8 run: pip install --user autopep8 - name: Run autopep8 - run: autopep8 -d -r parsley/ --exit-code + run: autopep8 -d -r src/parsley/ --exit-code run_flake8: name: Run flake8 @@ -32,4 +32,4 @@ jobs: - name: Install basedpyright run: pip install --user basedpyright - name: Run basedpyright - run: basedpyright parsley + run: basedpyright src/parsley diff --git a/.python-version b/.python-version new file mode 100644 index 0000000..2c07333 --- /dev/null +++ b/.python-version @@ -0,0 +1 @@ +3.11 diff --git a/README.md b/README.md index ca66de6..73a9f81 100644 --- a/README.md +++ b/README.md @@ -60,7 +60,14 @@ print(format_line(result)) ``` ## Using Parsley -You can include parsley as a submodule in your project with ```git submodule add https://github.com/waterloo-rocketry/parsley.git``` and to pull the submodule as a developer, you can use ```git submodule update --init --recursive``` + +The easiest way to include parsley is through `uv` if your project uses it. Run `uv add git+https://github.com/waterloo-rocketry/parsley` to add to your project. + +You can also include parsley as a submodule in your project with ```git submodule add https://github.com/waterloo-rocketry/parsley.git``` and to pull the submodule as a developer, you can use ```git submodule update --init --recursive``` ## Requirements -```Python 3.10``` or newer is required and the required packages can be installed using `pip install -r requirements.txt` +**You must have the `uv` Python package manager and builder installed. Visit https://docs.astral.sh/uv/getting-started/installation/ to get started. If you don't know otherwise, choose the "Standalone Installer".** + +1. Run `uv sync` +2. Source virtual environment in `.venv` +3. To build, run `uv build` diff --git a/pyproject.toml b/pyproject.toml index 71483f3..3dd024f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,4 +1,44 @@ # pyproject.toml [build-system] -requires = ["setuptools >= 64"] -build-backend = "setuptools.build_meta" +requires = ["uv_build>=0.8.22,<0.9.0"] +build-backend = "uv_build" + +[tool.uv.build-backend] +module-name = "parsley" + +[project] +name = "parsley" +version = "2025.4" +description = "Library to transcode CAN messages and human-readable text" +readme = "README.md" +license = "MIT" +authors = [ + { name = "Waterloo Rocketry", email = "contact@waterloorocketry.com" } +] +requires-python = ">=3.11" +dependencies = [ + "crc8>=0.2.1", +] +classifiers = [ + "Development Status :: 2 - Pre-Alpha", + "Operating System :: OS Independent", + "Operating System :: POSIX :: Linux", + "Operating System :: MacOS :: MacOS X", + "Operating System :: Microsoft :: Windows :: Windows 10", + "Programming Language :: Python :: 3 :: Only", + "Programming Language :: Python :: 3.11", + "Intended Audience :: Developers", + "Topic :: Software Development :: Libraries :: Python Modules", +] + +[dependency-groups] +dev = [ + "flake8", + "pycodestyle", + "pytest", +] + +[project.urls] +Homepage = "https://github.com/waterloo-rocketry/parsley" +Repository = "https://github.com/waterloo-rocketry/parsley" + diff --git a/pytest.ini b/pytest.ini index 1612e9e..87c0208 100644 --- a/pytest.ini +++ b/pytest.ini @@ -1,3 +1,3 @@ ; need to tell pytest where to look for modules when importing code in tests/ [pytest] -pythonpath = ./parsley ./tests +pythonpath = src tests diff --git a/setup.cfg b/setup.cfg index 7557955..12d5fe8 100644 --- a/setup.cfg +++ b/setup.cfg @@ -4,7 +4,8 @@ max_line_length = 100 [flake8] exclude = __pycache__, - venv + venv, + .venv select = E9,F63,F7,F82 max-line-length = 100 count = True diff --git a/setup.py b/setup.py deleted file mode 100644 index 22e92eb..0000000 --- a/setup.py +++ /dev/null @@ -1,41 +0,0 @@ -from os import path - -from setuptools import setup, find_packages - -here = path.abspath(path.dirname(__file__)) - -with open(path.join(here, 'README.md'), encoding='utf-8') as f: - long_description = f.read() - -with open(path.join(here, 'requirements.txt'), encoding='utf-8') as f: - requirements = f.read().splitlines() - -setup( - name='parsley', - version='2025.4', - description='Library to transcode CAN messages and human-readable text', - long_description=long_description, - long_description_content_type='text/markdown', - url='https://github.com/waterloo-rocketry/parsley', - author='Waterloo Rocketry', - author_email='contact@waterloorocketry.com', - license='MIT', - classifiers=[ - 'Development Status :: 2 - Pre-Alpha', - - 'License :: OSI Approved :: MIT License', - - 'Operating System :: OS Independent', - 'Operating System :: POSIX :: Linux', - 'Operating System :: MacOS :: MacOS X', - 'Operating System :: Microsoft :: Windows :: Windows 10', - - 'Programming Language :: Python :: 3 :: Only', - 'Programming Language :: Python :: 3.10', - - 'Intended Audience :: Developers', - 'Topic :: Software Development :: Libraries :: Python Modules' - ], - packages=find_packages(include=['parsley']), - install_requires=requirements -) diff --git a/parsley/__init__.py b/src/parsley/__init__.py similarity index 100% rename from parsley/__init__.py rename to src/parsley/__init__.py diff --git a/parsley/bitstring.py b/src/parsley/bitstring.py similarity index 100% rename from parsley/bitstring.py rename to src/parsley/bitstring.py diff --git a/parsley/fields.py b/src/parsley/fields.py similarity index 100% rename from parsley/fields.py rename to src/parsley/fields.py diff --git a/parsley/message_definitions.py b/src/parsley/message_definitions.py similarity index 100% rename from parsley/message_definitions.py rename to src/parsley/message_definitions.py diff --git a/parsley/message_types.py b/src/parsley/message_types.py similarity index 100% rename from parsley/message_types.py rename to src/parsley/message_types.py diff --git a/parsley/parse_utils.py b/src/parsley/parse_utils.py similarity index 100% rename from parsley/parse_utils.py rename to src/parsley/parse_utils.py diff --git a/parsley/parsley.py b/src/parsley/parsley.py similarity index 100% rename from parsley/parsley.py rename to src/parsley/parsley.py diff --git a/uv.lock b/uv.lock new file mode 100644 index 0000000..f6a1cc1 --- /dev/null +++ b/uv.lock @@ -0,0 +1,139 @@ +version = 1 +revision = 3 +requires-python = ">=3.11" + +[[package]] +name = "colorama" +version = "0.4.6" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/d8/53/6f443c9a4a8358a93a6792e2acffb9d9d5cb0a5cfd8802644b7b1c9a02e4/colorama-0.4.6.tar.gz", hash = "sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44", size = 27697, upload-time = "2022-10-25T02:36:22.414Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/d1/d6/3965ed04c63042e047cb6a3e6ed1a63a35087b6a609aa3a15ed8ac56c221/colorama-0.4.6-py2.py3-none-any.whl", hash = "sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6", size = 25335, upload-time = "2022-10-25T02:36:20.889Z" }, +] + +[[package]] +name = "crc8" +version = "0.2.1" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/91/4a/aeba5e1ddd6f1035f634899a1fa133c9d57156d392386859e0cf84c1d62b/crc8-0.2.1.tar.gz", hash = "sha256:2ea9e0a04fbb9621daf278da7cba0c11e5fc2f7af74d44d35e08832d3a7a4d23", size = 5980, upload-time = "2024-08-07T20:46:49.448Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/d8/f8/6d922e3fb4b175f105150992c62aac05bb0cfe41fb138f9afda5a27f838f/crc8-0.2.1-py3-none-any.whl", hash = "sha256:0c7cc1e442f4e5227a4f1b83a025454fd2d575177c7f78f35814580c7ffd073a", size = 5582, upload-time = "2024-08-07T20:46:42.587Z" }, +] + +[[package]] +name = "flake8" +version = "7.3.0" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "mccabe" }, + { name = "pycodestyle" }, + { name = "pyflakes" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/9b/af/fbfe3c4b5a657d79e5c47a2827a362f9e1b763336a52f926126aa6dc7123/flake8-7.3.0.tar.gz", hash = "sha256:fe044858146b9fc69b551a4b490d69cf960fcb78ad1edcb84e7fbb1b4a8e3872", size = 48326, upload-time = "2025-06-20T19:31:35.838Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/9f/56/13ab06b4f93ca7cac71078fbe37fcea175d3216f31f85c3168a6bbd0bb9a/flake8-7.3.0-py2.py3-none-any.whl", hash = "sha256:b9696257b9ce8beb888cdbe31cf885c90d31928fe202be0889a7cdafad32f01e", size = 57922, upload-time = "2025-06-20T19:31:34.425Z" }, +] + +[[package]] +name = "iniconfig" +version = "2.1.0" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/f2/97/ebf4da567aa6827c909642694d71c9fcf53e5b504f2d96afea02718862f3/iniconfig-2.1.0.tar.gz", hash = "sha256:3abbd2e30b36733fee78f9c7f7308f2d0050e88f0087fd25c2645f63c773e1c7", size = 4793, upload-time = "2025-03-19T20:09:59.721Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/2c/e1/e6716421ea10d38022b952c159d5161ca1193197fb744506875fbb87ea7b/iniconfig-2.1.0-py3-none-any.whl", hash = "sha256:9deba5723312380e77435581c6bf4935c94cbfab9b1ed33ef8d238ea168eb760", size = 6050, upload-time = "2025-03-19T20:10:01.071Z" }, +] + +[[package]] +name = "mccabe" +version = "0.7.0" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/e7/ff/0ffefdcac38932a54d2b5eed4e0ba8a408f215002cd178ad1df0f2806ff8/mccabe-0.7.0.tar.gz", hash = "sha256:348e0240c33b60bbdf4e523192ef919f28cb2c3d7d5c7794f74009290f236325", size = 9658, upload-time = "2022-01-24T01:14:51.113Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/27/1a/1f68f9ba0c207934b35b86a8ca3aad8395a3d6dd7921c0686e23853ff5a9/mccabe-0.7.0-py2.py3-none-any.whl", hash = "sha256:6c2d30ab6be0e4a46919781807b4f0d834ebdd6c6e3dca0bda5a15f863427b6e", size = 7350, upload-time = "2022-01-24T01:14:49.62Z" }, +] + +[[package]] +name = "packaging" +version = "25.0" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/a1/d4/1fc4078c65507b51b96ca8f8c3ba19e6a61c8253c72794544580a7b6c24d/packaging-25.0.tar.gz", hash = "sha256:d443872c98d677bf60f6a1f2f8c1cb748e8fe762d2bf9d3148b5599295b0fc4f", size = 165727, upload-time = "2025-04-19T11:48:59.673Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/20/12/38679034af332785aac8774540895e234f4d07f7545804097de4b666afd8/packaging-25.0-py3-none-any.whl", hash = "sha256:29572ef2b1f17581046b3a2227d5c611fb25ec70ca1ba8554b24b0e69331a484", size = 66469, upload-time = "2025-04-19T11:48:57.875Z" }, +] + +[[package]] +name = "parsley" +version = "2025.4" +source = { editable = "." } +dependencies = [ + { name = "crc8" }, +] + +[package.dev-dependencies] +dev = [ + { name = "flake8" }, + { name = "pycodestyle" }, + { name = "pytest" }, +] + +[package.metadata] +requires-dist = [{ name = "crc8", specifier = ">=0.2.1" }] + +[package.metadata.requires-dev] +dev = [ + { name = "flake8" }, + { name = "pycodestyle" }, + { name = "pytest" }, +] + +[[package]] +name = "pluggy" +version = "1.6.0" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/f9/e2/3e91f31a7d2b083fe6ef3fa267035b518369d9511ffab804f839851d2779/pluggy-1.6.0.tar.gz", hash = "sha256:7dcc130b76258d33b90f61b658791dede3486c3e6bfb003ee5c9bfb396dd22f3", size = 69412, upload-time = "2025-05-15T12:30:07.975Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/54/20/4d324d65cc6d9205fabedc306948156824eb9f0ee1633355a8f7ec5c66bf/pluggy-1.6.0-py3-none-any.whl", hash = "sha256:e920276dd6813095e9377c0bc5566d94c932c33b27a3e3945d8389c374dd4746", size = 20538, upload-time = "2025-05-15T12:30:06.134Z" }, +] + +[[package]] +name = "pycodestyle" +version = "2.14.0" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/11/e0/abfd2a0d2efe47670df87f3e3a0e2edda42f055053c85361f19c0e2c1ca8/pycodestyle-2.14.0.tar.gz", hash = "sha256:c4b5b517d278089ff9d0abdec919cd97262a3367449ea1c8b49b91529167b783", size = 39472, upload-time = "2025-06-20T18:49:48.75Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/d7/27/a58ddaf8c588a3ef080db9d0b7e0b97215cee3a45df74f3a94dbbf5c893a/pycodestyle-2.14.0-py2.py3-none-any.whl", hash = "sha256:dd6bf7cb4ee77f8e016f9c8e74a35ddd9f67e1d5fd4184d86c3b98e07099f42d", size = 31594, upload-time = "2025-06-20T18:49:47.491Z" }, +] + +[[package]] +name = "pyflakes" +version = "3.4.0" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/45/dc/fd034dc20b4b264b3d015808458391acbf9df40b1e54750ef175d39180b1/pyflakes-3.4.0.tar.gz", hash = "sha256:b24f96fafb7d2ab0ec5075b7350b3d2d2218eab42003821c06344973d3ea2f58", size = 64669, upload-time = "2025-06-20T18:45:27.834Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/c2/2f/81d580a0fb83baeb066698975cb14a618bdbed7720678566f1b046a95fe8/pyflakes-3.4.0-py2.py3-none-any.whl", hash = "sha256:f742a7dbd0d9cb9ea41e9a24a918996e8170c799fa528688d40dd582c8265f4f", size = 63551, upload-time = "2025-06-20T18:45:26.937Z" }, +] + +[[package]] +name = "pygments" +version = "2.19.2" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/b0/77/a5b8c569bf593b0140bde72ea885a803b82086995367bf2037de0159d924/pygments-2.19.2.tar.gz", hash = "sha256:636cb2477cec7f8952536970bc533bc43743542f70392ae026374600add5b887", size = 4968631, upload-time = "2025-06-21T13:39:12.283Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/c7/21/705964c7812476f378728bdf590ca4b771ec72385c533964653c68e86bdc/pygments-2.19.2-py3-none-any.whl", hash = "sha256:86540386c03d588bb81d44bc3928634ff26449851e99741617ecb9037ee5ec0b", size = 1225217, upload-time = "2025-06-21T13:39:07.939Z" }, +] + +[[package]] +name = "pytest" +version = "8.4.2" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "colorama", marker = "sys_platform == 'win32'" }, + { name = "iniconfig" }, + { name = "packaging" }, + { name = "pluggy" }, + { name = "pygments" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/a3/5c/00a0e072241553e1a7496d638deababa67c5058571567b92a7eaa258397c/pytest-8.4.2.tar.gz", hash = "sha256:86c0d0b93306b961d58d62a4db4879f27fe25513d4b969df351abdddb3c30e01", size = 1519618, upload-time = "2025-09-04T14:34:22.711Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/a8/a4/20da314d277121d6534b3a980b29035dcd51e6744bd79075a6ce8fa4eb8d/pytest-8.4.2-py3-none-any.whl", hash = "sha256:872f880de3fc3a5bdc88a11b39c9710c3497a547cfa9320bc3c5e62fbf272e79", size = 365750, upload-time = "2025-09-04T14:34:20.226Z" }, +]