Skip to content
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

Merged
merged 20 commits into from
Nov 22, 2021

Conversation

aarnphm
Copy link
Contributor

@aarnphm aarnphm commented Nov 22, 2021

Signed-off-by: Aaron Pham [email protected]

Maybe i spent way too much time writing stubs :)

@codecov
Copy link

codecov bot commented Nov 22, 2021

Codecov Report

Merging #2038 (a2abcbc) into bentoml-1.0 (ddbebc4) will decrease coverage by 37.15%.
The diff coverage is 93.75%.

❗ Current head a2abcbc differs from pull request most recent head 52887ec. Consider uploading reports for the commit 52887ec to get more accurate results
Impacted file tree graph

@@               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     
Flag Coverage Δ
e2e-tests 17.27% <87.50%> (?)
frameworks 81.75% <ø> (ø)
unit-tests 20.29% <93.75%> (?)
Impacted Files Coverage Δ
bentoml/_internal/configuration/__init__.py 73.68% <84.61%> (ø)
bentoml/_internal/configuration/containers.py 63.02% <100.00%> (ø)
bentoml/_internal/marshal/dispatcher.py 0.00% <0.00%> (ø)
bentoml/_internal/utils/validation.py 80.00% <0.00%> (ø)
bentoml/_internal/io_descriptors/json.py 52.77% <0.00%> (ø)
bentoml/_internal/bento/env.py 86.36% <0.00%> (ø)
bentoml/_internal/bento/local_py_modules.py 0.00% <0.00%> (ø)
bentoml/_internal/store.py 85.36% <0.00%> (ø)
bentoml/_internal/tracing/noop.py 0.00% <0.00%> (ø)
bentoml/_internal/server/runner_app.py 0.00% <0.00%> (ø)
... and 65 more

Signed-off-by: Aaron Pham <[email protected]>
@aarnphm aarnphm changed the title chore: restore versioneer chore: versioneer-compatible versions Nov 22, 2021
@@ -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
Copy link
Member

@parano parano Nov 22, 2021

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

:) it shouldn't

Copy link
Member

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")
Copy link
Member

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@pep8speaks
Copy link

pep8speaks commented Nov 22, 2021

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]>
@aarnphm aarnphm force-pushed the fix/ci_scripts branch 2 times, most recently from e72acea to c84fdb6 Compare November 22, 2021 12:51
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]>
@aarnphm aarnphm merged commit dc17592 into bentoml:bentoml-1.0 Nov 22, 2021
@aarnphm aarnphm deleted the fix/ci_scripts branch November 22, 2021 15:12
@@ -2,6 +2,10 @@ include README.md
include LICENSE

# Included in PyPI distribution
include bentoml/*.py
Copy link
Member

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

Copy link
Member

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

Copy link
Contributor Author

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
Copy link
Member

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?

Copy link
Contributor Author

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])
Copy link
Member

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

Copy link
Member

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),
Copy link
Member

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

Copy link
Contributor Author

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 :(

Copy link
Member

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(
Copy link
Member

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?

Copy link
Member

Choose a reason for hiding this comment

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

what?

Copy link
Member

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

Copy link
Contributor Author

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..."
Copy link
Member

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

Copy link
Contributor Author

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

aarnphm added a commit to aarnphm/BentoML that referenced this pull request Jul 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants