-
Notifications
You must be signed in to change notification settings - Fork 53
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improved setup.cfg integration #562
Comments
Hello, @Codeberg-AsGithubAlternative-buhtz, Thanks for the proposition. I think it wouldn’t be too hard to add support for the “attr” keyword in the config field. Using setuptools to parse the config file is not an option, so we’ll have to do the processing manually if we’re going to support this. |
Or maybe you see an alternative mechanism to get meta data like version number from a centralized location ( |
There is no way currently to do this kind of maneuver. Usually people use a wrapper to call pydoctor, either with tox, makefile, or something else. So having support for |
Currently i am using a "simple" script that depends on a project with "modern" #!/usr/bin/env python3
"""Generate the documentation with pydoctor.
The applications metadata is extracted from the project itself and given to
pydoctor via commandline arguments. The script assume a project folder in
src-layout and need to run in the docs folder."""
import pathlib
import importlib
DOC_FOLDER = 'docs'
# Make sure the script runs inside the docs folder.
cwd = pathlib.Path.cwd()
if cwd.name != DOC_FOLDER:
raise RuntimeError(
f'The script need to run inside the {DOC_FOLDER} folder!')
# Get name of project and name of package
pkg_name = cwd.parent / 'src'
pkg_name = list(filter(lambda p: 'egg-info' not in str(p), pkg_name.glob('*')))
if len(pkg_name) != 1:
raise ValueError(f'Something unexpected in src-folder. {pkg_name}')
pkg_path = pkg_name[0]
pkg_name = pkg_path.name
prj_name = cwd.parent.name
# get more project meta-data
pkg = importlib.import_module(pkg_name)
# Build commandline arguments
args = [
f'--project-name={pkg.__name__}',
f'--project-version={pkg.__version__}',
f'--project-url={pkg.__website__}',
f'--html-viewsource-base={pkg.__repository_url__}',
'--docformat=epytext',
'--make-html',
f'--html-output=html',
f'--project-base-dir=..',
f'{pkg_path}'
]
# Run pydoctor
import pydoctor
import pydoctor.driver
pydoctor.driver.main(args) |
I don't know in which PEP or somewhere else this is specified but it works well except with pydoctor. It would be great if pydoctor would be enhanced that way when using setup.cfg for its configuration.
The
__init__.py
of my project specifies all project related meta data like thisBecause of that I can use variables/placeholders in the
setup.cfg
without repeating the valuesBut it doesn't work for pydoctor section in
setup.cfg
The value for

project-name
is not translatedThe text was updated successfully, but these errors were encountered: