-
Notifications
You must be signed in to change notification settings - Fork 0
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
Pip package for tutorial-vm
#5
Open
eberrigan
wants to merge
26
commits into
main
Choose a base branch
from
elizabeth/make-pip-package
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
0da3bb2
make pip package
eberrigan 21128ca
Rename project urls
roomrys d6cef2f
Add more keywords
roomrys 1bb89b0
Add pytest and black to dev extras
roomrys 343a8ad
Specifiy location of source code
roomrys 98e15fd
Test the imports
roomrys 68d1f8d
Lint
roomrys ad291d8
Reorganize pyproject
roomrys 9f36b5f
Remove unneccessary requirements
roomrys 8aa7ca8
Merge branch 'main' of https://github.com/talmolab/cosyne_vm into eli…
roomrys 9063357
Install dev extras via environment.yml
roomrys 407fd17
make imports backwards compatible
eberrigan 2a6b079
add ci for pip package tests but not upload
eberrigan 3ddd310
update andrews email
eberrigan 56fb3fe
ci was in wrong folder
eberrigan 95db597
import from tutorial_vm again
eberrigan 0737499
add setup for google cloud credentials to ci
eberrigan cd85066
fix indentation
eberrigan 57282bc
add manual publish action
eberrigan b3caf03
rename package to lablink-client
eberrigan 0e9da40
rename package directory to lablink_client
eberrigan 97937a5
rename package directory to lablink_client
eberrigan 311c63a
pip package source code is now in lablink_client folder
eberrigan a990f77
use workload identity provider instead of service account
eberrigan 9e8fa84
authenticate using auth
eberrigan 596b681
add quotes
eberrigan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
name: Build and Publish Manual | ||
|
||
on: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Google Cloud credentials | ||
env: | ||
GOOGLE_APPLICATION_CREDENTIALS: ${{ runner.temp }}/gcloud-key.json | ||
run: | | ||
echo "${{ secrets.GOOGLE_APPLICATION_CREDENTIALS_JSON }}" > $GOOGLE_APPLICATION_CREDENTIALS | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: '3.9' | ||
|
||
- name: Get version from pyproject.toml | ||
id: get_version | ||
run: | | ||
VERSION=$(grep -Po '(?<=^version = ")[^"]*' pyproject.toml) | ||
echo "version=$VERSION" >> $GITHUB_ENV | ||
|
||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install --editable .[dev] | ||
|
||
- name: Build package | ||
run: | | ||
python -m build | ||
twine check dist/* | ||
|
||
- name: Install package | ||
run: | | ||
pip install dist/*.whl | ||
|
||
- name: Run tests | ||
run: | | ||
pytest tests/ | ||
|
||
- name: Clean up credentials | ||
run: rm -f $GOOGLE_APPLICATION_CREDENTIALS | ||
|
||
- name: Publish package | ||
env: | ||
TWINE_USERNAME: __token__ | ||
TWINE_PASSWORD: ${{ secrets.TUTORIAL_PYPI_API_TOKEN }} | ||
run: | | ||
twine upload dist/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
name: Build and Test | ||
|
||
on: | ||
pull_request: | ||
types: [opened, synchronize, reopened] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
permissions: | ||
id-token: write | ||
contents: read | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Authenticate to Google Cloud | ||
id: auth | ||
uses: google-github-actions/auth@v1 | ||
with: | ||
create_credentials_file: true | ||
workload_identity_provider: 'projects/${{ secrets.GCP_PROJECT_ID }}/locations/global/workloadIdentityPools/${{ secrets.GCP_POOL_ID }}/providers/${{ secrets.GCP_PROVIDER_ID }}' | ||
service_account: '${{ secrets.GCP_SERVICE_ACCOUNT_EMAIL }}' | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: '3.9' | ||
|
||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install --editable .[dev] | ||
|
||
- name: Build package | ||
run: | | ||
python -m build | ||
twine check dist/* | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. upload archive to access later |
||
- name: Install package | ||
run: | | ||
pip install dist/*.whl | ||
|
||
- name: Run tests | ||
run: | | ||
pytest tests/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,4 +7,4 @@ dependencies: | |
- python>=3.7 | ||
- pip | ||
- pip: | ||
- -e . | ||
- -e .[dev] |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
[project] | ||
name = "lablink-client" | ||
version = "0.0.1a0" | ||
authors = [ | ||
{ name = "Liezl Maree", email = "[email protected]" }, | ||
{ name = "Andrew Park", email = "[email protected]" }, | ||
{ name = "Elizabeth Berrigan", email = "[email protected]" }, | ||
] | ||
description = "Scripts for VM instances of tutorial platform." | ||
readme = "README.md" | ||
license = { file = "LICENSE" } | ||
requires-python = ">=3.7" | ||
dependencies = [ | ||
"google-cloud-logging", | ||
"google-cloud-pubsub", | ||
"google-cloud-spanner==3.42.0", | ||
"psutil", | ||
] | ||
keywords = [ | ||
"tutorial", | ||
"vm", | ||
"gcp", | ||
"google-cloud", | ||
"spanner", | ||
"pubsub", | ||
"logging", | ||
] | ||
classifiers = [ | ||
"Programming Language :: Python :: 3", | ||
"Operating System :: OS Independent", | ||
"Development Status :: 3 - Alpha", | ||
] | ||
|
||
[project.optional-dependencies] | ||
dev = ["toml", "twine", "build", "pytest", "black"] | ||
|
||
[project.urls] | ||
Homepage = "https://github.com/talmolab/tutorial_vm" | ||
Issues = "https://github.com/talmolab/tutorial_vm/issues" | ||
|
||
[build-system] | ||
requires = ["setuptools", "wheel"] | ||
build-backend = "setuptools.build_meta" | ||
|
||
[tool.setuptools.packages.find] | ||
where = ["lablink_client"] | ||
|
||
[tool.pytest.ini_options] | ||
pythonpath = ["."] |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
"""Module that tests the imports of the package.""" | ||
|
||
|
||
def test_import(): | ||
import lablink_client | ||
|
||
from lablink_client import crd_connect | ||
from lablink_client import database | ||
from lablink_client import logging_utils | ||
from lablink_client import subscribe_instance | ||
from lablink_client import update_inuse_status | ||
|
||
|
||
if __name__ == "__main__": | ||
|
||
# Add the parent directory to the pythonpath (pytest setup to do this automatically) | ||
import os | ||
import sys | ||
|
||
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))) | ||
|
||
# Run the test | ||
test_import() |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
possibly have input of archive from build and test stage