From 459fe3ce2f7428579e57ba550cac8ebc874f5be7 Mon Sep 17 00:00:00 2001 From: Nathan Date: Thu, 25 Apr 2024 16:52:05 -0400 Subject: [PATCH 1/7] Explain versioning system --- CONTRIBUTING.md | 14 ++++++++++++++ tests/test_versioning.py | 18 ++++++++++++++++++ 2 files changed, 32 insertions(+) create mode 100644 tests/test_versioning.py diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index da89907..7cecbf0 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -25,6 +25,20 @@ $ pip install -e . ``` In development mode, Python uses the files in this directory when you import the package. So you can write a testing app in another folder, and whenever you change some code and rebuild the component here it will update in your testing app. +### Versioning +We follow a strict versioning system aligned with the underlying Ag Grid version, but also reserving the +patch number for updates to the Dash grid. + +Specifically, Dash Ag Grid will always have the same _major_ and _minor_ version number as the Javascript Ag Grid package it is bundling, but it may not always have the same patch number. + +Ag Grid releases new major versions every 6-8 months, and minor versions every 4-6 weeks. Sometimes, Dash Ag Grid may introduce new changes that warrant a minor release according to [semver](https://semver.org/): For example, exposing a functional property of Ag Grid as a declarative property in Dash Ag Grid. In this case, we would wait for a new minor release of Ag Grid and bump the versions together. + +We may release out-of-band of Ag Grid when there are patches that we want to make available. + +As a user, you can always check the underlying Ag Grid version with `dash_ag_grid.grid_version` and the underlying Dash Ag Grid version with `dash_ag_grid.__version__`. + +For maintainers, when issuing new releases ensure that the version bump of Dash Ag Grid follows this convention. + ### Create a production build Update the package version in `package.json` and `CHANGELOG.md` and ensure the changelog lists all the important updates. Then reinstall (so `package-lock.json` gets the new version) and rebuild: diff --git a/tests/test_versioning.py b/tests/test_versioning.py new file mode 100644 index 0000000..5d8399e --- /dev/null +++ b/tests/test_versioning.py @@ -0,0 +1,18 @@ +from packaging.version import parse +import dash_ag_grid as dag + + +def test_vs001_versioning(): + """ + Test that the major and minor versions of bundled Ag Grid align with + the major and minor versions of the Python package. + + See CONTRIBUTING.md for more information on versioning this package. + """ + ag_version = parse(dag.grid_version) + dash_ag_version = parse(dag.__version__) + + assert ( + ag_version.major == dash_ag_version.major + and ag_version.minor == dash_ag_version.minor + ) From 5fc1d32d620e358c59f6242a3416571c8865e14d Mon Sep 17 00:00:00 2001 From: Nathan Date: Tue, 30 Apr 2024 11:49:55 -0400 Subject: [PATCH 2/7] Only validate version numbers on release --- .github/workflows/python-test.yml | 3 ++- .github/workflows/release.yml | 5 +++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/python-test.yml b/.github/workflows/python-test.yml index b6bada9..8d02104 100644 --- a/.github/workflows/python-test.yml +++ b/.github/workflows/python-test.yml @@ -99,4 +99,5 @@ jobs: - run: npm run lint - run: | source .venv/bin/activate - pytest --headless + pytest --headless -k "not test_versioning" + diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f1a021e..c4c5aa6 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -24,6 +24,11 @@ jobs: curl -LsSf https://astral.sh/uv/install.sh | sh uv venv shell: bash + - name: Run all tests + run: | + source .venv/bin/activate + uv pip install ".[dev]" + pytest --headless - name: Generate distribution run: | source .venv/bin/activate From f2aba907fa2536939333ead63a91c350b6e51ca2 Mon Sep 17 00:00:00 2001 From: Nathan Date: Tue, 30 Apr 2024 11:50:45 -0400 Subject: [PATCH 3/7] Name test step --- .github/workflows/python-test.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/python-test.yml b/.github/workflows/python-test.yml index 8d02104..9b53b67 100644 --- a/.github/workflows/python-test.yml +++ b/.github/workflows/python-test.yml @@ -97,7 +97,8 @@ jobs: npm run build timeout-minutes: 20 - run: npm run lint - - run: | + - name: Run tests + run: | source .venv/bin/activate pytest --headless -k "not test_versioning" - + From b93e60fb9ea065d661777423b601e7cc53f17e1f Mon Sep 17 00:00:00 2001 From: BSd3v Date: Tue, 1 Oct 2024 14:32:20 -0400 Subject: [PATCH 4/7] Migrating the test to only run when using `dist`, this is performed after the build to make sure that the package for the test is the currently coded package. Otherwise you can fail and pass errantly. --- package.json | 3 ++- test_versioning.py | 19 +++++++++++++++++++ tests/test_versioning.py | 18 ------------------ 3 files changed, 21 insertions(+), 19 deletions(-) create mode 100644 test_versioning.py delete mode 100644 tests/test_versioning.py diff --git a/package.json b/package.json index b304812..c999c52 100644 --- a/package.json +++ b/package.json @@ -13,6 +13,7 @@ "main": "dash_ag_grid/dash_ag_grid.min.js", "scripts": { "pre-flight-version": "python test_version.py", + "pre-flight-dag-version": "python test_versioning.py", "prepublishOnly": "rimraf -rf lib && babel src --out-dir lib --copy-files --config-file ./.babelrc && rimraf --glob -rf lib/jl/ lib/*.jl", "build:js": "webpack --mode production", "build:backends": "dash-generate-components ./src/lib/components dash_ag_grid -p package-info.json --r-prefix '' --jl-prefix ''", @@ -24,7 +25,7 @@ "private::lint.eslint": "eslint src", "private::lint.prettier": "prettier src --list-different --ignore-path=.prettierignore", "lint": "run-s private::lint.*", - "dist": "npm run build && python setup.py sdist bdist_wheel" + "dist": "npm run build && run-s pre-flight-dag-version && python setup.py sdist bdist_wheel" }, "author": "Plotly ", "license": "MIT", diff --git a/test_versioning.py b/test_versioning.py new file mode 100644 index 0000000..9969073 --- /dev/null +++ b/test_versioning.py @@ -0,0 +1,19 @@ +from packaging.version import parse +import dash_ag_grid as dag + + +""" +Test that the major and minor versions of bundled Ag Grid align with +the major and minor versions of the Python package. + +See CONTRIBUTING.md for more information on versioning this package. +""" +ag_version = parse(dag.grid_version) +dash_ag_version = parse(dag.__version__) + +if not (ag_version.major == dash_ag_version.major and ag_version.minor == dash_ag_version.minor): + raise Exception("There is a version mismatch in DAG and AG-Grid, check your package.json and adjust") +try: + print('DAG version and AG-Grid are in perfect harmony 🎉') +except: + print('DAG version and AG-Grid are in perfect harmony :)') \ No newline at end of file diff --git a/tests/test_versioning.py b/tests/test_versioning.py deleted file mode 100644 index 5d8399e..0000000 --- a/tests/test_versioning.py +++ /dev/null @@ -1,18 +0,0 @@ -from packaging.version import parse -import dash_ag_grid as dag - - -def test_vs001_versioning(): - """ - Test that the major and minor versions of bundled Ag Grid align with - the major and minor versions of the Python package. - - See CONTRIBUTING.md for more information on versioning this package. - """ - ag_version = parse(dag.grid_version) - dash_ag_version = parse(dag.__version__) - - assert ( - ag_version.major == dash_ag_version.major - and ag_version.minor == dash_ag_version.minor - ) From e04a61c18fc7cafbaabb971ee01074ccf68a66d0 Mon Sep 17 00:00:00 2001 From: BSd3v Date: Wed, 2 Oct 2024 16:07:21 -0400 Subject: [PATCH 5/7] minor adjustments to contributing --- CONTRIBUTING.md | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 7cecbf0..ad915ea 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -37,7 +37,7 @@ We may release out-of-band of Ag Grid when there are patches that we want to mak As a user, you can always check the underlying Ag Grid version with `dash_ag_grid.grid_version` and the underlying Dash Ag Grid version with `dash_ag_grid.__version__`. -For maintainers, when issuing new releases ensure that the version bump of Dash Ag Grid follows this convention. +For maintainers, when issuing new releases ensure that the version bump of Dash Ag Grid follows this convention. This can be verified after a build by using `npm run pre-flight-dag-version` or `python test_versioning.py`. ### Create a production build @@ -49,8 +49,7 @@ npm run build Commit this - either via a PR or directly to the main branch. Then you can create source and wheel distributions in the generated `dist/` folder, after emptying out any previous builds: ``` -rm -rf dist build -python setup.py sdist bdist_wheel +npm run dist ``` See [PyPA](https://packaging.python.org/guides/distributing-packages-using-setuptools/#packaging-your-project) for more information. At this point you can test the build. The best way is to make a virtual env in another directory, install the wheel you just built, and run one of the demo apps, something like: @@ -71,7 +70,7 @@ Create a new distribution with: npm run dist ``` -It doesn't need to be tested extensively, just enough to know that the table loads with no errors and you've built the right version of the code. If the app looks good, use [`twine`](https://pypi.org/project/twine/) to upload these to PyPI: +It doesn't need to be tested extensively, just enough to know that the grid loads with no errors and you've built the right version of the code. If the app looks good, use [`twine`](https://pypi.org/project/twine/) to upload these to PyPI: ``` # back in the dash-ag-grid directory twine upload dist/* From 2045d1adaa9542b40638408feb0330df163478cf Mon Sep 17 00:00:00 2001 From: BSd3v Date: Wed, 2 Oct 2024 16:18:20 -0400 Subject: [PATCH 6/7] updating contributing --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index ad915ea..0ff54c3 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -37,7 +37,7 @@ We may release out-of-band of Ag Grid when there are patches that we want to mak As a user, you can always check the underlying Ag Grid version with `dash_ag_grid.grid_version` and the underlying Dash Ag Grid version with `dash_ag_grid.__version__`. -For maintainers, when issuing new releases ensure that the version bump of Dash Ag Grid follows this convention. This can be verified after a build by using `npm run pre-flight-dag-version` or `python test_versioning.py`. +For maintainers, when issuing new releases ensure that the version bump of Dash Ag Grid follows this convention. This can be verified after a build by using `npm run pre-flight-dag-version` or `python test_versioning.py`. This is automatically done during the `npm run dist` ### Create a production build From 357161a2dc5a06c64d05e68cc3521cf208874c25 Mon Sep 17 00:00:00 2001 From: BSd3v <82055130+BSd3v@users.noreply.github.com> Date: Wed, 2 Oct 2024 16:51:46 -0400 Subject: [PATCH 7/7] Update CONTRIBUTING.md Co-authored-by: Nathan Drezner <38958867+ndrezn@users.noreply.github.com> --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 0ff54c3..00d447f 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -37,7 +37,7 @@ We may release out-of-band of Ag Grid when there are patches that we want to mak As a user, you can always check the underlying Ag Grid version with `dash_ag_grid.grid_version` and the underlying Dash Ag Grid version with `dash_ag_grid.__version__`. -For maintainers, when issuing new releases ensure that the version bump of Dash Ag Grid follows this convention. This can be verified after a build by using `npm run pre-flight-dag-version` or `python test_versioning.py`. This is automatically done during the `npm run dist` +For maintainers, when issuing new releases ensure that the version bump of Dash Ag Grid follows this convention. This can be verified after a build by using `npm run pre-flight-dag-version` or `python test_versioning.py`. This is validated during the `npm run dist` ### Create a production build