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
192 changes: 192 additions & 0 deletions .github/workflows/test_and_publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,192 @@
name: Tests

on:
push:
branches:
- main
- '*.*.*'

pull_request:
branches:
- main
- '*.*.*'

release:
types: [ published ]

jobs:

autoflake:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Setup Python
uses: actions/setup-python@master
with:
python-version: '3.14'
Comment thread
qcoumes marked this conversation as resolved.

- name: Install Poetry
uses: snok/install-poetry@v1

- name: Install packages
run: poetry install --with=dev --no-root

- name: Autoflake
run: |
poetry run autoflake kasm/ -r --check-diff

black:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Setup Python
Comment thread
qcoumes marked this conversation as resolved.
uses: actions/setup-python@master
with:
python-version: '3.14'

- name: Install Poetry
uses: snok/install-poetry@v1

- name: Install packages
run: poetry install --with=dev --no-root

- name: Black
run: |
poetry run black --check -l 120 kasm/

isort:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Comment thread
qcoumes marked this conversation as resolved.

- name: Setup Python
uses: actions/setup-python@master
with:
python-version: '3.14'

- name: Install Poetry
uses: snok/install-poetry@v1

- name: Install packages
run: poetry install --with=dev --no-root

- name: Isort
run: |
poetry run isort --check kasm/

pycodestyle:
Comment thread
qcoumes marked this conversation as resolved.
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Setup Python
uses: actions/setup-python@master
with:
python-version: '3.14'

- name: Install Poetry
uses: snok/install-poetry@v1

- name: Install packages
run: poetry install --with=dev --no-root

- name: Pycodestyle
run: |
poetry run pycodestyle kasm/

pydocstyle:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Setup Python
uses: actions/setup-python@master
with:
python-version: '3.14'

- name: Install Poetry
uses: snok/install-poetry@v1

- name: Install packages
run: poetry install --with=dev --no-root

- name: Pydocstyle
run: |
poetry run pydocstyle --count kasm/

mypy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Setup Python
uses: actions/setup-python@master
with:
python-version: '3.14'

- name: Install Poetry
uses: snok/install-poetry@v1
Comment thread
qcoumes marked this conversation as resolved.

- name: Install packages
run: poetry install --with=dev --no-root

- name: Mypy
run: |
poetry run mypy kasm --disallow-untyped-def

bandit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Setup Python
uses: actions/setup-python@master
with:
python-version: '3.14'

- name: Install Poetry
uses: snok/install-poetry@v1

- name: Install packages
run: poetry install --with=dev --no-root

- name: Bandit
run: |
poetry run bandit --ini=setup.cfg -ll 2> /dev/null

# publish:
# needs: [ autoflake, black, isort, pycodestyle, pydocstyle, mypy, bandit ]
# if: github.event_name == 'release' && github.event.action == 'published'
# runs-on: ubuntu-latest
# continue-on-error: true
# environment:
# name: pypi
# url: https://pypi.org/p/pykasm
# permissions:
# id-token: write
#
# steps:
# - uses: actions/checkout@master
#
# - name: Set up Python 3.13
# uses: actions/setup-python@v4
# with:
# python-version: '3.14'
#
# - name: Install Poetry
# run: |
# curl -sSL https://install.python-poetry.org | python3 -
# echo "$HOME/.local/bin" >> $GITHUB_PATH
#
# - name: Build the package
# run: poetry build
#
# - name: Verify metadata
# run: |
# python -m pip install twine
# python -m twine check dist/*
#
# - name: Publish distribution to PyPI
# uses: pypa/gh-action-pypi-publish@release/v1
10 changes: 8 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
poetry.lock

# IDE
.vscode
.idea

# Byte-compiled / optimized / DLL files
__pycache__/
*.py[codz]
Expand Down Expand Up @@ -182,9 +188,9 @@ cython_debug/
.abstra/

# Visual Studio Code
# Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
# Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
# that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
# and can be added to the global gitignore or merged into this file. However, if you prefer,
# and can be added to the global gitignore or merged into this file. However, if you prefer,
# you could uncomment the following to ignore the entire vscode folder
# .vscode/

Expand Down
99 changes: 99 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
# Contributing

Contributions are welcome, and they are greatly appreciated! Every little bit helps, and credit will always be given.

You can contribute in many ways:

## Types of Contributions

### Report Bugs

Report bugs at https://github.com/Codoc-os/pykasm.

If you are reporting a bug, please include:

* Your operating system name and version.
* Any details about your local setup that might be helpful in troubleshooting.
* Detailed steps to reproduce the bug.

### Fix Bugs

Look through the GitHub issues for bugs. Anything tagged with "bug"
is open to whoever wants to implement it.

### Implement Features

Look through the GitHub issues for features. Anything tagged with "feature"
is open to whoever wants to implement it.

### Write Documentation

PyKasm could always use more documentation, whether as part of the official PyKasm docs,
in docstrings, or even on the web in blog posts, articles, and such.

### Submit Feedback

The best way to send feedback is to file an issue at https://github.com/Codoc-os/pykasm/issues.

If you are proposing a feature:

* Explain in detail how it would work.
* Keep the scope as narrow as possible, to make it easier to implement.
* Remember that this is a volunteer-driven project, and that contributions are welcome :)

---

## Setting up local environment

Ready to contribute? Here's how to set up `pykasm` for local development.

1. Fork the `pykasm` repo on GitHub.

2. Clone your fork locally:

* `git clone git@github.com:<your_name_here>/pykasm.git`

3. Install your local copy into a virtualenv.

```shell
python3 -m venv venv
source venv/bin/activate
pip3 install poetry
poetry install --with=dev --no-root
```

4. Create a branch for local development:

* `git checkout -b name-of-your-bugfix-or-feature`

Now you can make your changes locally.

## Submitting your changes

1. Ensure your code is correctly formatted and documented:

```sh
poetry run ./bin/lint.sh
```

2. Commit your changes and push your branch to GitHub:

```sh
git add .
git commit -m "Your detailed description of your changes."
git push origin name-of-your-bugfix-or-feature
```

3. Submit a pull request through the GitHub website.

## Pull Request Guidelines

Before you submit a pull request, check that it meets these guidelines:

1. The pull request should include tests

2. If the pull request adds functionality, the documentation should be updated.

3. The pull request should pass all checks and tests. Check
https://github.com/qcoumes/pykasm/actions
and make sure that the tests pass for all supported Python versions.
11 changes: 11 additions & 0 deletions bin/colors.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash

# Reset
Color_Off=$'\e[0m' # Text Reset

# Regular Colors
Red=$'\e[0;31m' # Red
Green=$'\e[0;32m' # Green
Yellow=$'\e[0;33m' # Yellow
Purple=$'\e[0;35m' # Purple
Cyan=$'\e[0;36m' # Cyan
Loading
Loading