Skip to content

Commit

Permalink
Add a section about why this exists.
Browse files Browse the repository at this point in the history
  • Loading branch information
vengroff authored Feb 15, 2024
1 parent 0968e00 commit b4a0038
Showing 1 changed file with 50 additions and 0 deletions.
50 changes: 50 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,54 @@ It was built with packages that are maintained with
mind but it works in a more limited way with other
approaches.

What is the Problem?
--------------------

As developers, we would like to have a single source or truth for
the version number of packages we maintain. In projects that use
[poetry](https://github.com/python-poetry/poetry),
this is a `pyproject.toml` file, which typically begins
something like

```
[tool.poetry]
name = "mypackage"
version = "1.2.3"
...
```

Once I have put a version number there, I would like the
code

```python
import mypackage

myppackage.version
```

to return the version number from `pyproject.toml`.

The issue is that project versions go through different
lifecycle phases. A package that has been built and published
on [pypi](https://www.pypi.org) has the version number that
started in `pyproject.toml` when it was built encoded elsewhere.
But a newer version that I am actively developing, testing, or debugging
before release only has the `pyproject.toml` version.

`usingversion` knows about this, and knows how to find the version
in either of those places in different scenarios. It makes
`mypackage.version` always work no matter how I am using or developing
or testing.

### What about the `+`

As an added measure, to reduce confusion between development and
production environments, when the version number comes straight
from `pyproject.toml` in a development environment, a `+` is
appended. This indicates that the source could have been modified
in the development environment. So instead of `"1.2.3"`, the
version will be reported as `"1.2.3+"`.

For Package Maintainers
-----------------------

Expand Down Expand Up @@ -48,6 +96,8 @@ For End Users
-------------

There's really nothing all that exciting to do.
You might not even know or care that the developer
of a package you depend on chose to use `usingversion`.
If a package `somepackage` that you depend on uses
`packageversion` then you can check the version with

Expand Down

0 comments on commit b4a0038

Please sign in to comment.