Skip to content

Commit c6aaa05

Browse files
committed
Bump to 4.2.2: add validate-bump CI and refresh post-UV docs
- Add validate-bump job to push workflow, backed by scripts/validate_bump.sh, enforcing version bumps (and CHANGELOG entries for minor/major) whenever src/, pyproject.toml or uv.lock change - Bump version to 4.2.2 and add matching CHANGELOG entry - Rewrite docs/source/contributing.rst for the UV era: drop pip/flake8/mypy.ini/requirements.txt references, switch to uv sync / uv run ruff / uv run mypy, update supported Python range to 3.10-3.13, add a top-level Quick start block and a Build documentation section that documents the pandoc system prerequisite and the required cd docs/ step - Update docs/source/getting_started.rst to state Python 3.10+ and show uv sync install-from-source - Fix Sphinx build: drop the stale fklearn.version autodoc entry from docs/source/api/fklearn.rst (the version submodule was removed in the UV migration; __version__ now comes from importlib.metadata) and set language = "en" in docs/source/conf.py to silence the Sphinx >=5 warning
1 parent e3c70c3 commit c6aaa05

9 files changed

Lines changed: 243 additions & 61 deletions

File tree

.github/workflows/push.yaml

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,16 @@ jobs:
2222
fi
2323
uv lock --check
2424
25+
validate-bump:
26+
runs-on: ubuntu-24.04
27+
steps:
28+
- uses: actions/checkout@v6
29+
with:
30+
fetch-depth: 0
31+
- uses: astral-sh/setup-uv@v7
32+
- name: Validate version bump and CHANGELOG
33+
run: bash scripts/validate_bump.sh
34+
2535
linter:
2636
runs-on: ubuntu-24.04
2737
steps:
@@ -94,8 +104,3 @@ jobs:
94104
run: |
95105
cd docs/
96106
uv run make html
97-
98-
# ─── Version bump check (from python-library-pr-check-version-uv-v1) ───
99-
# TODO: Implement validate-bump job.
100-
# The old push.yaml did not have this check.
101-
# See validate_bump_uv.sh in cicd-images/nu-python-builder for reference.

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# Changelog
22

3+
## [4.2.2] - 2026-04-24
4+
- **Internal**
5+
- CI: add `validate-bump` job to the `push` workflow, backed by `scripts/validate_bump.sh`, so PRs that modify `src/`, `pyproject.toml` or `uv.lock` must bump the version (and, for non-patch bumps, update the CHANGELOG).
6+
- **Documentation**
7+
- Update `docs/source/contributing.rst` to reflect the UV migration: drop `pip install -e .[devel]`, `flake8`, `mypy.ini` and `requirements.txt` references; replace with `uv sync`, `uv run ruff check/format` and `uv run mypy` instructions; update supported Python range to 3.10–3.13. Add a top-level *Quick start* block and a clearer *Build documentation* section that documents the `pandoc` system requirement (needed by `nbsphinx`) and the required `cd docs/` step.
8+
- Update `docs/source/getting_started.rst` to state Python 3.10+ (was 3.8+) and show UV-based install-from-source.
9+
- Fix Sphinx docs build: drop the stale `fklearn.version` autodoc entry from `docs/source/api/fklearn.rst` (the `version` submodule was removed in the UV migration — `__version__` now comes from `importlib.metadata`), and set `language = "en"` in `docs/source/conf.py` to silence the Sphinx ≥5 `language = None` warning.
10+
311
## [4.2.1] - 2026-04-22
412
- **Enhancement**
513
- Add `valid_dfs` and `callbacks` parameters to `lgbm_regression_learner` for early-stopping and custom LightGBM callback support.

docs/source/api/fklearn.rst

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,6 @@ fklearn.common\_docstrings module
2626
:undoc-members:
2727
:show-inheritance:
2828

29-
fklearn.version module
30-
----------------------
31-
32-
.. automodule:: fklearn.version
33-
:members:
34-
:undoc-members:
35-
:show-inheritance:
36-
3729

3830
Module contents
3931
---------------

docs/source/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@
6868
#
6969
# This is also used if you do content translation via gettext catalogs.
7070
# Usually you set "language" from the command line for these cases.
71-
language = None
71+
language = "en"
7272

7373
# List of patterns, relative to source directory, that match files and
7474
# directories to ignore when looking for source files.

docs/source/contributing.rst

