Skip to content
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

Simply import "version" information from "traitsui.__init__" #1732

Merged
merged 1 commit into from
Jul 20, 2021

Conversation

rahulporuri
Copy link
Contributor

Previously, we manually traversed the file system to extract the version and release information from traitsui._version file. Now, we simply expect traitsui to be installed in the python environment when we try building the docs and we just import version from traitsui.__init__. Note that this PR also removes the release variable in the configuration file.

Note that these changes should fix the broken RtD docs build. Ref https://readthedocs.org/projects/traitsui/builds/14256791/

Checklist

  • Add a news fragment if this PR is news-worthy for end users. (see docs/releases/README.rst)

Previously, we manually traversed the file system to extract the version
and release information from traitsui._version file. Now, we simply
expect traitsui to be installed in the python environment when we try
building the docs and we just import version from traitsui.__init__.

Note that this commit also removes the release variable in the
configuration file

	modified:   docs/source/conf.py
Copy link
Contributor

@aaronayres35 aaronayres35 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes LGTM given your PR description. I am unsure how to test if the readthedocs build gets fixed though.

I built the docs locally and the version is pulled in correctly. eg I see TraitsUI 7.3.0.dev555 User Manual. However, previously it looks like we had intentionally cut off the dev stuff with .split('.', 2)[:2]). When we actually publish the docs though using a released version this won't matter.

Also is this something we will want to do in other ets projects? I notice many of them still follow an approach similar to the old way done here

Comment on lines -59 to -63
version_path = os.path.join(base_path, '..', '..', 'traitsui', '_version.py')
with open(version_path, 'r', encoding='utf8') as fp:
exec(compile(fp.read(), version_path, 'exec'), d)
release = d['version']
version = '.'.join(d['version'].split('.', 2)[:2])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Other ets packages still seem to be following this approach.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah. I need to fix that. I am not sure why we were following this approach - i'll ask first on the internal slack channel and then gut it from ETS projects.

@rahulporuri
Copy link
Contributor Author

rahulporuri commented Jul 20, 2021

I am unsure how to test if the readthedocs build gets fixed though.

I was planning on triggering a new RtD build after merging this PR - and i'm going off the fact that these changes exist in traits-futures where there are no RtD docs build errors.

... previously it looks like we had intentionally cut off the dev stuff with .split('.', 2)[:2]). When we actually publish the docs though using a released version this won't matter.

For read the docs, i think it's actually a good idea to not remove the dev stuff from the version information because RtD automatically builds from the latest commit on the default branch. It would be confusing for RtD docs users if the "dev" didn't show up.

@rahulporuri rahulporuri merged commit 69a5777 into master Jul 20, 2021
@rahulporuri rahulporuri deleted the fix/rtd-docs-build branch July 20, 2021 01:34
@rahulporuri
Copy link
Contributor Author

this PR did in fact fix the RtD build - https://readthedocs.org/projects/traitsui/builds/14278933/

@rahulporuri
Copy link
Contributor Author

Note that the API documentation is broken because RtD doesn't have the custom build step where api docs are generated. We need to take the approach that traits-futures uses to have a single sphinx build step that builds both api docs and normal docs - enthought/traits-futures#348

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants