Repository Configuration
CodeSee works hard to autodetect your application configuration so it can discover connections across your codebase. But, if your maps aren't displaying everything perfectly out-of-the-box, you can provide a little guidance through the .codesee.json
configuration file.
Python
Python monorepos
If you have a python monorepo, you can help CodeSee find all your packages/applications and find connections within and between them by adding a .codesee.json
in the root of your repo.
For a monorepo, you should list all your projects, and for each one, tell CodeSee about any sys.path
or PYTHONPATH
manipulation. See details below.
Listing your projects
In addition, CodeSee will only autodetect packages that have a setup.py
, setup.cfg
or pyproject.toml
file in their directory. If your monorepo has any packages, applications, or other-things-that-you-build (projects) that do not have one of those files, or if you're not sure, then you should also add the projects
option with a listing for each project.
If you are manipulating the PYTHONPATH
or sys.path
in any project, please also add a pythonpath
array:
{
"python": {
"monorepo": {
"projects": {
"path/to/project1": {},
"path/to/project2": { pythonpath: ["proj"] },
"path/to/project3": { pythonpath: ["app"] },
...
}
}
}
}
Note: The pythonpath
array contains paths relative to the project's directory. So in the example above, project2 will have path/to/project2/proj
added to its PYTHONPATH
.
Note: If you leave out the pythonpath
array, but you have a src
directory, CodeSee will guess by adding src
to your PYTHONPATH.
Improving dependency detection
In rare circumstances, CodeSee may find a link in a Python monorepo that isn't correct. This will happen when you are importing an external package, but CodeSee thinks it's a local module. CodeSee examines any requirements.txt
files in your repo to know which external packages are being used. But, if there are any not listed in a requirements.txt, just let CodeSee know:
Use the name from the import statement, not the name of the package. So "yaml" not "pyyaml".
{
"python": {
"monorepo": {
"externalPackageNames": [
"yaml",
"simplejson"
]
}
}
}
Python, but not a monorepo
If you are not seeing all the lines you'd expect in your map of a python application (Codebase Map and/or Review Map), you may need to configure a .codesee.json
file.
Some Python applications manipulate sys.path
. For example, your application may append a few paths to sys.path
to make your imports more concise:
sys.path.append('/src/my-repo/path/to/files');
sys.path.append('/src/my-repo/another/path');
Or, you might modify the PYTHONPATH
environment variable:
export PYTHONPATH='/src/my-repo/path/to/files:/src/my-repo/another/path:$PYTHONPATH'
This makes it difficult for CodeSee to find the connections between your files — but there's an easy fix!
Add a .codesee.json
file to the root of your project with those same paths, but now relative to the root of the project:
{
"python": {
"sys.path.append": [
"./path/to/files",
"./another/path"
]
}
}
Troubleshooting
The Troubleshooting section of this site has advice for:
And you can always reach out to us for support either:
- email us at [email protected]
- use the intercom bubble in the lower-right of the CodeSee site
Updated 12 months ago