Quick question: Where should one be managing the ...
# questions
a
Quick question: Where should one be managing the version number of a kedro project?
project_version
in
pyproject.toml
seems to correspond to the version of Kedro, not the actual project at hand. Is the package version in
src/setup.py
the right place, or is that being controlled by some higher level process?
a
The
pyproject.toml
version should correspond to your project template’s version (i.e. the kedro version when you did
kedro new
). The one in requirements.txt (which goes to setup.py) should correspond to the version of kedro you have installed as a python dependency (like
pip install kedro
) used when you do
kedro run
etc. Very often these will be the same, but it’s also common to e.g. start your project with
0.18.0
and then
pip install -U kedro
when new versions come out since they will have new bug fixes, features, etc. which in general don’t need a change to your project template. Anything in the
0.18.x
line of kedro releases will be non-breaking, so compatible with a project with any other
0.18.x
template. Hence the recommended pattern would be to specify e.g.
kedro~=0.18.0
in your requirements file so you can take advantage of the new
0.18.x
features without it trying to upgrade to
0.19.0
which will not be backwards compatible.
I feel like that was a very convoluted explanation so just say if it doesn’t make sense… We should document this properly somewhere because I don’t think it’s explained anywhere.
a
Does that mean I should/could use project_version in pyproject.toml to manage my project's version?
(so long as kedro version is pinned in reqs?)
n
@Andrew Mackay
src/setup.py
is the right place to manage your own project’s version
a
Should setup.py just dynamically read
__init__.py
as described here ?
a
Hmm yes, I would indeed expect setup.py to dynamically read in
__version__
as set in
__init__.py
. I’m not sure why it doesn’t seem to do so currently, i.e. we have
version="0.1"
manually set.
Just to clarify though, that is your project’s version and is only really relevant if you’re running
kedro package
and trying to distribute your project. The vast majority of people will never change that
version
(or the kedro project template version in
pyproject.toml
).
Basically there’s several versions floating around… 1. Your installed
kedro
version, as in
kedro -V
or
pip show kedro
2. The version of the kedro template that your project was started with - specified in
pyproject.toml
3. Your project version - only relevant for packaging purposes. Specified in
__version__
in
__init__.py
and in
version
in
setup.py
. Not sure why this seems to be duplicated, probably a mistake 4. (optional) pipeline versions, specified in
__init__.py
within a pipeline folder e.g.
src/pipelines/data_engineering/__init__.py
. This enables you to version each pipeline independently, which is rarely done but useful if you need pull/push/distribute/manage multiple pipelines
👍 2