Skip to content

Commit 1f72c7d

Browse files
feat: add development guide, CI/CD workflows, and enhance project structure
- Introduced a comprehensive development guide in GUIDE.md. - Added CI/CD workflows for continuous integration and deployment. - Configured release drafter for automated release notes. - Updated .gitignore to exclude generated files. - Enhanced pyproject.toml with additional metadata and dependencies. - Refactored CLI and core modules for improved type safety and structure. - Added licensing information to relevant files. - Removed deprecated _version.py file and replaced it with a new versioning approach.
1 parent fa029c6 commit 1f72c7d

File tree

17 files changed

+847
-73
lines changed

17 files changed

+847
-73
lines changed

.github/release-drafter.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
# yaml-language-server: $schema=https://raw.githubusercontent.com/release-drafter/release-drafter/refs/heads/master/schema.json
3+
# Configuration for Release Drafter: https://github.com/release-drafter/release-drafter
4+
name-template: '$RESOLVED_VERSION 🌈'
5+
tag-template: '$RESOLVED_VERSION'
6+
template: |
7+
## What's Changed
8+
9+
$CHANGES
10+
exclude-labels:
11+
- 'skip-changelog'
12+
- 'invalid'

.github/workflows/cd.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
---
2+
name: CD
3+
on:
4+
workflow_dispatch:
5+
release:
6+
types: [published]
7+
jobs:
8+
publish-pypi:
9+
runs-on: ubuntu-latest
10+
name: Publish on PyPI
11+
permissions:
12+
id-token: write # IMPORTANT: Mandatory for Trusted Publishing (gh-action-pypi-publish)
13+
contents: write # IMPORTANT: Mandatory for GitHub Release
14+
# Specifying a GitHub environment is optional, but strongly encouraged
15+
environment:
16+
name: publish
17+
url: https://pypi.org/project/ossin/${{ github.ref_name }}
18+
steps:
19+
- name: Checkout repository
20+
uses: actions/checkout@v5
21+
with:
22+
fetch-depth: 0
23+
- name: Set up Python
24+
uses: actions/setup-python@v5
25+
with:
26+
python-version-file: '.python-version'
27+
- name: Setup uv
28+
id: setup-uv
29+
uses: astral-sh/setup-uv@v6
30+
with:
31+
enable-cache: true
32+
- name: Restore cache
33+
if: steps.setup-uv.outputs.cache-hit == 'true'
34+
run: echo "Cache was restored"
35+
- name: Build the Package
36+
run: uv build --no-sources --quiet
37+
- name: Publish to PyPI
38+
run: uv publish --quiet --trusted-publishing always
39+
- name: Attach Build Artifacts to GitHub Release
40+
env:
41+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
42+
run: gh release upload ${{ github.ref_name }} ./dist/* --clobber
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
---
2+
name: Lint PR
3+
on:
4+
pull_request_target:
5+
types: [opened, edited, synchronize, reopened]
6+
jobs:
7+
main:
8+
name: Validate PR title
9+
runs-on: ubuntu-latest
10+
permissions:
11+
pull-requests: write
12+
steps:
13+
- name: Lint PR Title
14+
uses: amannn/action-semantic-pull-request@v5
15+
id: lint_pr_title
16+
env:
17+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
18+
- uses: marocchino/sticky-pull-request-comment@v2.9.4
19+
# When the previous steps fails, the workflow would stop. By adding this
20+
# condition you can continue the execution with the populated error message.
21+
if: always() && (steps.lint_pr_title.outputs.error_message != null)
22+
with:
23+
header: pr-title-lint-error
24+
message: |
25+
Hey there and thank you for opening this pull request! 👋🏼
26+
27+
We require pull request titles to follow the [Conventional Commits specification](https://www.conventionalcommits.org/en/v1.0.0/) and it looks like your proposed title needs to be adjusted.
28+
29+
Details:
30+
31+
```
32+
${{ steps.lint_pr_title.outputs.error_message }}
33+
```
34+
# Delete a previous comment when the issue has been resolved
35+
- if: ${{ steps.lint_pr_title.outputs.error_message == null }}
36+
uses: marocchino/sticky-pull-request-comment@v2
37+
with:
38+
header: pr-title-lint-error
39+
delete: true

.github/workflows/ci.yml

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
---
2+
name: CI
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches: [main, master]
7+
pull_request:
8+
branches: [main, master]
9+
jobs:
10+
ci:
11+
strategy:
12+
fail-fast: false
13+
matrix:
14+
os: [windows-latest, ubuntu-latest, macos-latest]
15+
runs-on: ${{ matrix.os }}
16+
name: Run ossin on ${{ matrix.os }}
17+
timeout-minutes: 5
18+
steps:
19+
- name: System Info
20+
shell: bash
21+
run: |
22+
if [[ ${{ matrix.os }} == "ubuntu-latest" ]]; then
23+
echo "The system is Linux."
24+
uname -a || true
25+
lsb_release -a || true
26+
gcc --version || true
27+
elif [[ ${{ matrix.os }} == "macos-latest" ]]; then
28+
echo "The system is macOS."
29+
sw_vers || true
30+
uname -a || true
31+
gcc --version || true
32+
elif [[ ${{ matrix.os }} == "windows-latest" ]]; then
33+
echo "The system is Windows (using a Unix-like environment)."
34+
systeminfo || true
35+
else
36+
echo "Unknown OS: $OS_TYPE"
37+
exit 1
38+
fi
39+
- name: Environment Info
40+
run: |
41+
env || true
42+
- name: Checkout repository
43+
uses: actions/checkout@v5
44+
- name: Set up Python
45+
uses: actions/setup-python@v5
46+
with:
47+
python-version-file: '.python-version'
48+
- name: Setup uv
49+
id: setup-uv
50+
uses: astral-sh/setup-uv@v5
51+
with:
52+
enable-cache: true
53+
- name: Restore cache
54+
if: steps.setup-uv.outputs.cache-hit == 'true'
55+
run: echo "Cache was restored"
56+
- name: Run CI
57+
if: ${{ matrix.os == 'ubuntu-latest' }}
58+
run: |
59+
uv run ruff check
60+
uv run ruff format
61+
uv run mypy
62+
uv run ty check
63+
uv run pyrefly check
64+
uv run pyright
65+
uv run vulture
66+
uv run validate-pyproject pyproject.toml
67+
- name: Run ossin
68+
run: |
69+
uv run ossin --version
70+
uv run ossin --no-color --format json
71+
uv run ossin --no-color --format panels
72+
uv run ossin --no-color --format table
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
---
2+
name: Release Drafter
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches: [main, master]
7+
pull_request:
8+
types: [opened, reopened, synchronize]
9+
pull_request_target:
10+
types: [opened, reopened, synchronize]
11+
permissions:
12+
contents: read
13+
jobs:
14+
update_release_draft:
15+
permissions:
16+
contents: write # IMPORTANT: Mandatory for Release Drafter (release-drafter)
17+
pull-requests: write # IMPORTANT: Mandatory for Release Drafter (release-drafter)
18+
runs-on: ubuntu-latest
19+
steps:
20+
- name: Draft a Release
21+
uses: release-drafter/release-drafter@v6
22+
env:
23+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -289,3 +289,7 @@ __marimo__/
289289

290290
# Streamlit
291291
.streamlit/secrets.toml
292+
293+
# Generated by Author
294+
src/**/_version.py
295+
.trunk/

