Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 6c60881

Browse files
committed
Python: CG trace: Move code to src/
As recommended in https://blog.ionelmc.ro/2014/05/25/python-packaging/ and following pattern of black and pytest
1 parent 0a0c24f commit 6c60881

9 files changed

Lines changed: 10 additions & 9 deletions

File tree

python/tools/recorded-call-graph-metrics/.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22
cg-trace-example-db/
33

44
# Artifact from building `pip install -e .`
5-
cg_trace.egg-info/
5+
src/cg_trace.egg-info/
66

77
venv/

python/tools/recorded-call-graph-metrics/README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,10 @@ After following setup instructions below, run the `recreate-db.sh` script to cre
4040
"editor.codeActionsOnSave": {
4141
"source.organizeImports": true
4242
}
43-
}
43+
},
44+
"python.autoComplete.extraPaths": [
45+
"src"
46+
]
4447
}
4548
```
4649

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,14 @@
11
from setuptools import find_packages, setup
22

3-
from cg_trace import MIN_PYTHON_VERSION_FORMATTED, __version__
4-
5-
# TODO: There was some benefit of structuring your code as `src/yourpackage/code.py`
6-
# instead of `yourpackage/code.py` concerning imports, but I don't recall the details
3+
# using src/ folder as recommended in: https://blog.ionelmc.ro/2014/05/25/python-packaging/
74

85
setup(
96
name="cg_trace",
10-
version=__version__,
7+
version="0.0.1",
118
description="Call graph tracing",
12-
packages=find_packages(),
9+
packages=find_packages("src"),
10+
package_dir={"": "src"},
1311
install_requires=["lxml"],
1412
entry_points={"console_scripts": ["cg-trace = cg_trace.main:main"]},
15-
python_requires=">={}".format(MIN_PYTHON_VERSION_FORMATTED),
13+
python_requires=">=3.6",
1614
)

python/tools/recorded-call-graph-metrics/cg_trace/__init__.py renamed to python/tools/recorded-call-graph-metrics/src/cg_trace/__init__.py

File renamed without changes.

python/tools/recorded-call-graph-metrics/cg_trace/__main__.py renamed to python/tools/recorded-call-graph-metrics/src/cg_trace/__main__.py

File renamed without changes.

python/tools/recorded-call-graph-metrics/cg_trace/cmdline.py renamed to python/tools/recorded-call-graph-metrics/src/cg_trace/cmdline.py

File renamed without changes.

python/tools/recorded-call-graph-metrics/cg_trace/exporter.py renamed to python/tools/recorded-call-graph-metrics/src/cg_trace/exporter.py

File renamed without changes.

python/tools/recorded-call-graph-metrics/cg_trace/main.py renamed to python/tools/recorded-call-graph-metrics/src/cg_trace/main.py

File renamed without changes.

python/tools/recorded-call-graph-metrics/cg_trace/tracer.py renamed to python/tools/recorded-call-graph-metrics/src/cg_trace/tracer.py

File renamed without changes.

0 commit comments

Comments
 (0)