Skip to content

Commit

Permalink
Use pyproject.toml and drop outdated Python support
Browse files Browse the repository at this point in the history
  • Loading branch information
matwey committed Aug 5, 2024
1 parent fb00601 commit de4f4b8
Show file tree
Hide file tree
Showing 12 changed files with 44 additions and 62 deletions.
18 changes: 9 additions & 9 deletions .github/workflows/python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,16 @@ jobs:
construct-version: ">=2.9,<2.10"

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install Dependencies
run: |
python -m pip install --upgrade pip
pip install 'construct${{ matrix.construct-version }}'
pip install -r requirements.txt
- name: Install construct
run: python -m pip install 'construct${{ matrix.construct-version }}'
- name: Install pybeam
run: python -m pip install .
- name: Install pytest
run: python -m pip install pytest
- name: Run Tests
run: |
python setup.py test
run: pytest
5 changes: 0 additions & 5 deletions MANIFEST.in

This file was deleted.

1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ pybeam
======
Python module to parse Erlang BEAM files.

Both python 2.7 and python 3.3 are supported. Python 3.2 are known not to work.
Pull-requests are always welcome.

## Quick start:
Expand Down
5 changes: 0 additions & 5 deletions pybeam/erlang_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
#

from collections import namedtuple
from six import PY2
import warnings

class AtomCacheReference(int):
Expand All @@ -42,10 +41,6 @@ def value(self):
warnings.warn("x.value is deprecated; use x instead", DeprecationWarning)
return self

if PY2:
def __getitem__(self, index):
return ord(super(String, self).__getitem__(index))

class Binary(bytes):
@property
def value(self):
Expand Down
3 changes: 1 addition & 2 deletions pybeam/schema/eetf.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
#

import sys
from six import text_type

from construct import this
from construct import (
Expand Down Expand Up @@ -111,7 +110,7 @@ def tag(obj):
AtomCacheReference : 82,
int : 98,
float : 70,
text_type : 118, # unicode in Python 2 and str in Python 3
str : 118, # unicode in Python 2 and str in Python 3
Reference : 114,
Port : 102,
Pid : 103,
Expand Down
32 changes: 32 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
[build-system]
requires = ["setuptools >= 61.0"]
build-backend = "setuptools.build_meta"

[project]
name = "pybeam"
version = "0.7"
description = "Python module to parse Erlang BEAM files"
authors = [
{name = "Matwey V. Kornilov", email = "[email protected]"},
]
dependencies = [
"construct>=2.9,<2.11",
]
requires-python = ">=3.7"
readme = "README.md"
license = {file = "LICENSE"}

[project.optional-dependencies]
dev = [
"pytest",
]

[project.urls]
Repository = "https://github.com/matwey/pybeam.git"
Issues = "https://github.com/matwey/pybeam/issues"

[tool.pytest.ini_options]
testpaths = [
"pybeam",
"test",
]
3 changes: 0 additions & 3 deletions requirements.txt

This file was deleted.

30 changes: 0 additions & 30 deletions setup.py

This file was deleted.

4 changes: 0 additions & 4 deletions test/__init__.py

This file was deleted.

File renamed without changes.
File renamed without changes.
5 changes: 2 additions & 3 deletions test/schema_eetf.py → test/test_schema_eetf.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@

import pybeam.schema.eetf as eetf
from pybeam import erlang_types
from six import int2byte
import unittest

class EETFConstructTest(unittest.TestCase):
Expand Down Expand Up @@ -122,9 +121,9 @@ def test_string(self):
self.assertEqual(c.parse(b'\x00\x0aRoBurToVoY'), erlang_types.String(b'RoBurToVoY'))
s = erlang_types.String(b'RoBurToVoY')
self.assertEqual(c.parse(c.build(s)),s)
n = b"\x01\x00" + b"".join(map(int2byte, range(0,256)))
n = b"\x01\x00" + bytes(range(0,256))
self.assertListEqual(list(c.parse(n)), list(range(0,256)))
self.assertEqual(c.build(erlang_types.String(b"".join(map(int2byte, range(0,256))))), n)
self.assertEqual(c.build(erlang_types.String(bytes(range(0,256)))), n)
def test_binary(self):
c = eetf.binary
self.assertEqual(c.parse(b'\x00\x00\x00\x0aRoBurToVoY'), erlang_types.Binary(b'RoBurToVoY'))
Expand Down

0 comments on commit de4f4b8

Please sign in to comment.