Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue/105 improvments fixes #138

Merged
merged 26 commits into from
Jan 9, 2025
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
6 changes: 6 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
FROM mcr.microsoft.com/devcontainers/python:3.12

ENV PYTHONUNBUFFERED 1

# Install Python Deps
RUN pip install --upgrade pip pre-commit poetry
47 changes: 47 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
{
"name": "pyAKI",
"dockerComposeFile": "docker-compose.yml",
"service": "pyaki",
"workspaceFolder": "/workspaces",
"remoteUser": "vscode",
"postCreateCommand": "bash .devcontainer/scripts/post-create.sh",
"postStartCommand": "bash .devcontainer/scripts/post-start.sh",
"customizations": {
"vscode": {
"extensions": [
"ms-python.python",
"ms-python.mypy-type-checker",
"tamasfe.even-better-toml",
"charliermarsh.ruff",
"ryanluker.vscode-coverage-gutters",
"GitHub.copilot",
"GitHub.copilot-chat",
"ms-vsliveshare.vsliveshare",
"GitHub.vscode-pull-request-github",
"github.vscode-github-actions",
"ms-toolsai.jupyter"
],
"settings": {
"[python]": {
"editor.defaultFormatter": "charliermarsh.ruff",
"editor.codeActionsOnSave": {
"source.fixAll": true,
"source.organizeImports": true
},
"files.eol": "\n"
},
"mypy-type-checker.importStrategy": "fromEnvironment",
"mypy-type-checker.args": [
"--config-file=${workspaceFolder}/pyproject.toml"
],
"python.analysis.typeCheckingMode": "basic",
"coverage-gutters.coverageBaseDir": "/workspaces/pyAKI",
"coverage-gutters.coverageFileNames": [
"coverage.xml"
]
}
}
},
"forwardPorts": [],
"initializeCommand": "bash .devcontainer/scripts/initialize.sh"
}
17 changes: 17 additions & 0 deletions .devcontainer/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
version: '3.8'

services:
pyaki:
container_name: pyaki

init: true
build:
context: ..
dockerfile: .devcontainer/Dockerfile
environment:
- no_proxy="127.0.0.1,localhost"
- NO_PROXY="127.0.0.1,localhost"
volumes:
- ..:/workspaces:cached
# Overrides default command so things don't shut down after the process ends.
command: sleep infinity
1 change: 1 addition & 0 deletions .devcontainer/scripts/initialize.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
docker pull mcr.microsoft.com/devcontainers/python:3.13
5 changes: 5 additions & 0 deletions .devcontainer/scripts/post-create.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Add bash-completion's
echo "source /usr/share/bash-completion/completions/git" >> ~/.bashrc

# install deps
pre-commit install
1 change: 1 addition & 0 deletions .devcontainer/scripts/post-start.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
poetry install --with dev
10 changes: 9 additions & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,19 @@

version: 2
updates:
- package-ecosystem: "docker"
directory: "/"
schedule:
interval: "daily"
- package-ecosystem: "devcontainers"
directory: "/"
schedule:
interval: "daily"
- package-ecosystem: "github-actions" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "daily"
- package-ecosystem: "pip"
directory: "/"
schedule:
interval: "daily"
interval: "daily"
38 changes: 0 additions & 38 deletions .github/workflows/lint_and_test.yml

This file was deleted.

45 changes: 45 additions & 0 deletions .github/workflows/python_cd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions

name: Continuous Delivery (Python)
on:
release:
types: [published]

jobs:
build:
environment: pyaki
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.12"] # Add more Python versions to test here

steps:
- uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Cache Virtual Environment
uses: actions/cache@v4
with:
path: |
.venv
~/.cache/pip
~/.cache/pypoetry
key: ${{ runner.os }}-venv-${{ hashFiles('poetry.lock') }}

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install poetry
poetry install --with dev

- name: Build and publish Package
run: |
poetry version ${{ github.ref_name }}
poetry publish --skip-existing --build
env:
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_TOKEN }}
52 changes: 52 additions & 0 deletions .github/workflows/python_ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions

