Skip to content

Commit

Permalink
Merge pull request #1 from Ganymede-Bio/add-staging-prod-gh-action
Browse files Browse the repository at this point in the history
Add staging prod gh action
  • Loading branch information
bensonlee5 authored Feb 19, 2024
2 parents db0bbf7 + 6bbc05f commit f222595
Show file tree
Hide file tree
Showing 29 changed files with 194 additions and 168 deletions.
34 changes: 34 additions & 0 deletions .github/workflows/publish-package-prod.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Publish Packages to Prod
on:
push:
branches:
- 'main'

jobs:
Publish:
runs-on: ubuntu-latest
steps:
- name: Checkout source
uses: actions/checkout@v3
- name: Install dependencies
run: |
python -m pip install twine build
python -m pip install keyrings.google-artifactregistry-auth
- name: Capture build tag
run: |
echo "COMMIT_TAG=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
- name: Make dists
run: |
python -m build
- name: Show output
run: tree .
- name: Setup gcloud
uses: google-github-actions/[email protected]
with:
service_account_key: ${{ secrets.GCP_SA_KEY_PROD }}
project_id: ganymede-core
export_default_credentials: true
- name: Publish package
run: |
python3 -m twine upload --verbose --repository-url https://us-central1-python.pkg.dev/ganymede-core/ganymede-py/ dist/*
34 changes: 34 additions & 0 deletions .github/workflows/publish-package-staging.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Publish Packages to Staging
on:
push:
branches:
- 'main'

jobs:
Publish:
runs-on: ubuntu-latest
steps:
- name: Checkout source
uses: actions/checkout@v3
- name: Install dependencies
run: |
python -m pip install twine build
python -m pip install keyrings.google-artifactregistry-auth
- name: Capture build tag
run: |
echo "COMMIT_TAG=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
- name: Make dists
run: |
python -m build
- name: Show output
run: tree .
- name: Setup gcloud
uses: google-github-actions/[email protected]
with:
service_account_key: ${{ secrets.GCP_SA_KEY_STAGING}}
project_id: ganymede-core-staging
export_default_credentials: true
- name: Publish package
run: |
python3 -m twine upload --verbose --repository-url https://us-central1-python.pkg.dev/ganymede-core-staging/ganymede-py/ dist/*
2 changes: 0 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ name: test
on:
push:
branches: [ main ]
pull_request:
types: [opened, edited, synchronize]

permissions:
contents: read
Expand Down
16 changes: 4 additions & 12 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,27 +12,19 @@
"editor.autoIndent": "keep"
},

// Use flake8, not pylint
"python.linting.pylintEnabled": false,
"python.linting.flake8Enabled": true,
"python.linting.mypyEnabled": true,
// Disable Python tests for now.
"python.testing.pytestEnabled": false,
"python.testing.unittestEnabled": false,
// isort
"isort.path": ["ruff"],
"isort.args": ["--quiet"],
// Use Black for formatting
"python.formatting.provider": "black",
"python.formatting.blackArgs": ["--config", "${workspaceRoot}/pyproject.toml"],

"[python]": {
"editor.formatOnPaste": false,
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.organizeImports": "explicit"
}
},
"editor.defaultFormatter": "ms-python.black-formatter"
},
"black-formatter.args": ["--line-length", "110"],

"search.useIgnoreFiles": true,
"python.linting.enabled": true,
}
Original file line number Diff line number Diff line change
Expand Up @@ -102,18 +102,14 @@ class ProcessedDataDocument:
viability__cell_counter_: TQuantityValuePercent
viable_cell_density__cell_counter_: TQuantityValueMillionCellsPerMilliliter
total_cell_count: TQuantityValueCell
total_cell_density__cell_counter_: TQuantityValueMillionCellsPerMilliliter | None = (
None
)
total_cell_density__cell_counter_: TQuantityValueMillionCellsPerMilliliter | None = None
dead_cell_density__cell_counter_: TQuantityValueMillionCellsPerMilliliter | None = (
None
)
average_total_cell_diameter: TQuantityValueMicrometer | None = None
average_live_cell_diameter__cell_counter_: TQuantityValueMicrometer | None = None
average_dead_cell_diameter__cell_counter_: TQuantityValueMicrometer | None = None
total_cell_diameter_distribution_data_cube: TotalCellDiameterDistributionDataCube | None = (
None
)
total_cell_diameter_distribution_data_cube: TotalCellDiameterDistributionDataCube | None = None
viable_cell_count: TQuantityValueCell | None = None
dead_cell_count: TQuantityValueCell | None = None
average_total_cell_circularity: TQuantityValueUnitless | None = None
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -318,9 +318,7 @@ class ProcessedDataDocumentItem1:
data_processing_document: DataProcessingDocument | None = None
data_source_aggregate_document: DataSourceAggregateDocument | None = None
processed_data_identifier: TStringValue | None = None
fluorescent_tag_positive_cell_density: TQuantityValueMillionCellsPerMilliliter | None = (
None
)
fluorescent_tag_positive_cell_density: TQuantityValueMillionCellsPerMilliliter | None = None
fluorescent_tag_positive_percentage: TQuantityValuePercent | None = None
field_index: int | None = None

