Skip to content

Repo Setup (DRAFT) #23

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

Draft
wants to merge 5 commits into
base: copybara_push
Choose a base branch
from
Draft

Repo Setup (DRAFT) #23

wants to merge 5 commits into from

Conversation

s2t2
Copy link
Collaborator

@s2t2 s2t2 commented Mar 28, 2025

Reproduce setup instructions on Google machine.

Improve robustness of configuration by implementing environment variables based approach.

(PR currently a work in progress / draft, not ready for merge)


FYI - commands used during setup:

poetry add python-dotenv
poetry add jupyter --group dev

@s2t2 s2t2 changed the title Setup virtual environment Setup virtual environment (DRAFT) Mar 28, 2025
@s2t2 s2t2 changed the title Setup virtual environment (DRAFT) Repo setup (DRAFT) Mar 28, 2025
@s2t2 s2t2 changed the title Repo setup (DRAFT) Repo Setup (DRAFT) Mar 28, 2025
@s2t2

This comment was marked as resolved.

@s2t2

This comment was marked as resolved.

@s2t2

This comment was marked as outdated.

@github-advanced-security
Copy link

This pull request sets up GitHub code scanning for this repository. Once the scans have completed and the checks have passed, the analysis results for this pull request branch will appear on this overview. Once you merge this pull request, the 'Security' tab will show more code scanning analysis results (for example, for the default branch). Depending on your configuration and choice of analysis tool, future pull requests will be annotated with code scanning analysis results. For more information about GitHub code scanning, check out the documentation.

@s2t2

This comment was marked as resolved.

@s2t2
Copy link
Collaborator Author

s2t2 commented Apr 2, 2025

This SO post references common build problems and recommends removing the version of python installed via venv and re-doing the installation:

deactivate 

pyenv versions

pyenv uninstall 3.11.11

sudo apt-get update
sudo apt-get install libreadline-dev liblzma-dev

sudo apt-get install sqlite3 libsqlite3-dev 
# sudo apt install zlib1g zlib1g-dev libssl-dev libbz2-dev libsqlite3-dev

pyenv install 3.11.11
pyenv global 3.11.11 # may be unnecessary, the previous step seems to have set
source .venv/bin/activate
poetry env activate # is this necessary?
poetry env use 3.11

poetry run python -m ipykernel install --user --name=sbsim-kernel

This resolves the earlier installation issues and we are successfully able to create a kernel 🎉

@s2t2

This comment was marked as resolved.

@s2t2
Copy link
Collaborator Author

s2t2 commented Apr 11, 2025

Test file template:

"""Tests for [the thing you are testing].

Copyright 2025 Google LLC

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    https://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
"""

from absl.testing import absltest

# import the function you want to test here

class TestExample(absltest.TestCase):

    def test_example(self):
        self.assertEqual(2+2, 4)


if __name__ == '__main__':
    absltest.main()

@s2t2

This comment was marked as resolved.

@s2t2
Copy link
Collaborator Author

s2t2 commented Apr 11, 2025

VS Code User Settings (JSON):

{
    "editor.tabSize": 2,
    "editor.detectIndentation": false,
    "files.insertFinalNewline": true,
    "files.trimFinalNewlines": true,
    "files.trimTrailingWhitespace": true,
}

@s2t2
Copy link
Collaborator Author

s2t2 commented Apr 18, 2025

Makefile (WIP, need to figure out how to make the activation step work (if possible), since they use different shells):

.PHONY: activate_help test lint

VENV_BIN := .venv/bin

#activate_help:
#       @echo "Run: source .venv/bin/activate"
#
#activate:
#       bash -c "source .venv/bin/activate"

# gives permission denied:
#activate:
#       $(VENV_BIN)/activate

test:
        $(VENV_BIN)/pytest --disable-pytest-warnings

lint:
        $(VENV_BIN)/pylint --rcfile=.pylintrc smart_control

https://stackoverflow.com/questions/33839018/activate-virtualenv-in-makefile

@s2t2 s2t2 force-pushed the copybara_push branch from cfad6e2 to da325d2 Compare May 16, 2025 16:27
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.

1 participant