Skip to content

Commit

Permalink
Merge branch '88-switch-from-setup-py-to-pyproject-toml'
Browse files Browse the repository at this point in the history
Closes: #88
  • Loading branch information
c0r0n3r committed Jan 5, 2025
2 parents 9389580 + 8bbbc34 commit 8fd30b3
Show file tree
Hide file tree
Showing 15 changed files with 142 additions and 164 deletions.
2 changes: 2 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[flake8]
max-line-length = 120
7 changes: 3 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,10 @@

*.pyc

.coverage
.idea
.mypy_cache
*.egg-info

/.coverage

/*.egg-info
/.eggs
/.tox
/Pipfile
Expand Down
5 changes: 3 additions & 2 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ stages:
- deploy

before_script:
- pip install -r dev-requirements.txt
- pip install tox .[tests]

variables:
GIT_SUBMODULE_DEPTH: 1
Expand Down Expand Up @@ -71,7 +71,8 @@ coveralls:
stage: deploy
script:
- pip install coveralls
- pip install -r requirements.txt
- pip install .
- pip install .[tests]
- coverage run -m unittest -v -f
- coveralls
only:
Expand Down
17 changes: 9 additions & 8 deletions .pylintrc
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
[BASIC]
[MAIN]

good-names = e,f,g,n,p,q,y,_,H2

class-attribute-rgx = ([A-Za-z_][A-Za-z0-9_]{2,50}|(__.*__))$
method-rgx = [a-z_][a-z0-9_]{2,50}$
variable-rgx = [a-z_][a-z0-9_]{2,50}$
jobs=0

[MASTER]

load-plugins = pylint.extensions.no_self_use

[FORMAT]

max-line-length = 120
max-line-length=120

[MESSAGES CONTROL]

disable = missing-docstring,too-few-public-methods,too-many-ancestors,duplicate-code
disable=
missing-docstring,
too-few-public-methods,
too-many-function-args,
too-many-ancestors,
duplicate-code,
6 changes: 4 additions & 2 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,7 @@ build:

python:
install:
- requirements: docs-requirements.txt
- requirements: requirements.txt
- method: pip
path: .
extra_requirements:
- docs
2 changes: 1 addition & 1 deletion CONTRIBUTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ Preparing your Fork
3. ``cd theproject``
4. `Create and activate a virtual
environment <https://packaging.python.org/tutorials/installing-packages/#creating-virtual-environments>`__.
5. Install the development requirements: ``pip install -r dev-requirements.txt``.
5. Install the development requirements: ``pip install .[tests]``.
6. Create a branch: ``git checkout -b foo-the-bars 1.3``.

Making your Changes
Expand Down
1 change: 0 additions & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
include *.rst
include requirements.txt
16 changes: 10 additions & 6 deletions cryptoparser/__setup__.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
# -*- coding: utf-8 -*-

__title__ = 'CryptoParser'
import importlib.metadata

metadata = importlib.metadata.metadata('cryptoparser')

__title__ = metadata['Name']
__technical_name__ = __title__.lower()
__version__ = '0.12.6'
__description__ = 'An analysis oriented security protocol parser and generator'
__author__ = 'Szilárd Pfeiffer'
__author_email__ = 'coroner@pfeifferszilard.hu'
__version__ = metadata['Version']
__description__ = metadata['Summary']
__author__ = metadata['Author']
__author_email__ = metadata['Author-email']
__url__ = 'https://gitlab.com/coroner/' + __technical_name__
__license__ = 'MPL-2.0'
__license__ = metadata['License']
3 changes: 0 additions & 3 deletions dev-requirements.txt

This file was deleted.

2 changes: 0 additions & 2 deletions docs-requirements.txt

This file was deleted.

107 changes: 107 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
[build-system]
requires = ['setuptools', 'setuptools-scm']
build-backend = 'setuptools.build_meta'

[project]
name = 'CryptoParser'
version = '0.12.6'
description = 'An analysis oriented security protocol parser and generator'
authors = [
{name = 'Szilárd Pfeiffer', email = 'coroner@pfeifferszilard.hu'}
]
maintainers = [
{name = 'Szilárd Pfeiffer', email = 'coroner@pfeifferszilard.hu'}
]
classifiers=[
'Development Status :: 4 - Beta',
'Environment :: Console',
'Framework :: tox',
'Intended Audience :: Information Technology',
'Intended Audience :: Science/Research',
'Intended Audience :: System Administrators',
'License :: OSI Approved :: Mozilla Public License 2.0 (MPL 2.0)',
'Natural Language :: English',
'Operating System :: MacOS',
'Operating System :: Microsoft :: Windows',
'Operating System :: POSIX',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: 3.11',
'Programming Language :: Python :: 3.12',
'Programming Language :: Python :: 3.13',
'Programming Language :: Python :: Implementation :: CPython',
'Programming Language :: Python :: Implementation :: PyPy',
'Programming Language :: Python',
'Topic :: Internet',
'Topic :: Security',
'Topic :: Security :: Cryptography',
'Topic :: Software Development :: Libraries :: Python Modules',
'Topic :: Software Development :: Testing :: Traffic Generation',
'Topic :: Software Development :: Testing',
]

keywords=['ssl', 'tls', 'gost', 'ja3', 'ldap', 'rdp', 'ssh', 'hsts', 'dns']
readme = {file = 'README.rst', content-type = 'text/x-rst'}
license = {text = 'MPL-2.0'}

dependencies = [
'asn1crypto',
'attrs',
'cryptodatahub==0.12.6',
'python-dateutil',
'urllib3',
]

[project.optional-dependencies]
tests = [
'pyfakefs',
]
docs = [
'sphinx',
'sphinx-sitemap',
]

[project.urls]
Homepage = 'https://gitlab.com/coroner/cryptoparser'
Changelog = 'https://cryptoparser.readthedocs.io/en/latest/changelog'
Documentation = 'https://cryptoparser.readthedocs.io/en/latest/'
Issues = 'https://gitlab.com/coroner/cryptoparser/-/issues'
Source = 'https://gitlab.com/coroner/cryptoparser'

[tool.variables]
technical_name = 'cryptoparser'

[tool.setuptools]
license-files = ['LICENSE.txt']

[tool.setuptools.packages.find]
exclude = ['submodules']

[tool.tox]
envlist = [
'pep8',
'pylint',
'pypy3',
'py39',
'py310',
'py311',
'py312',
'py313',
'pythonrc',
]

[tool.tox.env_run_base]
deps = ['coverage', '.[tests]']
commands = [
['coverage', 'erase'],
['coverage', 'run', '-m', 'unittest', 'discover', '-v'],
['coverage', 'report']
]

[tool.tox.env.pep8]
deps = ['flake8']
commands = [['flake8', 'cryptoparser', 'docs', 'test']]

[tool.tox.env.pylint]
deps = ['pylint', '.[tests]']
commands = [['pylint', '--rcfile', '.pylintrc', 'cryptoparser', 'docs', 'test']]
5 changes: 0 additions & 5 deletions requirements.txt

This file was deleted.

93 changes: 2 additions & 91 deletions setup.py
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,94 +1,5 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import codecs
import os
import unittest
import setuptools

from setuptools import setup

from cryptoparser import __setup__


this_directory = os.getenv('REQUIREMENTS_DIR', '')
with open(os.path.join(this_directory, 'requirements.txt')) as f:
install_requirements = f.read().splitlines()
this_directory = os.path.abspath(os.path.dirname(__file__))
with codecs.open(os.path.join(this_directory, 'README.rst'), encoding='utf-8') as f:
long_description = f.read()


def test_discover():
test_loader = unittest.TestLoader()
test_suite = test_loader.discover('test', pattern='test_*.py')
return test_suite


setup(
name=__setup__.__title__,
version=__setup__.__version__,
description=__setup__.__description__,
long_description=long_description,
long_description_content_type='text/x-rst',
author=__setup__.__author__,
author_email=__setup__.__author_email__,
maintainer=__setup__.__author__,
maintainer_email=__setup__.__author_email__,
license=__setup__.__license__,
license_files=['LICENSE.txt', ],
project_urls={
'Homepage': __setup__.__url__,
'Changelog': 'https://' + __setup__.__technical_name__ + '.readthedocs.io/en/latest/changelog',
'Documentation': 'https://' + __setup__.__technical_name__ + '.readthedocs.io/en/latest/',
'Issues': __setup__.__url__ + '/-/issues',
'Source': __setup__.__url__,
},
keywords='ssl tls gost ja3 ldap rdp ssh hsts dns',

install_requires=install_requirements,
extras_require={
"test": ["coverage", ],
"pep8": ["flake8", ],
"pylint": ["pylint", ],
},

packages=[
'cryptoparser',
'cryptoparser.common',
'cryptoparser.dnsrec',
'cryptoparser.httpx',
'cryptoparser.ssh',
'cryptoparser.tls',
],

test_suite='setup.test_discover',

classifiers=[
'Development Status :: 4 - Beta',
'Environment :: Console',
'Framework :: tox',
'Intended Audience :: Developers',
'Intended Audience :: Information Technology',
'Intended Audience :: Science/Research',
'Intended Audience :: System Administrators',
'License :: OSI Approved :: Mozilla Public License 2.0 (MPL 2.0)',
'Natural Language :: English',
'Operating System :: MacOS',
'Operating System :: Microsoft :: Windows',
'Operating System :: POSIX',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: 3.11',
'Programming Language :: Python :: 3.12',
'Programming Language :: Python :: 3.13',
'Programming Language :: Python :: Implementation :: CPython',
'Programming Language :: Python :: Implementation :: PyPy',
'Programming Language :: Python',
'Topic :: Internet',
'Topic :: Security',
'Topic :: Security :: Cryptography',
'Topic :: Software Development :: Libraries :: Python Modules',
'Topic :: Software Development :: Testing :: Traffic Generation',
'Topic :: Software Development :: Testing',
],
)
setuptools.setup()
2 changes: 1 addition & 1 deletion submodules/cryptodatahub
Submodule cryptodatahub updated from 5fe37d to 075ef4
38 changes: 0 additions & 38 deletions tox.ini

This file was deleted.

0 comments on commit 8fd30b3

Please sign in to comment.