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
move source code into localstack-core #10800
Conversation
56f75ac
to
25f59c4
Compare
@@ -134,7 +134,7 @@ jobs: | |||
circleci-agent step halt | |||
else | |||
source .venv/bin/activate | |||
python -m localstack.testing.testselection.scripts.generate_test_selection_from_pr /tmp/workspace/repo $CI_PULL_REQUEST target/testselection/test-selection.txt | |||
PYTHONPATH=localstack-core python -m localstack.testing.testselection.scripts.generate_test_selection_from_pr /tmp/workspace/repo $CI_PULL_REQUEST target/testselection/test-selection.txt |
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 should be removed after #10830 has been merged, right?
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.
no this has nothing to do with the plugin loading, but just the src layout.
without installing localstack with pip install -e .
into the activated venv, the python binary cannot find the source code when a src layout is used.
another option is to cd into localstack-core
, or move test selection scripts out of ls all together
collecting a few of my findings below, will update with more when I encounter them
|
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.
Awesome! This is going to be a great step towards a proper structure and code separation between the different areas / hierarchies in the codebase!
The changes themselves are looking great, and the separation in the two commits is super-helpful (so +1 for the manual merge of the PR to avoid a squash commit).
The changes right now are nearly covering all cases, I just found a few small things that still need to be adjusted and some thins we could run to find potential integration issues early:
- The S3 workflow trigger needs to be adjusted (hasn't been changed, so I cannot comment on it in the PR diff view):
localstack/.github/workflows/tests-s3-image.yml
Lines 7 to 15 in e69d60f
- localstack/aws/*.py - localstack/aws/handlers/*¨ - localstack/aws/protocol/** - localstack/aws/serving/** - localstack/aws/api/s3/** - localstack/http/** - localstack/runtime/** - localstack/services/s3/** - localstack/*.py - The a path in a step in the ASF update action needs to be updated (see comment).
- The test runs are currently testing the integration using the "companion branch detection". Maybe it would be useful to just create a dev release from this commit before actually merging it? With this published dev release we could trigger the different pipelines in our downstream projects, testing the integration. If we find issues we can fix them without any interruptions (we can just directly yank or delete the dev release on PyPi).
Let me know if I can help anywhere along the way! 🚀
@@ -525,7 +527,7 @@ def create_code_directory(service_name: str, code: str, base_path: str): | |||
@click.option("--doc/--no-doc", default=False, help="whether or not to generate docstrings") | |||
@click.option( | |||
"--path", | |||
default="./localstack/aws/api", | |||
default="./localstack-core/localstack/aws/api", |
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.
Unfortunately, this change isn't enough to fix the ASF update action...
I did a test-run of the pipeline on this branch: https://github.com/localstack/localstack/actions/runs/9158663716/job/25177480610
The run is looking good, but the change detection is broken:
fatal: ambiguous argument 'localstack/aws/api/': unknown revision or path not in the working tree.
This should be easily fixed by adjusting the paths in this job step:
localstack/.github/workflows/asf-updates.yml
Lines 54 to 67 in fa4ab5a
- name: Check for changes | |
id: check-for-changes | |
run: | | |
# Check if there are changed files and store the result in target/diff-check.log | |
# Check against the PR branch if it exists, otherwise against the master | |
# Store the result in target/diff-check.log and store the diff count in the GitHub Action output "diff-count" | |
mkdir -p target | |
(git diff --name-only origin/asf-auto-updates localstack/aws/api/ 2>/dev/null || git diff --name-only origin/master localstack/aws/api/ 2>/dev/null) | tee target/diff-check.log | |
echo "diff-count=$(cat target/diff-check.log | wc -l)" >> $GITHUB_OUTPUT | |
# Store a (multiline-sanitized) list of changed services (compared to the master) in the GitHub Action output "changed-services" | |
echo "changed-services<<EOF" >> $GITHUB_OUTPUT | |
echo "$(git diff --name-only origin/master localstack/aws/api/ | sed 's#localstack/aws/api/#- #g' | sed 's#/__init__.py##g' | sed 's/_/-/g')" >> $GITHUB_OUTPUT | |
echo "EOF" >> $GITHUB_OUTPUT |
Motivation
This is the first transitional step into a multi-distribution + namespace package localstack setup. Before we introduce multiple distributions and a namespace package, we can move the localstack source code into
localstack-core
, and use the src layout to keep everything backwards compatible, while at the same time committing one of the biggest involved changes, which ismkdir localstack-core && mv localstack localstack-core
.Once we introduce multiple distribution, each distribution will have a flat layout again, but that requires restructuring of the entire project setup.
Find all relevant information on how to adopt the change in #10860
Changes
localstack
package) now lives in./localstack-core
rather than./
. In the container, it now moved from/opt/code/localstack/localstack
to/opt/code/localstack/localstack-core/localstack
Merging the PR
I would like to manually merge this PR because i'd like the file move and config updates separate from each other. this will make it easier to understand in the history, potentially make rebasing easier, and also allow us to clearly ignore the renames (although they should be by default by git).turns out this was not really needed so i just squash merged
TODO
What's left to do:
localstack.dev.run