Skip to content

Commit cb43988

Browse files
committed
move configuration out of setup.py
1 parent e42539e commit cb43988

12 files changed

+77
-84
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,4 @@ nbsafety/resources/nbextension/index.js.map
2222
coverage.xml
2323
htmlcov/**
2424
.hypothesis
25+
.version

HISTORY.rst

+4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
History
22
=======
33

4+
0.0.14 (2022-02-01)
5+
------------------
6+
* Move configuration out of setup.py;
7+
48
0.0.13 (2022-01-31)
59
------------------
610
* Default to all tracers in stack for package-level tracing enabled / disabled context managers;
File renamed without changes.
File renamed without changes.

pyccolo/__init__.py

+1-5
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,7 @@
3030
skip_when_tracing_disabled,
3131
)
3232
from pyccolo.utils import multi_context, resolve_tracer
33-
from pyccolo._version import get_versions
34-
35-
36-
__version__ = get_versions()["version"]
37-
del get_versions
33+
from pyccolo.version import __version__
3834

3935

4036
event = TraceEvent

pyccolo/__main__.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import sys
88
from pathlib import Path
99
from runpy import run_module
10+
from typing import List, Type
1011

1112
import pyccolo as pyc
1213

@@ -45,7 +46,7 @@ def validate_args(args: argparse.Namespace) -> None:
4546

4647
def run(args: argparse.Namespace) -> None:
4748
validate_args(args)
48-
tracers = []
49+
tracers: List[Type[pyc.BaseTracer]] = []
4950
for tracer_ref in args.tracer:
5051
tracers.append(pyc.resolve_tracer(tracer_ref))
5152
if args.module is not None:

pyproject.toml

+7
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
[build-system]
2+
requires = [
3+
"setuptools >= 48",
4+
"wheel >= 0.30.0",
5+
]
6+
build-backend = 'setuptools.build_meta'
7+
18
[tool.black]
29
line-length = 88
310
target-version = ['py39']

requirements-dev.txt

-11
This file was deleted.

requirements.txt

-2
This file was deleted.

scripts/bump-version.py

+6-4
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,14 @@
1010
def main(*_):
1111
components = list(make_version_tuple())
1212
components[-1] += 1
13-
version = '.'.join(str(c) for c in components)
14-
subprocess.check_output(['git', 'tag', version])
13+
version = ".".join(str(c) for c in components)
14+
subprocess.check_output(["git", "tag", version])
15+
with open(".version", "w") as f:
16+
f.write(version)
1517
return 0
1618

1719

18-
if __name__ == '__main__':
19-
parser = argparse.ArgumentParser(description='Bump version and create git tag.')
20+
if __name__ == "__main__":
21+
parser = argparse.ArgumentParser(description="Bump version, create git tag, and write file.")
2022
args = parser.parse_args()
2123
sys.exit(main(args))

setup.cfg

+53-4
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,65 @@ tag_prefix =
1111
parentdir_prefix = pyccolo-
1212

1313
[metadata]
14-
description-file = README.md
14+
name = pyccolo
15+
version = file: .version
16+
history = file: docs/HISTORY.rst
17+
description = Declarative instrumentation for Python
18+
long_description = file: README.md
19+
long_description_content_type = text/markdown; charset=UTF-8
20+
url = https://github.com/smacke/pyccolo
21+
author = Stephen Macke
22+
author_email = [email protected]
23+
license = BSD-3-Clause
24+
license_file = docs/LICENSE.txt
25+
classifiers =
26+
Development Status :: 3 - Alpha
27+
Intended Audience :: Developers
28+
License :: OSI Approved :: BSD License
29+
Natural Language :: English
30+
Programming Language :: Python :: 3.6
31+
Programming Language :: Python :: 3.7
32+
Programming Language :: Python :: 3.8
33+
Programming Language :: Python :: 3.9
34+
Programming Language :: Python :: 3.10
35+
36+
[options]
37+
zip_safe = False
38+
packages =
39+
pyccolo
40+
platforms = any
41+
python_requires = >= 3.6
42+
install_requires =
43+
traitlets
44+
typing_extensions
45+
46+
[bdist_wheel]
47+
universal = 1
48+
49+
[options.entry_points]
50+
console_scripts =
51+
pyc = pyccolo.__main__:main
52+
pyccolo = pyccolo.__main__:main
53+
54+
[options.extras_require]
55+
dev =
56+
black
57+
flake8
58+
flake8-no-implicit-concat
59+
hypothesis
60+
mypy
61+
numpy
62+
py
63+
pytest
64+
pytest-cov
65+
twine
66+
versioneer
1567

1668
[flake8]
1769
max-line-length = 100
1870
max-complexity = 15
1971
exclude = .git,__pycache__,old,build,dist,docs,versioneer.py,pyccolo/_version.py
2072

21-
[bdist_wheel]
22-
universal = 1
23-
2473
[tool:pytest]
2574
filterwarnings = ignore::DeprecationWarning
2675

setup.py

+3-57
Original file line numberDiff line numberDiff line change
@@ -1,61 +1,7 @@
11
#!/usr/bin/env python
22
# -*- coding: utf-8 -*-
3-
from setuptools import setup, find_packages
3+
import setuptools
44

5-
import versioneer
65

7-
pkg_name = 'pyccolo'
8-
9-
10-
def read_file(fname):
11-
with open(fname, 'r', encoding='utf8') as f:
12-
return f.read()
13-
14-
15-
history = read_file('HISTORY.rst')
16-
requirements = read_file('requirements.txt').strip().split()
17-
18-
setup(
19-
name=pkg_name,
20-
version=versioneer.get_version(),
21-
cmdclass=versioneer.get_cmdclass(),
22-
author='Stephen Macke',
23-
author_email='[email protected]',
24-
description='Embedded instrumentation for Python.',
25-
long_description=read_file('README.md'),
26-
long_description_content_type='text/markdown',
27-
url='https://github.com/smacke/pyccolo',
28-
packages=find_packages(exclude=[
29-
'binder',
30-
'docs',
31-
'scratchspace',
32-
'notebooks',
33-
'img',
34-
'test',
35-
'scripts',
36-
'versioneer.py',
37-
]),
38-
install_requires=requirements,
39-
entry_points={
40-
'console_scripts': [
41-
'pyc = pyccolo.__main__:main',
42-
'pyccolo = pyccolo.__main__:main',
43-
],
44-
},
45-
license='BSD-3-Clause',
46-
zip_safe=False,
47-
classifiers=[
48-
'Development Status :: 3 - Alpha',
49-
'Intended Audience :: Developers',
50-
'License :: OSI Approved :: BSD License',
51-
'Natural Language :: English',
52-
'Programming Language :: Python :: 3.6',
53-
'Programming Language :: Python :: 3.7',
54-
'Programming Language :: Python :: 3.8',
55-
'Programming Language :: Python :: 3.9',
56-
'Programming Language :: Python :: 3.10',
57-
],
58-
)
59-
60-
# python setup.py sdist bdist_wheel --universal
61-
# twine upload dist/*
6+
if __name__ == "__main__":
7+
setuptools.setup()

0 commit comments

Comments
 (0)