Skip to content

Conversation

rzats
Copy link
Contributor

@rzats rzats commented Oct 13, 2022

Prerequisites:

  • Unless it is a documentation hotfix it should be merged against the dev branch
  • Branch is up-to-date with the branch to be merged with, i.e. dev
  • Build is successful
  • Code is cleaned up and formatted

Summary

Previously, most IDE features - autocompletion, linting, functioning imports - did not work in epidata due to the codebase's nonstandard structure (pulling code from multiple repos, then reordering them in the Docker container, so the compile-time structure does not match the imports at runtime).

This PR adds a solution that makes IDE development a lot less painful. The idea behind it is to use an "editable install", which is a minimalistic pip package that symlinks to a Python project such that any changes to the package's files are reflected in the dev environment and vice versa. To that end, it

  • adds pyproject.toml and setup.cfg files that define how our local package is laid out

  • adds some code to the install.sh setup script that symlinks those files to driver/repos

  • adds instructions on using these to the README

Caveats:

  • pip install -e . --config-settings editable_mode=strict needs to be re-ran when any Python files are added or deleted locally. (But edits to existing files will be reflected in the editable install.)
  • The bindings in pyproject.toml need to be updated whenever we add new packages and subfolders. This is due to the following limitation:

Although package_dir applies recursively, you must explicitly list all packages in packages: the Distutils will not recursively scan your source tree looking for any directory with an __init__.py file

Copy link
Contributor

@dshemetov dshemetov left a comment

Choose a reason for hiding this comment

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

one small nit, but otherwise lgtm 🚀

good work tracking this all the way to the root issue in setuptools!

@rzats rzats requested a review from dshemetov October 14, 2022 10:45
Copy link
Contributor

@dshemetov dshemetov left a comment

Choose a reason for hiding this comment

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

🚢 🚢 🚢

Copy link
Contributor

@krivard krivard left a comment

Choose a reason for hiding this comment

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

nice work! and documentation updates too, well done!

@rzats rzats merged commit 4ec482c into dev Oct 14, 2022
@rzats rzats deleted the rzatserkovnyi/ide-fix branch October 14, 2022 19:15
@melange396
Copy link
Collaborator

very nice!

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