Lines changed: 65 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -47,34 +47,39 @@ This will create a folder called ``fklearn`` and will connect to the upstream(ma
4747
Development environment
4848
-----------------------
4949

50-
We recommend you to create a virtual environment before starting to work with the code, after that you can ensure that everything is working fine by running all tests locally before start writing any new code.
50+
fklearn uses `uv <https://docs.astral.sh/uv/>`_ for dependency and virtual-environment management.
51+
``uv sync`` creates an isolated ``.venv`` in the project root, installs all locked
52+
dependencies, and installs fklearn itself in editable mode — so changes under
53+
``src/`` are picked up without reinstalling.
5154

52-
Creating the virtual environment
53-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
55+
Install uv
56+
~~~~~~~~~~
57+
58+
Follow the `uv installation guide <https://docs.astral.sh/uv/getting-started/installation/>`_,
59+
for example:
5460

5561
.. code-block:: bash
5662
57-
# Use an ENV_DIR of you choice. We are using ~/venvs
58-
python3 -m venv ~/venvs/fklearn-dev
59-
source ~/venvs/fklearn-dev/activate
63+
curl -LsSf https://astral.sh/uv/install.sh | sh
6064
61-
Install the requirements
65+
Install the dependencies
6266
~~~~~~~~~~~~~~~~~~~~~~~~
6367

64-
This command will install all the test dependencies. To install the package you can follow the `installation instructions <https://fklearn.readthedocs.io/en/latest/getting_started.html#installation>`_.
68+
From the repository root:
6569

6670
.. code-block:: bash
6771
68-
python3 -m pip install -qe .[devel]
72+
uv sync # core deps + dev group (pytest, ruff, mypy, hypothesis)
73+
uv sync --all-extras # also installs lgbm / xgboost / catboost / tools / demos / docs
6974
7075
First testing
7176
~~~~~~~~~~~~~
7277

73-
The following command should run all tests, if every test pass, you should be ready to start developing new stuff
78+
The following command should run all tests. If every test passes, you should be ready to start developing new stuff:
7479

7580
.. code-block:: bash
7681
77-
python3 -m pytest tests/
82+
uv run pytest tests/
7883
7984
Creating a development branch
8085
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -106,28 +111,26 @@ In this session we'll guide you on how to contribute with the code. This is a gu
106111
Code standards
107112
--------------
108113

109-
This project is compatible only with python 3.8 to 3.11 and follows the `pep8 style <https://www.python.org/dev/peps/pep-0008/>`_
110-
And we use this `import formatting <https://google.github.io/styleguide/pyguide.html?showone=Imports_formatting#313-imports-formatting>`_
114+
This project is compatible with Python 3.10 to 3.13 and follows the
115+
`pep8 style <https://www.python.org/dev/peps/pep-0008/>`_, and we use this
116+
`import formatting <https://google.github.io/styleguide/pyguide.html?showone=Imports_formatting#313-imports-formatting>`_.
111117

112-
In order to check if your code is following our codestyle, you can run from the root directory of the repo the next commands:
118+
We use `ruff <https://docs.astral.sh/ruff/>`_ for both linting and formatting, with
119+
configuration living under ``[tool.ruff]`` in ``pyproject.toml``. From the root
120+
directory of the repo you can run:
113121

114122
.. code-block:: bash
115123
116-
python3 -m pip install -q flake8
117-
python3 -m flake8 \
118-
--ignore=E731,W503 \
119-
--filename=\*.py \
120-
--exclude=__init__.py \
121-
--show-source \
122-
--statistics \
123-
--max-line-length=120 \
124-
src/ tests/
124+
uv run ruff check src/ tests/ # lint
125+
uv run ruff format --check src/ tests/ # check formatting (CI mode)
126+
uv run ruff format src/ tests/ # apply formatting
125127
126-
We also use mypy for type checking, which you can run with:
128+
We also use mypy for type checking (configuration under ``[tool.mypy]`` in
129+
``pyproject.toml``):
127130

128131
.. code-block:: bash
129132
130-
python3 -m mypy src tests --config mypy.ini
133+
uv run mypy src/ tests/
131134
132135
Run tests
133136
---------
@@ -137,13 +140,13 @@ After you finish your feature development or bug fix, you should run your tests,
137140

138141
.. code-block:: bash
139142
140-
python3 -m pytest tests/
143+
uv run pytest tests/
141144
142145
Or if you want to run only one test:
143146

144147
.. code-block:: bash
145148
146-
python3 -m pytest tests/test-file-name.py::test_method_name
149+
uv run pytest tests/test-file-name.py::test_method_name
147150
148151
149152
You must write tests for every feature **always**, you can look at the other tests to have a better idea how we implement them.
@@ -153,7 +156,7 @@ Document your code
153156
------------------
154157

155158
All methods should have type annotations, this allow us to know what that method expect as parameters, and what is the expected output.
156-
You can learn more about it in `typing docs <https://docs.python.org/3.8/library/typing.html>`_
159+
You can learn more about it in `typing docs <https://docs.python.org/3/library/typing.html>`_
157160

158161
To document your code you should add docstrings, all methods with docstring will appear in this documentation's api file.
159162
If you created a new file, you may need to add it to the ``api.rst`` following the structure
@@ -213,13 +216,32 @@ When you make changes in the docs, please make sure, we still be able to build i
213216
Build documentation
214217
-------------------
215218

216-
From ``docs/`` folder, install `requirements.txt` and run
219+
Docs dependencies are declared as the ``docs`` extra in ``pyproject.toml``. Building
220+
also requires `pandoc <https://pandoc.org/installing.html>`_ on your system for the
221+
notebook-based examples (``nbsphinx``) — ``uv`` cannot provide this.
222+
223+
On macOS you can get it (together with ``libomp``) via the repo's ``Brewfile``:
224+
225+
.. code-block:: bash
226+
227+
brew bundle
228+
229+
On Debian/Ubuntu:
217230

218231
.. code-block:: bash
219232
220-
make html
233+
sudo apt-get install -y pandoc
221234
222-
This command will build the documentation inside ``docs/build/html`` and you can check locally how it looks, and if everything worked.
235+
Then install the docs extra and build the HTML. The ``Makefile`` lives in ``docs/``,
236+
so you must ``cd`` there first:
237+
238+
.. code-block:: bash
239+
240+
uv sync --extra docs
241+
cd docs/
242+
uv run make html
243+
244+
This will build the documentation inside ``docs/build/html`` where you can check locally how it looks.
223245

224246
Send your changes to Fklearn repo
225247
=================================
@@ -295,16 +317,20 @@ Use Semantic versioning to set library versions, more info: `semver.org <https:/
295317

296318
(from semver.org summary)
297319

298-
You don't need to set the version in your PR, we'll take care of this when we decide to release a new version.
299-
Today the process is:
320+
If your PR changes code under ``src/``, ``pyproject.toml`` or ``uv.lock``, you are expected to bump
321+
the ``version`` in ``pyproject.toml`` and — for minor/major bumps — add a matching section to
322+
``CHANGELOG.md``. This is enforced in CI by the ``validate-bump`` job
323+
(``scripts/validate_bump.sh``), which follows semver rules:
324+
325+
- Patch bump (``X.Y.Z`` → ``X.Y.Z+1``) for backwards-compatible bug fixes.
326+
- Minor bump (``X.Y.Z`` → ``X.Y+1.0``) for backwards-compatible new functionality (requires a CHANGELOG entry).
327+
- Major bump (``X.Y.Z`` → ``X+1.0.0``) for incompatible API changes (requires a CHANGELOG entry).
300328

301-
- Create a new ``milestone`` X.Y.Z (maintainers only)
302-
- Some PR/issues are attributed to this new milestone
303-
- Merge all the related PRs (maintainers only)
304-
- Create a new PR: ``Bump package to X.Y.Z`` This PR update the version and the change log (maintainers only)
305-
- Create a tag ``X.Y.Z`` (maintainers only)
329+
Release process (maintainers only):
306330

307-
This last step will trigger the CI to build the package and send the version to pypi
331+
- Create a new ``milestone`` X.Y.Z
332+
- Attribute PRs/issues to that milestone and merge them
333+
- Once the target set of PRs is merged, cut a release by creating a tag ``X.Y.Z``
308334

309335
When we add new functionality, the past version will be moved to another branch. For example, if we're at version ``1.13.7`` and a new functionality is implemented,
310336
we create a new branch ``1.13.x``, and protect it(this way we can't delete it), the new code is merged to master branch, and them we create the tag ``1.14.0``

docs/source/getting_started.rst

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,25 +5,29 @@ Getting started
55
Installation
66
------------
77

8-
The fklearn library is compatible only with Python 3.8+.
8+
The fklearn library is compatible only with Python 3.10+.
99
In order to install it using pip, run:
1010

1111
.. code-block:: bash
1212
1313
pip install fklearn
1414
15-
You can also install it from the source:
15+
You can also install it from the source. fklearn uses
16+
`uv <https://docs.astral.sh/uv/>`_ for dependency management:
1617

1718
.. code-block:: bash
1819
1920
# clone the repository
2021
git clone -b master https://github.com/nubank/fklearn.git --depth=1
21-
22+
2223
# open the folder
2324
cd fklearn
24-
25-
# install the dependencies
26-
pip install -e .
25+
26+
# install the dependencies (creates .venv, installs fklearn editable)
27+
uv sync
28+
29+
# or, with all optional extras (lgbm, xgboost, catboost, tools, demos, docs):
30+
uv sync --all-extras
2731
2832
2933
If you are a macOS user, you may need to install some dependencies in order to use LGBM. If you have brew installed,

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "fklearn"
7-
version = "4.2.1"
7+
version = "4.2.2"
88
description = "Functional machine learning"
99
readme = "README.md"
1010
license = "Apache-2.0"

0 commit comments

Comments
 (0)