Skip to content

Commit 8fd30b3

Browse files
committed
Merge branch '88-switch-from-setup-py-to-pyproject-toml'
Closes: #88
2 parents 9389580 + 8bbbc34 commit 8fd30b3

15 files changed

+142
-164
lines changed

.flake8

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[flake8]
2+
max-line-length = 120

.gitignore

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,10 @@
55

66
*.pyc
77

8-
.coverage
9-
.idea
10-
.mypy_cache
8+
*.egg-info
9+
10+
/.coverage
1111

12-
/*.egg-info
1312
/.eggs
1413
/.tox
1514
/Pipfile

.gitlab-ci.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ stages:
66
- deploy
77

88
before_script:
9-
- pip install -r dev-requirements.txt
9+
- pip install tox .[tests]
1010

1111
variables:
1212
GIT_SUBMODULE_DEPTH: 1
@@ -71,7 +71,8 @@ coveralls:
7171
stage: deploy
7272
script:
7373
- pip install coveralls
74-
- pip install -r requirements.txt
74+
- pip install .
75+
- pip install .[tests]
7576
- coverage run -m unittest -v -f
7677
- coveralls
7778
only:

.pylintrc

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,20 @@
1-
[BASIC]
1+
[MAIN]
22

3-
good-names = e,f,g,n,p,q,y,_,H2
4-
5-
class-attribute-rgx = ([A-Za-z_][A-Za-z0-9_]{2,50}|(__.*__))$
6-
method-rgx = [a-z_][a-z0-9_]{2,50}$
7-
variable-rgx = [a-z_][a-z0-9_]{2,50}$
3+
jobs=0
84

95
[MASTER]
106

117
load-plugins = pylint.extensions.no_self_use
128

139
[FORMAT]
1410

15-
max-line-length = 120
11+
max-line-length=120
1612

1713
[MESSAGES CONTROL]
1814

19-
disable = missing-docstring,too-few-public-methods,too-many-ancestors,duplicate-code
15+
disable=
16+
missing-docstring,
17+
too-few-public-methods,
18+
too-many-function-args,
19+
too-many-ancestors,
20+
duplicate-code,

.readthedocs.yaml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,7 @@ build:
1111

1212
python:
1313
install:
14-
- requirements: docs-requirements.txt
15-
- requirements: requirements.txt
14+
- method: pip
15+
path: .
16+
extra_requirements:
17+
- docs

CONTRIBUTING.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ Preparing your Fork
142142
3. ``cd theproject``
143143
4. `Create and activate a virtual
144144
environment <https://packaging.python.org/tutorials/installing-packages/#creating-virtual-environments>`__.
145-
5. Install the development requirements: ``pip install -r dev-requirements.txt``.
145+
5. Install the development requirements: ``pip install .[tests]``.
146146
6. Create a branch: ``git checkout -b foo-the-bars 1.3``.
147147

148148
Making your Changes

MANIFEST.in

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
11
include *.rst
2-
include requirements.txt

cryptoparser/__setup__.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
11
# -*- coding: utf-8 -*-
22

3-
__title__ = 'CryptoParser'
3+
import importlib.metadata
4+
5+
metadata = importlib.metadata.metadata('cryptoparser')
6+
7+
__title__ = metadata['Name']
48
__technical_name__ = __title__.lower()
5-
__version__ = '0.12.6'
6-
__description__ = 'An analysis oriented security protocol parser and generator'
7-
__author__ = 'Szilárd Pfeiffer'
8-
__author_email__ = 'coroner@pfeifferszilard.hu'
9+
__version__ = metadata['Version']
10+
__description__ = metadata['Summary']
11+
__author__ = metadata['Author']
12+
__author_email__ = metadata['Author-email']
913
__url__ = 'https://gitlab.com/coroner/' + __technical_name__
10-
__license__ = 'MPL-2.0'
14+
__license__ = metadata['License']

dev-requirements.txt

Lines changed: 0 additions & 3 deletions
This file was deleted.

docs-requirements.txt

Lines changed: 0 additions & 2 deletions
This file was deleted.

pyproject.toml

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
[build-system]
2+
requires = ['setuptools', 'setuptools-scm']
3+
build-backend = 'setuptools.build_meta'
4+
5+
[project]
6+
name = 'CryptoParser'
7+
version = '0.12.6'
8+
description = 'An analysis oriented security protocol parser and generator'
9+
authors = [
10+
{name = 'Szilárd Pfeiffer', email = 'coroner@pfeifferszilard.hu'}
11+
]
12+
maintainers = [
13+
{name = 'Szilárd Pfeiffer', email = 'coroner@pfeifferszilard.hu'}
14+
]
15+
classifiers=[
16+
'Development Status :: 4 - Beta',
17+
'Environment :: Console',
18+
'Framework :: tox',
19+
'Intended Audience :: Information Technology',
20+
'Intended Audience :: Science/Research',
21+
'Intended Audience :: System Administrators',
22+
'License :: OSI Approved :: Mozilla Public License 2.0 (MPL 2.0)',
23+
'Natural Language :: English',
24+
'Operating System :: MacOS',
25+
'Operating System :: Microsoft :: Windows',
26+
'Operating System :: POSIX',
27+
'Programming Language :: Python :: 3.9',
28+
'Programming Language :: Python :: 3.10',
29+
'Programming Language :: Python :: 3.11',
30+
'Programming Language :: Python :: 3.12',
31+
'Programming Language :: Python :: 3.13',
32+
'Programming Language :: Python :: Implementation :: CPython',
33+
'Programming Language :: Python :: Implementation :: PyPy',
34+
'Programming Language :: Python',
35+
'Topic :: Internet',
36+
'Topic :: Security',
37+
'Topic :: Security :: Cryptography',
38+
'Topic :: Software Development :: Libraries :: Python Modules',
39+
'Topic :: Software Development :: Testing :: Traffic Generation',
40+
'Topic :: Software Development :: Testing',
41+
]
42+
43+
keywords=['ssl', 'tls', 'gost', 'ja3', 'ldap', 'rdp', 'ssh', 'hsts', 'dns']
44+
readme = {file = 'README.rst', content-type = 'text/x-rst'}
45+
license = {text = 'MPL-2.0'}
46+
47+
dependencies = [
48+
'asn1crypto',
49+
'attrs',
50+
'cryptodatahub==0.12.6',
51+
'python-dateutil',
52+
'urllib3',
53+
]
54+
55+
[project.optional-dependencies]
56+
tests = [
57+
'pyfakefs',
58+
]
59+
docs = [
60+
'sphinx',
61+
'sphinx-sitemap',
62+
]
63+
64+
[project.urls]
65+
Homepage = 'https://gitlab.com/coroner/cryptoparser'
66+
Changelog = 'https://cryptoparser.readthedocs.io/en/latest/changelog'
67+
Documentation = 'https://cryptoparser.readthedocs.io/en/latest/'
68+
Issues = 'https://gitlab.com/coroner/cryptoparser/-/issues'
69+
Source = 'https://gitlab.com/coroner/cryptoparser'
70+
71+
[tool.variables]
72+
technical_name = 'cryptoparser'
73+
74+
[tool.setuptools]
75+
license-files = ['LICENSE.txt']
76+
77+
[tool.setuptools.packages.find]
78+
exclude = ['submodules']
79+
80+
[tool.tox]
81+
envlist = [
82+
'pep8',
83+
'pylint',
84+
'pypy3',
85+
'py39',
86+
'py310',
87+
'py311',
88+
'py312',
89+
'py313',
90+
'pythonrc',
91+
]
92+
93+
[tool.tox.env_run_base]
94+
deps = ['coverage', '.[tests]']
95+
commands = [
96+
['coverage', 'erase'],
97+
['coverage', 'run', '-m', 'unittest', 'discover', '-v'],
98+
['coverage', 'report']
99+
]
100+
101+
[tool.tox.env.pep8]
102+
deps = ['flake8']
103+
commands = [['flake8', 'cryptoparser', 'docs', 'test']]
104+
105+
[tool.tox.env.pylint]
106+
deps = ['pylint', '.[tests]']
107+
commands = [['pylint', '--rcfile', '.pylintrc', 'cryptoparser', 'docs', 'test']]

requirements.txt

Lines changed: 0 additions & 5 deletions
This file was deleted.

setup.py

100644100755
Lines changed: 2 additions & 91 deletions
Original file line numberDiff line numberDiff line change
@@ -1,94 +1,5 @@
11
#!/usr/bin/env python
2-
# -*- coding: utf-8 -*-
32

4-
import codecs
5-
import os
6-
import unittest
3+
import setuptools
74

8-
from setuptools import setup
9-
10-
from cryptoparser import __setup__
11-
12-
13-
this_directory = os.getenv('REQUIREMENTS_DIR', '')
14-
with open(os.path.join(this_directory, 'requirements.txt')) as f:
15-
install_requirements = f.read().splitlines()
16-
this_directory = os.path.abspath(os.path.dirname(__file__))
17-
with codecs.open(os.path.join(this_directory, 'README.rst'), encoding='utf-8') as f:
18-
long_description = f.read()
19-
20-
21-
def test_discover():
22-
test_loader = unittest.TestLoader()
23-
test_suite = test_loader.discover('test', pattern='test_*.py')
24-
return test_suite
25-
26-
27-
setup(
28-
name=__setup__.__title__,
29-
version=__setup__.__version__,
30-
description=__setup__.__description__,
31-
long_description=long_description,
32-
long_description_content_type='text/x-rst',
33-
author=__setup__.__author__,
34-
author_email=__setup__.__author_email__,
35-
maintainer=__setup__.__author__,
36-
maintainer_email=__setup__.__author_email__,
37-
license=__setup__.__license__,
38-
license_files=['LICENSE.txt', ],
39-
project_urls={
40-
'Homepage': __setup__.__url__,
41-
'Changelog': 'https://' + __setup__.__technical_name__ + '.readthedocs.io/en/latest/changelog',
42-
'Documentation': 'https://' + __setup__.__technical_name__ + '.readthedocs.io/en/latest/',
43-
'Issues': __setup__.__url__ + '/-/issues',
44-
'Source': __setup__.__url__,
45-
},
46-
keywords='ssl tls gost ja3 ldap rdp ssh hsts dns',
47-
48-
install_requires=install_requirements,
49-
extras_require={
50-
"test": ["coverage", ],
51-
"pep8": ["flake8", ],
52-
"pylint": ["pylint", ],
53-
},
54-
55-
packages=[
56-
'cryptoparser',
57-
'cryptoparser.common',
58-
'cryptoparser.dnsrec',
59-
'cryptoparser.httpx',
60-
'cryptoparser.ssh',
61-
'cryptoparser.tls',
62-
],
63-
64-
test_suite='setup.test_discover',
65-
66-
classifiers=[
67-
'Development Status :: 4 - Beta',
68-
'Environment :: Console',
69-
'Framework :: tox',
70-
'Intended Audience :: Developers',
71-
'Intended Audience :: Information Technology',
72-
'Intended Audience :: Science/Research',
73-
'Intended Audience :: System Administrators',
74-
'License :: OSI Approved :: Mozilla Public License 2.0 (MPL 2.0)',
75-
'Natural Language :: English',
76-
'Operating System :: MacOS',
77-
'Operating System :: Microsoft :: Windows',
78-
'Operating System :: POSIX',
79-
'Programming Language :: Python :: 3.9',
80-
'Programming Language :: Python :: 3.10',
81-
'Programming Language :: Python :: 3.11',
82-
'Programming Language :: Python :: 3.12',
83-
'Programming Language :: Python :: 3.13',
84-
'Programming Language :: Python :: Implementation :: CPython',
85-
'Programming Language :: Python :: Implementation :: PyPy',
86-
'Programming Language :: Python',
87-
'Topic :: Internet',
88-
'Topic :: Security',
89-
'Topic :: Security :: Cryptography',
90-
'Topic :: Software Development :: Libraries :: Python Modules',
91-
'Topic :: Software Development :: Testing :: Traffic Generation',
92-
'Topic :: Software Development :: Testing',
93-
],
94-
)
5+
setuptools.setup()

submodules/cryptodatahub

Submodule cryptodatahub updated from 5fe37d4 to 075ef48

tox.ini

Lines changed: 0 additions & 38 deletions
This file was deleted.

0 commit comments

Comments
 (0)