Skip to content

Commit

Permalink
added documentation and job to publish
Browse files Browse the repository at this point in the history
  • Loading branch information
dmy.berezovskyi committed Jan 2, 2025
1 parent 0cad139 commit 2f8b43b
Show file tree
Hide file tree
Showing 7 changed files with 111 additions and 38 deletions.
62 changes: 29 additions & 33 deletions .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,3 @@
# This workflow will upload a Python Package to PyPI when a release is created
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python#publishing-to-package-registries

# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.

name: Upload Python Package

on:
Expand All @@ -14,57 +6,61 @@ on:

permissions:
contents: read
id-token: write # Needed for trusted PyPI publishing.

jobs:
release-build:
name: Build Python Package
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
# Checkout the repository.
- name: Checkout Code
uses: actions/checkout@v4

- uses: actions/setup-python@v5
# Set up Python environment.
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.x"

- name: Build release distributions
# Install build tools and dependencies.
- name: Install Build Tools
run: |
# NOTE: put your own distribution build steps here.
python -m pip install build
python -m build
python -m pip install --upgrade pip setuptools wheel build
- name: Upload distributions
# Build the package distributions (source and wheel).
- name: Build Distributions
run: python -m build

# Upload the built distributions as artifacts for later use.
- name: Upload Distributions
uses: actions/upload-artifact@v4
with:
name: release-dists
name: release-distributions
path: dist/
retention-days: 7 # Keep artifacts for debugging for 7 days.

pypi-publish:
name: Publish to PyPI
runs-on: ubuntu-latest
needs:
- release-build
permissions:
# IMPORTANT: this permission is mandatory for trusted publishing
id-token: write

# Dedicated environments with protections for publishing are strongly recommended.
# For more information, see: https://docs.github.com/en/actions/deployment/targeting-different-environments/using-environments-for-deployment#deployment-protection-rules
needs: release-build
environment:
name: pypi
# OPTIONAL: uncomment and update to include your PyPI project URL in the deployment status:
# url: https://pypi.org/p/YOURPROJECT
#
# ALTERNATIVE: if your GitHub Release name is the PyPI project version string
# ALTERNATIVE: exactly, uncomment the following line instead:
# url: https://pypi.org/project/YOURPROJECT/${{ github.event.release.name }}
url: https://pypi.org/project/turbopi-fast-sdk/

steps:
- name: Retrieve release distributions
# Download the built distributions from the previous job.
- name: Download Distributions
uses: actions/download-artifact@v4
with:
name: release-dists
name: release-distributions
path: dist/

- name: Publish release distributions to PyPI
# Publish the distributions to PyPI.
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: dist/
env:
PYPI_API_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
7 changes: 7 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Copyright (c) 2011-2024 GitHub Inc.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ Wonder SDK is a Python library that facilitates communication with a Hiwonder Tu
## Installation
1. Clone the repository:
```bash
git clone
git clone https://github.com/dmberezovskyii/fast-hiwonder
12 changes: 8 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
[tool.poetry]
name = "fast-sdk"
version = "0.1.0"
name = "turbopi-fast-sdk"
version = "0.1.1"
description = "Python SDK for hiwonder TurboPi device communication"
authors = ["Dmytro Berezovskyi <dmberezovskyi@gmail.com>"]
license = "MIT"
repository = "https://github.com/dmberezovskyii/fast-hiwonder"
keywords = ["SDK", "TurboPi", "Python", "Hiwonder"]
readme = "README.md"

packages = [
{ include = "src" },
Expand All @@ -21,5 +25,5 @@ pyserial = "^3.5"
ruff = "^0.6.8"

[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"
requires = ["poetry-core>=1.0.0", "setuptools"]
build-backend = "poetry.core.masonry.api"
44 changes: 44 additions & 0 deletions ruff.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Ruff Configuration
line-length = 85
indent-width = 4
output-format = "grouped"
respect-gitignore = true
target-version = "py312"

[lint]
select = [
"E", # Error codes
"F", # Pyflakes
"W", # Warnings
"C", # Complexity
"N", # Naming conventions
"I", # Ignored errors
"E501", # Line too long
"N805", # First argument should be 'self'
]
fixable = ["ALL"] # All fixable errors will be automatically corrected

# Ignored Errors
ignore = [
"E731", # Do not assign a lambda expression, use a def instead
"N801", # Function name should be lowercase
"I001", # Import convention violation
"F631", # Assert should not be used with a literal
]

# Regular expression for dummy variables
dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"

# Excluded Directories and Files
exclude = [
".pytest_cache",
"poetry.lock",
"__pypackages__",
".git",
".env",
".ruff_cache"
]

[format]
exclude = ["__init__.py"] # Exclude __init__.py from formatting
skip-magic-trailing-comma = true # Skip the trailing comma for magic trailing commas
Empty file removed setup.cfg
Empty file.
22 changes: 22 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
from setuptools import setup, find_packages

setup(
name="turbopi_fast_sdk",
version="0.1.0",
description="Це Python SDK для керування апаратним забезпеченням Turbopi через швидку комунікацію.",
long_description=open('README.md').read(), # Довгий опис буде зчитуватися з README.md
long_description_content_type='text/markdown',
author="Ваше ім'я",
author_email="ваш_email@example.com",
license="MIT",
url="https://github.com/yourusername/turbopi_fast_sdk",
packages=find_packages(),
install_requires=[
# Ваші залежності
],
classifiers=[
"Programming Language :: Python :: 3.12",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
],
)

0 comments on commit 2f8b43b

Please sign in to comment.