name: Continuous Integration (Python)
on:
push:
branches: [ main, develop ]
pull_request:
branches: [ main, develop ]

jobs:
build:
environment: pyaki
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.12"] # Add more Python versions to test here

steps:
- uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Cache Virtual Environment
uses: actions/cache@v4
with:
path: |
.venv
~/.cache/pip
~/.cache/pypoetry
key: ${{ runner.os }}-venv-${{ hashFiles('poetry.lock') }}

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install poetry
poetry install --with dev

- name: Lint with ruff
run: poetry run ruff check .
- name: Check types with mypy
run: poetry run mypy .
- name: Test with pytest
run: poetry run pytest .

- name: Coveralls
run: poetry run coveralls
env:
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
3 changes: 0 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# env
.vscode
results
paper
.DS_Store
Expand Down Expand Up @@ -164,5 +163,3 @@ cython_debug/
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/

/tests/data/*
24 changes: 24 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# https://pre-commit.com/
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: fix-byte-order-marker
- id: trailing-whitespace
- id: end-of-file-fixer
- id: detect-private-key
- id: check-case-conflict
- id: check-toml
- id: check-json
- id: check-yaml
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.2.1
hooks:
- id: ruff
args: [ --fix ]
- id: ruff-format
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.8.0
hooks:
- id: mypy
exclude: "^tests/.*"
76 changes: 76 additions & 0 deletions .ruff.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
# Exclude a variety of commonly ignored directories.
exclude = [
".bzr",
".direnv",
".eggs",
".git",
".git-rewrite",
".hg",
".ipynb_checkpoints",
".mypy_cache",
".nox",
".pants.d",
".pyenv",
".pytest_cache",
".pytype",
".ruff_cache",
".svn",
".tox",
".venv",
".vscode",
"__pypackages__",
"_build",
"buck-out",
"build",
"dist",
"node_modules",
"site-packages",
"venv",
]

line-length = 120
indent-width = 4

# Assume Python 3.12
target-version = "py312"

[lint]
# Enable Pyflakes (`F`) and a subset of the pycodestyle (`E`) codes by default.
# Unlike Flake8, Ruff doesn't enable pycodestyle warnings (`W`) or
# McCabe complexity (`C901`) by default.
select = ["E4", "E7", "E9", "F"]
ignore = []

# Allow fix for all enabled rules (when `--fix`) is provided.
fixable = ["ALL"]
unfixable = []

# Allow unused variables when underscore-prefixed.
dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"

[format]
# Like Black, use double quotes for strings.
quote-style = "double"

# Like Black, indent with spaces, rather than tabs.
indent-style = "space"

# Like Black, respect magic trailing commas.
skip-magic-trailing-comma = false

# Like Black, automatically detect the appropriate line ending.
line-ending = "auto"

# Enable auto-formatting of code examples in docstrings. Markdown,
# reStructuredText code/literal blocks and doctests are all supported.
#
# This is currently disabled by default, but it is planned for this
# to be opt-out in the future.
docstring-code-format = false

# Set the line length limit used when formatting code snippets in
# docstrings.
#
# This only has an effect when the `docstring-code-format` setting is
# enabled.
docstring-code-line-length = "dynamic"
4 changes: 4 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"python.testing.unittestEnabled": false,
"python.testing.pytestEnabled": true
}
17 changes: 17 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "run pre-commit",
"type": "shell",
"command": "pre-commit run --all-files",
"problemMatcher": []
},
{
"label": "update pre-commit",
"type": "shell",
"command": "pre-commit autoupdate",
"problemMatcher": []
}
]
}
1 change: 0 additions & 1 deletion AUTHORS
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

might want to add your full name here?

Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
Christian Porschen <[email protected]>
Jan Ernsting <[email protected]>
Paul <[email protected]>
Paul-B98 <[email protected]>
aegis301 <[email protected]>
dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Loading
Loading