Skip to content

Commit

Permalink
feat(ver): dynamic version identifiers
Browse files Browse the repository at this point in the history
This adds a dynamic version identifier to Ibis installs -- this should
have no discernable impact on users installing from `conda` or
`pypi` (or from released versions generally).

For users who install from source, it generates a version of the form:

```
<most_recent_release>-post.<numcommits_since_release>+<short_sha_of_HEAD>(.dirty)?
```

The `dirty` suffix is added if there are unstaged changes when the
install is performed.
This will help us help users and other devs track which exact version is
installed when troubleshooting / comparing performance.

The `version` identifier in `pyproject.toml` is not affected by this
process and should display the last released version (currently 2.1.1).

The `__version__` string in `ibis/__init__.py` is now also hard-coded to `"2.1.1"`

During a release, `poetry version` will bump the version in the
`pyproject.toml` file.  I've also added a plugin for the semantic
release bot to automatically replace the version string in the
`__init__.py` file.
  • Loading branch information
gforsyth authored and cpcloud committed Apr 7, 2022
1 parent 18a06d3 commit 408f862
Show file tree
Hide file tree
Showing 9 changed files with 90 additions and 11 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ Icon?
# documentation files
docs/source/generated
docs/source/generated-notebooks
*.org

# Ibis testing data
ci/ibis-testing-data*
Expand Down
28 changes: 27 additions & 1 deletion .releaserc.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,27 @@
"publishCmd": "ci/release/publish.sh"
}
],
[
"@google/semantic-release-replace-plugin",
{
"replacements": [
{
"file": ["ibis/__init__.py"],
"from": "__version__ = \".*\"",
"to": "__version__ = \"${nextRelease.version}\"",
"results": [
{
"file": "ibis/__init__.py",
"hasChanged": true,
"numMatches": 1,
"numReplacements": 1
}
],
"countMatches": true
}
]
}
],
[
"@semantic-release/github",
{
Expand All @@ -29,7 +50,12 @@
[
"@semantic-release/git",
{
"assets": ["pyproject.toml", "docs/release_notes.md", "setup.py"],
"assets": [
"pyproject.toml",
"docs/release_notes.md",
"setup.py",
"ibis/__init__.py"
],
"message": "chore(release): ${nextRelease.version}"
}
]
Expand Down
3 changes: 2 additions & 1 deletion ci/release/dry_run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,14 @@ npx --yes \
-p "@semantic-release/changelog" \
-p "@semantic-release/exec" \
-p "@semantic-release/git" \
-p "@google/semantic-release-replace-plugin" \
semantic-release \
--ci \
--dry-run \
--plugins \
--analyze-commits "@semantic-release/commit-analyzer" \
--generate-notes "@semantic-release/release-notes-generator" \
--verify-conditions "@semantic-release/changelog,@semantic-release/exec,@semantic-release/git" \
--prepare "@semantic-release/changelog,@semantic-release/exec" \
--prepare "@semantic-release/changelog,@semantic-release/exec,@google/semantic-release-replace-plugin" \
--branches "$branch" \
--repository-url "file://$PWD"
1 change: 1 addition & 0 deletions ci/release/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@ npx --yes \
-p "@semantic-release/github" \
-p "@semantic-release/exec" \
-p "@semantic-release/git" \
-p "@google/semantic-release-replace-plugin" \
semantic-release --ci
5 changes: 1 addition & 4 deletions ibis/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,7 @@
__all__ = ['api', 'ir', 'util', 'IbisError', 'options']
__all__ += api.__all__

try:
__version__ = importlib_metadata.version(__name__)
except Exception:
__version__ = importlib_metadata.version("ibis-framework")
__version__ = "2.1.1"


def __getattr__(name: str) -> BaseBackend:
Expand Down
6 changes: 6 additions & 0 deletions poetry-overrides.nix
Original file line number Diff line number Diff line change
Expand Up @@ -72,4 +72,10 @@ self: super:
substituteAllInPlace ./nbconvert/exporters/templateexporter.py
'';
});

poetry-dynamic-versioning = super.poetry-dynamic-versioning.overridePythonAttrs (attrs: {
nativeBuildInputs = (attrs.nativeBuildInputs or [ ]) ++ [
self.poetry-core
];
});
}
40 changes: 36 additions & 4 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 15 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@ classifiers = [
"Topic :: Scientific/Engineering",
]

[tool.poetry-dynamic-versioning]
enable = true
dirty = true
style = "semver"
pattern = "^(?P<base>\\d+(\\.\\d+)*)"

[tool.poetry.dependencies]
python = ">=3.8,<3.11"
atpublic = ">=2.3,<3"
Expand Down Expand Up @@ -53,6 +59,7 @@ pyspark = { version = ">=3,<4", optional = true }
requests = { version = ">=2,<3", optional = true }
Shapely = { version = ">=1.6,<1.8.1", optional = true }
sqlalchemy = { version = ">=1.4,<2.0", optional = true }
poetry-dynamic-versioning = "^0.14.0"

[tool.poetry.dev-dependencies]
black = ">=22.1.0,<23"
Expand Down Expand Up @@ -218,6 +225,8 @@ filterwarnings = [
"ignore:In Python .*, it is preferred .* type hints .* UDF:UserWarning",
# windows
"ignore:getargs.* The 'u' format is deprecated:DeprecationWarning",
# findspec
"ignore: _SixMetaPathImporter.find_spec()",
]
empty_parameter_set_mark = "fail_at_collect"
norecursedirs = ["site-packages", "dist-packages"]
Expand Down Expand Up @@ -275,5 +284,10 @@ channels = ["conda-forge"]
dask = ">=2021.10.0"

[build-system]
requires = ["poetry-core>=1", "setuptools", "wheel"]
requires = [
"poetry-core>=1",
"poetry-dynamic-versioning",
"setuptools",
"wheel"
]
build-backend = "poetry.core.masonry.api"
1 change: 1 addition & 0 deletions setup.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 comment on commit 408f862

@ibis-squawk-bot
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Performance Alert ⚠️

Possible performance regression was detected for benchmark.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 2.

Benchmark suite Current: 408f862 Previous: 18a06d3 Ratio
ibis/tests/benchmarks/test_benchmarks.py::test_complex_datatype_parse 3688362.900324405 iter/sec (stddev: 6.57489566235814e-8) 11718454.107254041 iter/sec (stddev: 4.08852857196761e-9) 3.18

This comment was automatically generated by workflow using github-action-benchmark.

Please sign in to comment.