Expand Down Expand Up @@ -429,9 +427,7 @@ class ProcessedDataDocumentItem:
data_processing_document: DataProcessingDocument | None = None
data_source_aggregate_document: DataSourceAggregateDocument | None = None
processed_data_identifier: TStringValue | None = None
total_cell_density__cell_counter_: TQuantityValueMillionCellsPerMilliliter | None = (
None
)
total_cell_density__cell_counter_: TQuantityValueMillionCellsPerMilliliter | None = None
dead_cell_density__cell_counter_: TQuantityValueMillionCellsPerMilliliter | None = (
None
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,7 @@ class SampleDocument:
@dataclass
class AnalyteDocumentItem:
analyte_name: TStringValue
molar_concentration: TNullableQuantityValueMillimolePerLiter | TNullableQuantityValueGramPerLiter | TNullableQuantityValueUnitPerLiter | None = (
None
)
molar_concentration: TNullableQuantityValueMillimolePerLiter | TNullableQuantityValueGramPerLiter | TNullableQuantityValueUnitPerLiter | None = None


@dataclass
Expand All @@ -66,21 +64,11 @@ class MeasurementDocumentItem:
pH: TNullableQuantityValuePH | None = None
osmolality: TNullableQuantityValueMilliOsmolesPerKilogram | None = None
viability__cell_counter_: TNullableQuantityValuePercent | None = None
total_cell_density__cell_counter_: TNullableQuantityValueMillionCellsPerMilliliter | None = (
None
)
viable_cell_density__cell_counter_: TNullableQuantityValueMillionCellsPerMilliliter | None = (
None
)
average_live_cell_diameter__cell_counter_: TNullableQuantityValueMicrometer | None = (
None
)
average_total_cell_diameter__cell_counter_: TNullableQuantityValueMicrometer | None = (
None
)
total_cell_diameter_distribution__cell_counter_: TNullableQuantityValueTODO | None = (
None
)
total_cell_density__cell_counter_: TNullableQuantityValueMillionCellsPerMilliliter | None = None
viable_cell_density__cell_counter_: TNullableQuantityValueMillionCellsPerMilliliter | None = None
average_live_cell_diameter__cell_counter_: TNullableQuantityValueMicrometer | None = None
average_total_cell_diameter__cell_counter_: TNullableQuantityValueMicrometer | None = None
total_cell_diameter_distribution__cell_counter_: TNullableQuantityValueTODO | None = None
viable_cell_count__cell_counter_: TNullableQuantityValueCell | None = None
total_cell_count__cell_counter_: TNullableQuantityValueCell | None = None

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,8 @@ class DeviceControlDocumentItem:
detection_type: TStringValue | None = None
electronic_absorbance_wavelength_setting: TQuantityValueNanometer | None = None
electronic_absorbance_bandwidth_setting: TQuantityValueNanometer | None = None
electronic_absorbance_reference_bandwidth_setting: TQuantityValueNanometer | None = (
None
)
electronic_absorbance_reference_wavelength_setting: TQuantityValueNanometer | None = (
None
)
electronic_absorbance_reference_bandwidth_setting: TQuantityValueNanometer | None = None
electronic_absorbance_reference_wavelength_setting: TQuantityValueNanometer | None = None
detector_offset_setting: TQuantityValue | None = None
detector_sampling_rate_setting: TQuantityValueHertz | None = None
field_index: int | None = None
Expand Down Expand Up @@ -148,7 +144,5 @@ class LiquidChromatographyAggregateDocument:

@dataclass
class Model:
liquid_chromatography_aggregate_document: LiquidChromatographyAggregateDocument | None = (
None
)
liquid_chromatography_aggregate_document: LiquidChromatographyAggregateDocument | None = None
manifest: str = "http://purl.allotrope.org/manifests/liquid-chromatography/REC/2023/03/liquid-chromatography.manifest"
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,4 @@ class MultiAnalyteProfilingAggregateDocument:
@dataclass
class Model(Asm):
field_asm_manifest: str | Manifest
multi_analyte_profiling_aggregate_document: MultiAnalyteProfilingAggregateDocument | None = (
None
)
multi_analyte_profiling_aggregate_document: MultiAnalyteProfilingAggregateDocument | None = None
Original file line number Diff line number Diff line change
Expand Up @@ -423,12 +423,8 @@ class UltravioletAbsorbancePointDetectionDeviceControlDocumentItem(
detector_bandwidth_setting: TQuantityValueNanometer | None = None
electronic_absorbance_wavelength_setting: TQuantityValueNanometer | None = None
electronic_absorbance_bandwidth_setting: TQuantityValueNanometer | None = None
electronic_absorbance_reference_bandwidth_setting: TQuantityValueNanometer | None = (
None
)
electronic_absorbance_reference_wavelength_setting: TQuantityValueNanometer | None = (
None
)
electronic_absorbance_reference_bandwidth_setting: TQuantityValueNanometer | None = None
electronic_absorbance_reference_wavelength_setting: TQuantityValueNanometer | None = None
field_index: int | None = None


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,35 +51,17 @@ class PeakItem:
chromatographic_peak_asymmetry_factor: TQuantityValueUnitless | None = None
asymmetry_factor_measured_at_baseline: TQuantityValueUnitless | None = None
chromatographic_peak_resolution: TQuantityValueUnitless | None = None
chromatographic_peak_resolution_using_baseline_peak_widths: TQuantityValueUnitless | None = (
None
)
chromatographic_peak_resolution_using_peak_width_at_half_height: TQuantityValueUnitless | None = (
None
)
chromatographic_peak_resolution_using_statistical_moments: TQuantityValueUnitless | None = (
None
)
chromatographic_peak_resolution_using_baseline_peak_widths: TQuantityValueUnitless | None = None
chromatographic_peak_resolution_using_peak_width_at_half_height: TQuantityValueUnitless | None = None
chromatographic_peak_resolution_using_statistical_moments: TQuantityValueUnitless | None = None
number_of_theoretical_plates__chromatography_: TQuantityValueUnitless | None = None
number_of_theoretical_plates_measured_at_60_7___of_peak_height: TQuantityValueUnitless | None = (
None
)
number_of_theoretical_plates_measured_at_32_4___of_peak_height: TQuantityValueUnitless | None = (
None
)
number_of_theoretical_plates_measured_at_13_4___of_peak_height: TQuantityValueUnitless | None = (
None
)
number_of_theoretical_plates_measured_at_4_4___of_peak_height: TQuantityValueUnitless | None = (
None
)
number_of_theoretical_plates_measured_at_60_7___of_peak_height: TQuantityValueUnitless | None = None
number_of_theoretical_plates_measured_at_32_4___of_peak_height: TQuantityValueUnitless | None = None
number_of_theoretical_plates_measured_at_13_4___of_peak_height: TQuantityValueUnitless | None = None
number_of_theoretical_plates_measured_at_4_4___of_peak_height: TQuantityValueUnitless | None = None
number_of_theoretical_plates_by_tangent_method: TQuantityValueUnitless | None = None
number_of_theoretical_plates_by_peak_width_at_half_height: TQuantityValueUnitless | None = (
None
)
number_of_theoretical_plates_by_peak_width_at_half_height__JP14_: TQuantityValueUnitless | None = (
None
)
number_of_theoretical_plates_by_peak_width_at_half_height: TQuantityValueUnitless | None = None
number_of_theoretical_plates_by_peak_width_at_half_height__JP14_: TQuantityValueUnitless | None = None

def __post_init__(self) -> None:
any_of_keys = [
Expand Down
13 changes: 6 additions & 7 deletions src/allotropy/allotrope/models/shared/definitions/definitions.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

from dataclasses import dataclass
from enum import Enum
from typing import Union

from allotropy.exceptions import AllotropeConversionError

Expand All @@ -27,16 +26,16 @@ class TStringValueItem:

TBooleanArray = list[bool]
TBooleanOrNullArray = list[bool | None]
TBooleanValue = Union[bool, TBooleanValueItem]
TBooleanValue = bool | TBooleanValueItem
TClass = str
TDateTimeValue = Union[str, TDateTimeValueItem]
TDateTimeValue = str | TDateTimeValueItem
# TODO(brian): inline this
TDateTimeStampValue = TDateTimeValue
TNumberArray = list[float]
TNumberOrNullArray = list[float | None]
TStringArray = list[str]
TStringOrNullArray = list[str | None]
TStringValue = Union[str, TStringValueItem]
TStringValue = str | TStringValueItem
TTupleData = list[float | bool | str | None]
TUnit = str

Expand All @@ -62,7 +61,7 @@ class InvalidJsonFloat(Enum):
field_Infinity_1 = "-Infinity"


JsonFloat = Union[float, InvalidJsonFloat]
JsonFloat = float | InvalidJsonFloat


@dataclass
Expand Down Expand Up @@ -125,10 +124,10 @@ class TDatacubeComponent:
field_asm_fill_value: str | float | int | bool | None = None


TDimensionArray = Union[TNumberArray, TBooleanArray, TStringArray]
TDimensionArray = TNumberArray | TBooleanArray | TStringArray


TMeasureArray = Union[TNumberOrNullArray, TBooleanOrNullArray, TStringOrNullArray]
TMeasureArray = TNumberOrNullArray | TBooleanOrNullArray | TStringOrNullArray


@dataclass
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -356,9 +356,7 @@ class ProcessedDataDocumentItem:
data_processing_document: DataProcessingDocument | None = None
data_source_aggregate_document: DataSourceAggregateDocument | None = None
processed_data_identifier: TStringValue | None = None
mass_concentration: TQuantityValueNanogramPerMicroliter | TQuantityValueMicrogramPerMicroliter | TQuantityValuePicogramPerMilliliter | TQuantityValueNanogramPerMilliliter | TQuantityValueMicrogramPerMilliliter | TQuantityValueMilligramPerMilliliter | None = (
None
)
mass_concentration: TQuantityValueNanogramPerMicroliter | TQuantityValueMicrogramPerMicroliter | TQuantityValuePicogramPerMilliliter | TQuantityValueNanogramPerMilliliter | TQuantityValueMicrogramPerMilliliter | TQuantityValueMilligramPerMilliliter | None = None
field_index: int | None = None


Expand Down Expand Up @@ -393,12 +391,8 @@ class UltravioletAbsorbancePointDetectionDeviceControlDocumentItem(
detector_bandwidth_setting: TQuantityValueNanometer | None = None
electronic_absorbance_wavelength_setting: TQuantityValueNanometer | None = None
electronic_absorbance_bandwidth_setting: TQuantityValueNanometer | None = None
electronic_absorbance_reference_bandwidth_setting: TQuantityValueNanometer | None = (
None
)
electronic_absorbance_reference_wavelength_setting: TQuantityValueNanometer | None = (
None
)
electronic_absorbance_reference_bandwidth_setting: TQuantityValueNanometer | None = None
electronic_absorbance_reference_wavelength_setting: TQuantityValueNanometer | None = None
field_index: int | None = None


Expand Down
3 changes: 1 addition & 2 deletions src/allotropy/allotrope/schema_parser/backup_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@
from itertools import zip_longest
from pathlib import Path
import shutil
from typing import Union

PathType = Union[Path, str]
PathType = Path | str


def _files_equal(path1: PathType, path2: PathType) -> bool:
Expand Down
8 changes: 6 additions & 2 deletions src/allotropy/allotrope/schema_parser/generate_schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,14 @@ def lint_file(model_path: str) -> None:
)
# The second call to ruff checks for additional rules.
subprocess.check_call(
f"ruff {model_path} --fix", shell=True, stdout=subprocess.DEVNULL # noqa: S602
f"ruff {model_path} --fix",
shell=True, # noqa: S602
stdout=subprocess.DEVNULL,
)
subprocess.check_call(
f"black {model_path}", shell=True, stderr=subprocess.DEVNULL # noqa: S602
f"black {model_path}",
shell=True, # noqa: S602
stderr=subprocess.DEVNULL,
)


Expand Down
Loading

0 comments on commit f222595

Please sign in to comment.