-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Simplify single source #1580
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
Merged
Merged
Simplify single source #1580
Changes from 45 commits
Commits
Show all changes
50 commits
Select commit
Hold shift + click to select a range
342f9eb
updated single_source_version with a much simpler page -- essentially
ChrisBarker-NOAA ce0d4bc
Update source/single_source_version.rst
ChrisBarker-NOAA 6cd1b9b
Update source/single_source_version.rst
ChrisBarker-NOAA dbac235
Added links to build tools
ChrisBarker-NOAA 438198f
swap prefer for require
ChrisBarker-NOAA 51e2c23
replace text about __version__
ChrisBarker-NOAA 6d4aeb3
Update source/single_source_version.rst
ChrisBarker-NOAA 49e743d
Update source/single_source_version.rst
ChrisBarker-NOAA 0598c69
Update source/single_source_version.rst
ChrisBarker-NOAA 2a32499
updated the __version__ description
ChrisBarker-NOAA d1cbce9
a few suggestions from the PR discussion
ChrisBarker-NOAA 0fc5aca
Update source/single_source_version.rst
ChrisBarker-NOAA 7d60695
Update source/single_source_version.rst
ChrisBarker-NOAA 28c8bcb
Update source/single_source_version.rst
ChrisBarker-NOAA 00d8645
Update source/single_source_version.rst
ChrisBarker-NOAA 50a588f
Update source/single_source_version.rst
ChrisBarker-NOAA db4e988
minor formatting edit
ChrisBarker-NOAA 83c7f24
Update source/single_source_version.rst
ChrisBarker-NOAA a1df94c
a few more edits from the PR comments, and adding it back to the inde…
ChrisBarker-NOAA ba32cc6
added single_source page back in -- not sure if it's the right section.
ChrisBarker-NOAA 476f916
updated single_source_version with a much simpler page -- essentially
ChrisBarker-NOAA 0512c22
Update source/single_source_version.rst
ChrisBarker-NOAA 892d045
Update source/single_source_version.rst
ChrisBarker-NOAA 6db49ef
Added links to build tools
ChrisBarker-NOAA afa38c4
swap prefer for require
ChrisBarker-NOAA b9bb45d
replace text about __version__
ChrisBarker-NOAA 6359083
Update source/single_source_version.rst
ChrisBarker-NOAA e6b0ed9
Update source/single_source_version.rst
ChrisBarker-NOAA 54906da
Update source/single_source_version.rst
ChrisBarker-NOAA 398b4fb
updated the __version__ description
ChrisBarker-NOAA e7d2369
a few suggestions from the PR discussion
ChrisBarker-NOAA 0ff8c16
Update source/single_source_version.rst
ChrisBarker-NOAA 8529ada
Update source/single_source_version.rst
ChrisBarker-NOAA 840474d
Update source/single_source_version.rst
ChrisBarker-NOAA 61dc0b8
Update source/single_source_version.rst
ChrisBarker-NOAA f932935
Update source/single_source_version.rst
ChrisBarker-NOAA ae2ad09
minor formatting edit
ChrisBarker-NOAA 01f66a9
Update source/single_source_version.rst
ChrisBarker-NOAA 9d353a7
a few more edits from the PR comments, and adding it back to the inde…
ChrisBarker-NOAA 1aae700
added single_source page back in -- not sure if it's the right section.
ChrisBarker-NOAA 6d72810
Merge branch 'simplify_single_source' of https://github.com/ChrisBark…
ChrisBarker-NOAA f130e81
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 0aefb9e
Update source/discussions/single_source_version.rst
ChrisBarker-NOAA 2aee101
Merge branch 'pypa:main' into simplify_single_source
ChrisBarker-NOAA 3b05459
normalized the page file name
ChrisBarker-NOAA c335757
Update source/discussions/single-source-version.rst
ChrisBarker-NOAA b35bd14
Update source/discussions/single-source-version.rst
ChrisBarker-NOAA e0cb805
Update source/discussions/single-source-version.rst
ChrisBarker-NOAA b120a51
Make the single-sourcing discussion label unique
webknjaz 4d7e33a
🇺🇦 Set the last-reviewed date in the single-sourced version discussion
webknjaz File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| .. _`Single sourcing the version`: | ||
|
|
||
| =================================== | ||
| Single-sourcing the Project Version | ||
| =================================== | ||
|
|
||
| :Page Status: Complete | ||
| :Last Reviewed: 2024-?? | ||
webknjaz marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| One of the challenges in building packages is that the version string can be required in multiple places. | ||
|
|
||
| * It needs to be specified when building the package (e.g. in :file:`pyproject.toml`) | ||
| This will make it available in the installed package’s metadata, from where it will be accessible at runtime using ``importlib.metadata.version("distribution_name")``. | ||
|
|
||
| * A package may set a top level ``__version__`` attribute to provide an alternative means of runtime access to the version of the imported package. If this is done, the value of ``__version__`` attribute and that used by the build system to set the distribution's version should be kept in sync in :ref:`the build systems's recommended way <Build system version handling>`. | ||
webknjaz marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| * If the code is in in a version control system (VCS), e.g. Git, the version may appear in a *tag* such as ``v1.2.3``. | ||
|
|
||
| To ensure that version numbers do not get out of sync, it is recommended that there is a single source of truth for the version number. | ||
|
|
||
| In general, the options are: | ||
|
|
||
| 1) If the code is in a version control system (VCS), e.g. Git, then the version can be extracted from the VCS. | ||
|
|
||
| 2) The version can be hard-coded into the :file:`pyproject.toml` file -- and the build system can copy it into other locations it may be required. | ||
|
|
||
| 3) The version string can be hard-coded into the source code -- either in a special purpose file, such as :file:`_version.txt`, or as a attribute in the :file:`__init__.py`, and the build system can extract it at build time. | ||
ChrisBarker-NOAA marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
|
|
||
| Consult your build system's documentation for their recommended method. | ||
|
|
||
| .. _Build system version handling: | ||
|
|
||
| Build System Version Handling | ||
| ----------------------------- | ||
|
|
||
| The following are links to some build system's documentation for handling version strings. | ||
|
|
||
| * `Flit <https://flit.pypa.io/en/stable/>`_ | ||
|
|
||
| * `Hatchling <https://hatch.pypa.io/1.9/version/>`_ | ||
|
|
||
| * `PDM <https://pdm-project.org/en/latest/reference/pep621/#__tabbed_1_2>`_ | ||
|
|
||
| * `Setuptools <https://setuptools.pypa.io/en/latest/userguide/distribution.html#specifying-your-project-s-version>`_ | ||
ChrisBarker-NOAA marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| - `setuptools_scm <https://setuptools-scm.readthedocs.io/en/latest/>`_ | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.