GUIDE.md

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# Development Guide
2+
3+
## Commands
4+
5+
### install
6+
7+
```sh
8+
uv tool install hatch
9+
uv sync
10+
```
11+
12+
### init
13+
14+
```sh
15+
uv run hatch new <package-name>
16+
```
17+
18+
### bump
19+
20+
```sh
21+
uv run hatch version major/minor/patch
22+
```
23+
24+
### build
25+
26+
```sh
27+
uv run hatch build
28+
```
29+
30+
### unarchive-wheel
31+
32+
```sh
33+
uv run -m zipfile -e dist/<package-name>-<version>-py3-none-any.whl dist/<package-name>-<version>-unpacked
34+
# unzip dist/<package-name>-<version>-py3-none-any.whl -d dist/<package-name>-<version>-unpacked
35+
```
36+
37+
### unarchive-tar-gz
38+
39+
```sh
40+
uv run -m tarfile -e dist/<package-name>-<version>.tar.gz dist/<package-name>-<version>-unpacked
41+
# tar -xzf dist/<package-name>-<version>.tar.gz -C dist/<package-name>-<version>-unpacked
42+
```
43+
44+
### publish
45+
46+
```sh
47+
hatch publish --repo test --user __token__ --auth <token>
48+
```
49+
50+
### publish-test
51+
52+
```sh
53+
uv pip install --index-url https://test.pypi.org/simple/ <package-name>
54+
```

README.md

Lines changed: 33 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,10 @@ What is OS's sin? 🤔 A beautiful system information utility that displays basi
1717

1818
## Installation
1919

20-
### Using uv (recommended)
21-
2220
```sh
2321
uv add ossin
2422
```
2523

26-
### Using pip
27-
28-
```sh
29-
pip install ossin
30-
```
31-
3224
## Usage
3325

3426
### Basic Usage
@@ -99,28 +91,57 @@ ossin --help
9991
- **Modern CLI**: Built with Typer for excellent CLI experience with type hints and auto-completion
10092
- **Cross-platform**: Works on Windows, macOS, and Linux
10193

94+
<!-- xc-heading -->
10295
## Development
10396

104-
### Setup
97+
Clone the repository and cd into the project directory:
98+
99+
```sh
100+
git clone https://github.com/python-ankara-toplulugu/ossin
101+
cd ossin
102+
```
103+
104+
The commands below can also be executed using the [xc task runner](https://xcfile.dev/), which combines the usage instructions with the actual commands. Simply run `xc`, it will pop up an interactive menu with all available tasks.
105105

106-
Clone the repository and install dependencies using uv:
106+
### `install`
107+
108+
Install the dependencies:
107109

108110
```sh
109111
uv sync
110112
```
111113

112-
### Running the CLI
114+
### `start`
115+
116+
Start the CLI:
113117

114118
```sh
115119
uv run ossin
116120
```
117121

118-
### Running tests
122+
### `test`
123+
124+
Run the tests:
119125

120126
```sh
121127
uv run pytest
122128
```
123129

130+
### `ci`
131+
132+
Run the linters and type checkers:
133+
134+
```sh
135+
uv run ruff check
136+
uv run ruff format
137+
uv run mypy
138+
uv run ty check
139+
uv run pyrefly check
140+
uv run pyright
141+
uv run vulture
142+
uv run validate-pyproject pyproject.toml
143+
```
144+
124145
## License
125146

126147
`ossin` is distributed under the terms of the [MIT](https://spdx.org/licenses/MIT.html) license.

0 commit comments

Comments
 (0)