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

Cope with recent setuptools changes to editable mode packaging (PEP 660) #9937

Closed
jacobtylerwalls opened this issue Aug 17, 2023 · 2 comments

Comments

@jacobtylerwalls
Copy link
Member

jacobtylerwalls commented Aug 17, 2023

Background

Versions of setuptools since 64.0.0 changed editable (development) mode packaging with -e, especially (only?--not sure) with pyproject.toml based builds, see PEP 660. Arches uses a pyproject.toml, apparently only to configure black (!), which might be the reason we're in this situation.

The setuptools changes are good, since it forces developers to test on systems set up more like their users' systems. In the meantime, though, this means that imports that were depending on the old -e behavior will fail with the new -e behavior.

For instance, multiple builds were failing yesterday on manage.py commands like so, suggesting that a relative import somewhere was being resolved to an ugly/nonexistent path like arches.app.models.app.models.models...:

RuntimeError: Conflicting 'bulkindexqueue' models in application 'models': <class 'arches.app.models.models.BulkIndexQueue'> and <class 'arches.app.models.app.models.models.BulkIndexQueue'>.

Action item

The stopgap fix in #9933 was to just not use -e on CI builds, since it's better to test against the installed package than a source checkout.

The medium term workaround for developers who need editable mode is to opt-in to legacy editable mode:

pip install --upgrade pip
pip uninstall arches
pip install -e . --config-settings editable_mode=compat

We could add that setting to our setup.py/pyproject.toml, or we could just fix the root cause of the incompatibilities with the new behavior (likely adjusting relative imports to be more explicit), since the "compat" mode is a transitional setting that will go away at some point. Opening this ticket to track that work.

@jacobtylerwalls
Copy link
Member Author

For instance, multiple builds were failing yesterday on manage.py commands like so, suggesting that a relative import somewhere was being resolved to an ugly/nonexistent path like arches.app.models.app.models.models...:

Turns out this "sudden" failure last month was a bug in setuptools 68.1.0, fixed in 68.1.1. So maybe we aren't on the hook for fixing the "compat mode" issues...

@jacobtylerwalls
Copy link
Member Author

Glancing over this again I don't think there's an action item. Editable installs are working fine with latest pip 'n setuptools.

@jacobtylerwalls jacobtylerwalls closed this as not planned Won't fix, can't repro, duplicate, stale Dec 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

No branches or pull requests

1 participant