-
Notifications
You must be signed in to change notification settings - Fork 811
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: versioneer-compatible versions #2038
Conversation
Signed-off-by: Aaron Pham <[email protected]>
Signed-off-by: Aaron Pham <[email protected]>
Codecov Report
@@ Coverage Diff @@
## bentoml-1.0 #2038 +/- ##
================================================
- Coverage 81.75% 44.60% -37.16%
================================================
Files 22 95 +73
Lines 1864 6548 +4684
================================================
+ Hits 1524 2921 +1397
- Misses 340 3627 +3287
|
Signed-off-by: Aaron Pham <[email protected]>
Signed-off-by: Aaron Pham <[email protected]>
Signed-off-by: Aaron Pham <[email protected]>
@@ -42,7 +42,7 @@ def expand_env_var(env_var): | |||
|
|||
|
|||
def is_pip_installed_bentoml(): | |||
is_installed_package = hasattr(version_mod, "version_json") | |||
is_installed_package = len(version_mod.version_tuple) == 3 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we will start with pre-release on pypi which will break this, pre-release looks like 1.0.0.a2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
:) it shouldn't
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tried building a pre-release with 1.0.0.a2
and bentoml._version.version_tuple == (1,0,0)
after pip install
, so it's working as expected.
I do run into another case, where after I tag the branch with any string in semver format, it will think it's a pypi released version, even if it's a editable install
@@ -42,7 +42,7 @@ def expand_env_var(env_var): | |||
|
|||
|
|||
def is_pip_installed_bentoml(): | |||
is_installed_package = hasattr(version_mod, "version_json") | |||
is_installed_package = len(version_mod.version_tuple) == 3 | |||
is_tagged = not BENTOML_VERSION.startswith("0+untagged") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we will also need to change this to not BENTOML_VERSION.startswith("0.1.")
- looks like setuptools_scm will generate versions like 0.1.dev1392+gddbebc4
when there is no tag
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
Signed-off-by: Aaron Pham <[email protected]>
… into fix/ci_scripts Signed-off-by: Aaron Pham <[email protected]>
Signed-off-by: Aaron Pham <[email protected]>
Hello @aarnphm, Thanks for updating this PR. There are currently no PEP 8 issues detected in this PR. Cheers! 🍻 Comment last updated at 2021-11-22 15:10:48 UTC |
Signed-off-by: Aaron Pham <[email protected]>
Signed-off-by: Aaron Pham <[email protected]>
Signed-off-by: Aaron Pham <[email protected]>
Signed-off-by: Aaron Pham <[email protected]>
e72acea
to
c84fdb6
Compare
Signed-off-by: Aaron Pham <[email protected]>
Signed-off-by: Aaron Pham <[email protected]>
Signed-off-by: Aaron Pham <[email protected]>
Signed-off-by: Aaron Pham <[email protected]>
Signed-off-by: Aaron Pham <[email protected]>
Signed-off-by: Aaron Pham <[email protected]>
2b6091e
to
a2abcbc
Compare
Signed-off-by: Aaron Pham <[email protected]>
@@ -2,6 +2,10 @@ include README.md | |||
include LICENSE | |||
|
|||
# Included in PyPI distribution | |||
include bentoml/*.py |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@aarnphm these lines here are not needed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
all files tracked by git is already included by default, now with setuptools scm
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
noted
try: | ||
import bentoml._version as version_mod | ||
except ImportError: | ||
# Since we aren't VCS _version.py, which is generated by setuptools_scm |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
when will this happen?
I suppose only when a developer does pip install -e .
and then removed the _version.py
file by accident?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes. Also mainly for type checking where pyright cannot find bentoml._version
.
There is also a current caveats with types CI atm
if CONFIG_ENV_VAR in os.environ: | ||
# User local config file for customizing bentoml | ||
return expand_env_var(os.environ.get(CONFIG_ENV_VAR)) | ||
return expand_env_var(os.environ[CONFIG_ENV_VAR]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this will raise a keyerror if the env var is not set
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could you also make this change in the follow-up pr?
"type": Or( | ||
And(str, Use(str.lower), lambda s: s in ("zipkin", "jaeger")), None | ||
), | ||
"type": Or(And(str, Use(str.lower), _check_tracing_type), None), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this case is better left it is, easier to read in context
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This mainly to compensate pyright :(
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can't believe there's no easy way to type a lambda function inline :(
@@ -219,14 +223,17 @@ def tracer( | |||
|
|||
return NoopTracer() | |||
|
|||
logging_file_directory = providers.Factory( | |||
lambda default, customized: customized or default, | |||
logging_file_directory = t.cast( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bojiang could you review this part?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lol it should not be like this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
simple_di can't be inferred by pyright
exit 1 | ||
fi | ||
else | ||
echo "Running pylint for the whole library..." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also I think pylint is failing on main branch now, for the same reason pyright was failing before
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can just disable pylint for running on the main branch then
Signed-off-by: Aaron Pham [email protected]
Maybe i spent way too much time writing stubs :)