Noob Question - Thought I'd ask this here rather t...
# prefect-community
m
Noob Question - Thought I'd ask this here rather than on Github Issues because I'm fairly certain this is user error on my part. Trying to setup the dev environment but when running pytest I get the following errors. Any thoughts on what I'm doing wrong?
Copy code
ImportError while loading conftest '/home/gary/prefect/tests/conftest.py'.
tests/conftest.py:32: in <module>
    import prefect
src/prefect/__init__.py:23: in <module>
    from prefect.flows import flow, Flow
src/prefect/flows.py:36: in <module>
    from prefect.context import PrefectObjectRegistry, registry_from_script
src/prefect/context.py:34: in <module>
    from prefect.client import OrionClient
src/prefect/client.py:55: in <module>
    from prefect.orion.api.server import ORION_API_VERSION, create_app
src/prefect/orion/api/__init__.py:1: in <module>
    from . import (
src/prefect/orion/api/block_documents.py:19: in <module>
    from prefect.orion import models, schemas
src/prefect/orion/models/__init__.py:1: in <module>
    from . import (
src/prefect/orion/models/block_schemas.py:12: in <module>
    from prefect.blocks.core import Block
src/prefect/blocks/__init__.py:3: in <module>
    import prefect.blocks.notifications
src/prefect/blocks/notifications.py:26: in <module>
    class SlackWebhook(NotificationBlock):
pydantic/main.py:283: in pydantic.main.ModelMetaclass.__new__
    ???
../anaconda3/lib/python3.9/abc.py:106: in __new__
    cls = super().__new__(mcls, name, bases, namespace, **kwargs)
src/prefect/utilities/dispatch.py:99: in _register_subclass_of_base_type
    register_type(cls)
src/prefect/utilities/dispatch.py:154: in register_type
    key = get_dispatch_key(cls)
src/prefect/utilities/dispatch.py:76: in get_dispatch_key
    dispatch_key = dispatch_key()
src/prefect/blocks/core.py:127: in __dispatch_key__
    return block_schema_to_key(cls._to_block_schema())
src/prefect/blocks/core.py:263: in _to_block_schema
    return BlockSchema(
pydantic/main.py:340: in pydantic.main.BaseModel.__init__
    ???
pydantic/main.py:1076: in pydantic.main.validate_model
    ???
pydantic/fields.py:884: in pydantic.fields.ModelField.validate
    ???
pydantic/fields.py:1101: in pydantic.fields.ModelField._validate_singleton
    ???
pydantic/fields.py:1148: in pydantic.fields.ModelField._apply_validators
    ???
pydantic/class_validators.py:318: in pydantic.class_validators._generic_validator_basic.lambda13
    ???
pydantic/main.py:690: in pydantic.main.BaseModel.validate
    ???
E   DeprecationWarning: `copy_on_model_validation` should be a string: 'deep', 'shallow' or 'none'
k
Can you show an example code that causes this error?
Have you tried to debug following this thread?
m
Thanks for the response @Khuyen Tran I was just following the install:
Copy code
# Clone the repository and switch to the 'orion' branch
git clone <https://github.com/PrefectHQ/prefect.git>
cd prefect
git checkout orion
# Install the package with development dependencies
pip install -e ".[dev]"
# Setup pre-commit hooks for required formatting
pre-commit install
# Run tests
pytest
Found here. https://docs.prefect.io/contributing/overview/ Had to resolve some dependencies, but after that running the install went smooth. The errors appear when I execute
Copy code
pytest
I'll try to debug with the thread you provided now.....more to come.
z
Have you defined your own block somewhere with a setting for
copy_on_model_validation
?
m
I have not. I didn't see this in the setup doc. Could you point me to a good reference to set that up?
k
@Zanie I think he is supposed to run
git checkout main
instead of
git checkout orion
as mentioned in the doc right?
🙏 1
m
Trying to track this down I noticed that I do not have a packaging.versions file.
z
Oh yeah you’ll want to be on the
main
branch
m
Trying that now. More to come...
z
The
orion
branch is out of date and not compatible with the latest Pydantic
😯 1
k
I’ll create a PR to update the doc
🙌 1
z
🎉 1
gratitude thank you 1
🦜 1
😬 1
m
BAM! Worked like a charm! Thank you @Zanie and @Khuyen Tran Tests are still running, but it all looks good now. Hoping I can get up to speed with this amazing project and contribute a little bit in the months to come. You all ROCK!!!
🎉 1
z
Thanks! Exciting 🙂
k
Look forward to your contribution, @Michael Shoemaker!