diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index ab0b4e56..0e38ecf8 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -28,6 +28,10 @@ jobs: - "3.9" - "3.10" - "3.11-dev" + - "pypy-2.7" + - "pypy-3.7" + - "pypy-3.8" + - "pypy-3.9" steps: - uses: "actions/checkout@v3" - uses: "actions/setup-python@v4" @@ -40,3 +44,34 @@ jobs: run: python -m pip install --upgrade tox tox-gh-actions - name: "Run tox for ${{ matrix.python-version }}" run: "python -m tox" + + sdist: + name: "Build sdist and wheel" + runs-on: "ubuntu-latest" + needs: tests + steps: + - uses: "actions/checkout@v3" + - uses: "actions/setup-python@v4" + with: + python-version: "3.10" + cache: "pip" + - name: "Update pip" + run: python -m pip install --upgrade pip setuptools wheel + - name: "Install 'build'" + run: python -m pip install --upgrade build + - name: "Run 'build'" + run: "python -m build" + - name: "Upload sdist artifact" + uses: actions/upload-artifact@v2 + with: + name: sdist + path: | + dist/pyasn1*.tar.gz + if-no-files-found: error + - name: "Upload wheel artifact" + uses: actions/upload-artifact@v2 + with: + name: wheel + path: | + dist/pyasn1*.whl + if-no-files-found: error diff --git a/.gitignore b/.gitignore index 46547076..029a5d60 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,7 @@ *.pyc __pycache__ +.tox +.coverage # vim swapfiles *.sw? diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 59bb9fda..00000000 --- a/.travis.yml +++ /dev/null @@ -1,21 +0,0 @@ -language: python -cache: pip -matrix: - include: - - python: '2.7' - - python: '3.5' - - python: '3.6' - - python: '3.7' - - python: '3.8' - - python: 'nightly' - - python: 'pypy' - - python: 'pypy3' -install: - - pip install codecov - - pip install -r requirements.txt - - pip install -e . -script: - - PYTHONPATH=.:$PYTHONPATH python tests/__main__.py -after_success: - - PYTHONPATH=.:$PYTHONPATH coverage run --omit=*test* tests/__main__.py - - codecov diff --git a/CHANGES.txt b/CHANGES.txt index b9535c0e..2cb81e85 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,8 +1,12 @@ - -Revision 0.3.0, released XX-03-2020 +Revision 0.3.0, released XX-08-2028 ----------------------------------- -- Added support for Python 3.8. +- Added support for Python 3.8, 3.9, 3.10, 3.11 +- Removed support for EOL Pythons 2.4, 2.5, 2.6, 3.2, 3.3, 3.4, 3.5 +- Added support for PyPy 3.7, 3.8, 3.9 +- Modernized packaging and testing. pyasn1-modules now uses ``setup.cfg``, + ``pyproject.toml``, [build](https://pypi.org/project/build/), and + GitHub Actions. - Added tox runner with a handful of basic jobs - Add RFC3125 providing Electronic Signature Policies - Add RFC5126 providing CMS Advanced Electronic Signatures (CAdES) diff --git a/README.md b/README.md index baa11c71..29953a5e 100644 --- a/README.md +++ b/README.md @@ -3,13 +3,13 @@ ASN.1 modules for Python ------------------------ [![PyPI](https://img.shields.io/pypi/v/pyasn1-modules.svg?maxAge=2592000)](https://pypi.org/project/pyasn1-modules) [![Python Versions](https://img.shields.io/pypi/pyversions/pyasn1-modules.svg)](https://pypi.org/project/pyasn1-modules/) -[![Build status](https://travis-ci.org/etingof/pyasn1-modules.svg?branch=master)](https://travis-ci.org/etingof/pyasn1-modules) -[![Coverage Status](https://img.shields.io/codecov/c/github/etingof/pyasn1-modules.svg)](https://codecov.io/github/etingof/pyasn1-modules/) -[![GitHub license](https://img.shields.io/badge/license-BSD-blue.svg)](https://raw.githubusercontent.com/etingof/pyasn1-modules/master/LICENSE.txt) +[![Build status](https://github.com/pyasn1/pyasn1-modules/actions/workflows/main.yml/badge.svg)](https://github.com/pyasn1/pyasn1-modules/actions/workflows/main.yml) +[![Coverage Status](https://img.shields.io/codecov/c/github/pyasn1/pyasn1-modules.svg)](https://codecov.io/github/pyasn1/pyasn1-modules) +[![GitHub license](https://img.shields.io/badge/license-BSD-blue.svg)](https://raw.githubusercontent.com/pyasn1/pyasn1-modules/master/LICENSE.txt) The `pyasn1-modules` package contains a collection of [ASN.1](https://www.itu.int/rec/dologin_pub.asp?lang=e&id=T-REC-X.208-198811-W!!PDF-E&type=items) -data structures expressed as Python classes based on [pyasn1](https://github.com/etingof/pyasn1) +data structures expressed as Python classes based on [pyasn1](https://github.com/pyasn1/pyasn1) data model. If ASN.1 module you need is not present in this collection, try using @@ -20,7 +20,7 @@ Feedback -------- If something does not work as expected, -[open an issue](https://github.com/etingof/pyasn1-modules/issues) at GitHub +[open an issue](https://github.com/pyasn1/pyasn1-modules/issues) at GitHub or post your question [on Stack Overflow](https://stackoverflow.com/questions/ask) New modules contributions are welcome via GitHub pull requests. diff --git a/pyasn1_modules/__init__.py b/pyasn1_modules/__init__.py index 95a220ef..41dd7c58 100644 --- a/pyasn1_modules/__init__.py +++ b/pyasn1_modules/__init__.py @@ -1,2 +1,2 @@ # http://www.python.org/dev/peps/pep-0396/ -__version__ = '0.3.0' +__version__ = '0.3.0.dev1' diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 00000000..e3d7c965 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,5 @@ +[build-system] +requires = [ + "setuptools" +] +build-backend = "setuptools.build_meta" diff --git a/setup.cfg b/setup.cfg index 2e9053c0..24933ec8 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,5 +1,54 @@ -[bdist_wheel] -universal = 1 - [metadata] +name = pyasn1_modules +version = attr: pyasn1_modules.__version__ +description = A collection of ASN.1-based protocols modules +long_description = file: README.md +long_description_content_type = text/markdown +license = BSD license_file = LICENSE.txt +url = https://github.com/pyasn1/pyasn1-modules +author = Ilya Etingof +author_email = etingof@gmail.com +maintainer = pyasn1 maintenance organization +maintainer_email = Christian Heimes +project_urls = + Source=https://github.com/pyasn1/pyasn1-modules + Issues=https://github.com/pyasn1/pyasn1-modules/issues + Changelog=https://github.com/pyasn1/pyasn1-modules/blob/master/CHANGES.txt +platforms = any +classifiers = + Development Status :: 5 - Production/Stable + Environment :: Console + Intended Audience :: Developers + Intended Audience :: Education + Intended Audience :: Information Technology + Intended Audience :: System Administrators + Intended Audience :: Telecommunications Industry + License :: OSI Approved :: BSD License + Natural Language :: English + Operating System :: OS Independent + Programming Language :: Python :: 2 + Programming Language :: Python :: 2.7 + Programming Language :: Python :: 3 + Programming Language :: Python :: 3.6 + Programming Language :: Python :: 3.7 + Programming Language :: Python :: 3.8 + Programming Language :: Python :: 3.9 + Programming Language :: Python :: 3.10 + Programming Language :: Python :: 3.11 + Programming Language :: Python :: Implementation :: CPython + Programming Language :: Python :: Implementation :: PyPy + Topic :: Communications + Topic :: Software Development :: Libraries :: Python Modules + +[options] +python_requires = >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, !=3.5.* +zip_safe = True +setup_requires = setuptools +install_requires = + pyasn1>=0.4.6,<0.6.0 +packages = + pyasn1_modules + +[bdist_wheel] +universal = 1 diff --git a/setup.py b/setup.py index efbef7a3..d7b3b238 100644 --- a/setup.py +++ b/setup.py @@ -5,121 +5,6 @@ # Copyright (c) 2005-2020, Ilya Etingof # License: http://snmplabs.com/pyasn1/license.html # -import sys -import unittest +from setuptools import setup - -doclines = """A collection of ASN.1-based protocols modules. - - A collection of ASN.1 modules expressed in form of pyasn1 classes. - Includes protocols PDUs definition (SNMP, LDAP etc.) and various - data structures (X.509, PKCS etc.). -""" - -doclines = [x.strip() for x in doclines.split('\n') if x] - - -classifiers = """\ -Development Status :: 5 - Production/Stable -Environment :: Console -Intended Audience :: Developers -Intended Audience :: Education -Intended Audience :: Information Technology -Intended Audience :: System Administrators -Intended Audience :: Telecommunications Industry -License :: OSI Approved :: BSD License -Natural Language :: English -Operating System :: OS Independent -Programming Language :: Python :: 2 -Programming Language :: Python :: 2.7 -Programming Language :: Python :: 3 -Programming Language :: Python :: 3.5 -Programming Language :: Python :: 3.6 -Programming Language :: Python :: 3.7 -Programming Language :: Python :: 3.8 -Programming Language :: Python :: 3.9 -Programming Language :: Python :: 3.10 -Programming Language :: Python :: 3.11 -Topic :: Communications -Topic :: System :: Monitoring -Topic :: System :: Networking :: Monitoring -Topic :: Software Development :: Libraries :: Python Modules -""" - - -def howto_install_setuptools(): - print(""" - Error: You need setuptools Python package! - - It's very easy to install it, just type (as root on Linux): - - wget https://bitbucket.org/pypa/setuptools/raw/bootstrap/ez_setup.py - python ez_setup.py - - Then you could make eggs from this package. -""") - - -if sys.version_info[:2] < (2, 7): - print("ERROR: this package requires Python 2.7 or later!") - sys.exit(1) - -try: - from setuptools import setup, Command - - params = { - 'zip_safe': True, - 'install_requires': ['pyasn1>=0.4.6,<0.6.0'] - } - -except ImportError: - for arg in sys.argv: - if 'egg' in arg: - howto_install_setuptools() - sys.exit(1) - - from distutils.core import setup, Command - - params = { - 'requires': ['pyasn1(>=0.4.6,<0.6.0)'] - } - -params.update( - {'name': 'pyasn1-modules', - 'version': open('pyasn1_modules/__init__.py').read().split('\'')[1], - 'description': doclines[0], - 'long_description': ' '.join(doclines[1:]), - 'maintainer': 'Ilya Etingof ', - 'author': 'Ilya Etingof', - 'author_email': 'etingof@gmail.com', - 'url': 'https://github.com/etingof/pyasn1-modules', - 'platforms': ['any'], - 'python_requires': '>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*', - 'classifiers': [x for x in classifiers.split('\n') if x], - 'license': 'BSD-2-Clause', - 'packages': ['pyasn1_modules'], - 'python_requires': '>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*'}) - - -class PyTest(Command): - user_options = [] - - def initialize_options(self): - pass - - def finalize_options(self): - pass - - def run(self): - suite = unittest.TestLoader().loadTestsFromNames( - ['tests.__main__.suite'] - ) - - unittest.TextTestRunner(verbosity=2).run(suite) - -params['cmdclass'] = { - 'test': PyTest, - 'tests': PyTest -} - -setup(**params) +setup() diff --git a/tests/test_missing.py b/tests/test_missing.py new file mode 100644 index 00000000..0b3f58a7 --- /dev/null +++ b/tests/test_missing.py @@ -0,0 +1,18 @@ +# +# This file is part of pyasn1-modules software. +# +import sys +import unittest + +# modules without tests +from pyasn1_modules import ( + rfc1155, rfc1157, rfc1901, rfc3412, rfc3414 +) + +suite = unittest.TestLoader().loadTestsFromModule(sys.modules[__name__]) + +if __name__ == '__main__': + import sys + + result = unittest.TextTestRunner(verbosity=2).run(suite) + sys.exit(not result.wasSuccessful()) diff --git a/tox.ini b/tox.ini index 4e831d14..38d022eb 100644 --- a/tox.ini +++ b/tox.ini @@ -1,69 +1,21 @@ [tox] -minversion = 3.4.0 +minversion = 3.5.0 envlist = - {py27, py35, py36, py37, py38, py39, py310, py311}-{unittest}, + py27, py36, py37, py38, py39, py310, py311, pypy27, pypy37, pypy38, pypy39 cover, bandit, build isolated_build = true skip_missing_interpreters = true [testenv] -usedevelop = True -setenv = - VIRTUAL_ENV={envdir} - PYTHONWARNINGS=default::DeprecationWarning -deps = pip >= 19.3.1 -install_command = - pip install {opts} {packages} - -[testenv:unittest] -deps = - {[testenv]deps} - discover - -r{toxinidir}/requirements.txt commands = - discover -s examples/pyasn1_modules-example-switch/tests -s tests - -[testenv:py27-unittest] -deps = {[testenv:unittest]deps} -commands = {[testenv:unittest]commands} - -[testenv:py35-unittest] -deps = {[testenv:unittest]deps} -commands = {[testenv:unittest]commands} - -[testenv:py36-unittest] -deps = {[testenv:unittest]deps} -commands = {[testenv:unittest]commands} - -[testenv:py37-unittest] -deps = {[testenv:unittest]deps} -commands = {[testenv:unittest]commands} - -[testenv:py38-unittest] -deps = {[testenv:unittest]deps} -commands = {[testenv:unittest]commands} - -[testenv:py39-unittest] -deps = {[testenv:unittest]deps} -commands = {[testenv:unittest]commands} - -[testenv:py310-unittest] -deps = {[testenv:unittest]deps} -commands = {[testenv:unittest]commands} - -[testenv:py311-unittest] -deps = {[testenv:unittest]deps} -commands = {[testenv:unittest]commands} + {envpython} -m unittest discover -s tests +deps = + pyasn1>=0.4.6,<0.6.0 [testenv:cover] basepython = python3 -setenv = - {[testenv]setenv} - PYTHON=coverage run --parallel-mode deps = - {[testenv:unittest]deps} coverage - discover commands = coverage erase coverage run --source pyasn1_modules -m unittest discover {posargs} coverage report --fail-under 93 @@ -73,22 +25,28 @@ skip_install = true deps = bandit commands = - bandit -r pyasn1_modules -c .bandit.yml + bandit -r pyasn1 -c .bandit.yml [testenv:build] skip_install = true deps = - wheel - setuptools + build + twine commands = - python setup.py -q sdist bdist_wheel + {envpython} -m build + {envpython} -m twine check --strict dist/pyasn1_modules*.whl + {envpython} -m twine check --strict dist/pyasn1_modules*.tar.gz [gh-actions] python = - 2.7: py27-unittest - 3.6: py36-unittest - 3.7: py37-unittest - 3.8: py38-unittest - 3.9: py39-unittest, bandit - 3.10: py310-unittest, cover, build - 3.11: py311-unittest + 2.7: py27 + 3.6: py36 + 3.7: py37 + 3.8: py38 + 3.9: py39 + 3.10: py310, cover, build, bandit + 3.11: py311 + pypy-2.7: pypy27 + pypy-3.7: pypy37 + pypy-3.8: pypy38 + pypy-3.9: pypy39