Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions .github/workflows/test-core.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Check swanlab-core

on:
pull_request:
paths:
- core/**


jobs:
check-and-test:
strategy:
matrix:
go: [stable, '1.24.4']
os: [ubuntu-latest, macos-latest, windows-latest]
name: Check and Test Go Core on ${{ matrix.os }} with Go ${{ matrix.go }}
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Go environment
uses: actions/[email protected]
with:
go-version: ${{ matrix.go }}
cache: 'true'

- name: Golangci-lint
uses: golangci/[email protected]
with:
working-directory: 'core'

1 change: 1 addition & 0 deletions core/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
../LICENSE
48 changes: 48 additions & 0 deletions core/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<div align="center">
<picture>
<source media="(prefers-color-scheme: dark)" srcset="../readme_files/swanlab-logo-single-dark.svg">
<source media="(prefers-color-scheme: light)" srcset="../readme_files/swanlab-logo-single.svg">
<img alt="SwanLab" src="../readme_files/swanlab-logo-single.svg" width="70" height="70">
</picture>
</div>

# swanlab-core: A new backend for SwanLab SDK

To address the challenges posed by Python's asynchronous programming, we introduced swanlab-core, a brand-new, Go-based backend for metric uploading.


## IDE & Development Setup

In this part, we will guide you through the process of setting up your IDE and development environment for SwanLab SDK.
We will use:
1. [GoLand](https://www.jetbrains.com/go/) as the IDE.
2. [Go](https://go.dev/) as the programming language.
3. [golangci-lint](https://golangci-lint.run/) as the linter.

## IDE

We request using GoLand as the IDE for swanlab-core development.
It provides a rich set of features for Go development, including code completion, debugging, and integration with version control systems.

There is the code template for Go file in GoLand:

```text
package ${GO_PACKAGE_NAME}

// @Title ${FILE_NAME}
// @Description
// @Create cunyue ${DATE} ${TIME}
```

## Linter

We use [golangci-lint](https://golangci-lint.run/) as the linter for swanlab-core development.
Since SwanLab is a Python project, some developers may not be very familiar with the Go language.
Therefore, golangci-lint is not mandatory and will only trigger this CI when changes are made to the core part.

If you plan to develop swanlab-core, configure the golangci-lint integration in GoLand, which can be found under Go -> Linter settings.

## Env

TODO

3 changes: 3 additions & 0 deletions core/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module github.com/SwanHubX/SwanLab/core

go 1.24.4
5 changes: 5 additions & 0 deletions core/internal/api/api.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package api

// @Title api.go
// @Description SwanLab API intended for requests to the SwanLab-Server.
// @Create cunyue 2025/6/10 13:00
Loading