build/publish pipeline
This commit is contained in:
parent
b0c6986511
commit
455bd34d3b
@ -1,18 +0,0 @@
|
|||||||
name: Gitea Actions Demo
|
|
||||||
run-name: ${{ gitea.actor }} is testing out Gitea Actions 🚀
|
|
||||||
on: [push]
|
|
||||||
jobs:
|
|
||||||
Explore-Gitea-Actions:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- run: echo "🎉 The job was automatically triggered by a ${{ gitea.event_name }} event."
|
|
||||||
- run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by Gitea!"
|
|
||||||
- run: echo "🔎 The name of your branch is ${{ gitea.ref }} and your repository is ${{ gitea.repository }}."
|
|
||||||
- name: Check out repository code
|
|
||||||
uses: actions/checkout@v3
|
|
||||||
- run: echo "💡 The ${{ gitea.repository }} repository has been cloned to the runner."
|
|
||||||
- run: echo "🖥️ The workflow is now ready to test your code on the runner."
|
|
||||||
- name: List files in the repository
|
|
||||||
run: |
|
|
||||||
ls ${{ gitea.workspace }}
|
|
||||||
- run: echo "🍏 This job's status is ${{ gitea.status }}."
|
|
||||||
50
.gitea/workflows/publish.yaml
Normal file
50
.gitea/workflows/publish.yaml
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
name: Publish to PyPI
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
tags:
|
||||||
|
- "*"
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
publish:
|
||||||
|
name: Publish to PyPI
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Setup Python
|
||||||
|
uses: actions/setup-python@v4
|
||||||
|
with:
|
||||||
|
python-version: "3.11.2"
|
||||||
|
|
||||||
|
- name: Setup Build Environment
|
||||||
|
run: python -m pip install --upgrade pip build
|
||||||
|
|
||||||
|
- name: Build Package
|
||||||
|
run: python -m build
|
||||||
|
|
||||||
|
- name: Publish Package
|
||||||
|
uses: pypa/gh-action-pypi-publish@v1
|
||||||
|
with:
|
||||||
|
password: ${{ secrets.PYPI_API_TOKEN }}
|
||||||
|
|
||||||
|
|
||||||
|
#name: Gitea Actions Demo
|
||||||
|
#run-name: ${{ gitea.actor }} is testing out Gitea Actions 🚀
|
||||||
|
#on: [push]
|
||||||
|
#jobs:
|
||||||
|
# Explore-Gitea-Actions:
|
||||||
|
# runs-on: ubuntu-latest
|
||||||
|
# steps:
|
||||||
|
# - run: echo "🎉 The job was automatically triggered by a ${{ gitea.event_name }} event."
|
||||||
|
# - run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by Gitea!"
|
||||||
|
# - run: echo "🔎 The name of your branch is ${{ gitea.ref }} and your repository is ${{ gitea.repository }}."
|
||||||
|
# - name: Check out repository code
|
||||||
|
# uses: actions/checkout@v3
|
||||||
|
# - run: echo "💡 The ${{ gitea.repository }} repository has been cloned to the runner."
|
||||||
|
# - run: echo "🖥️ The workflow is now ready to test your code on the runner."
|
||||||
|
# - name: List files in the repository
|
||||||
|
# run: |
|
||||||
|
# ls ${{ gitea.workspace }}
|
||||||
|
# - run: echo "🍏 This job's status is ${{ gitea.status }}."
|
||||||
|
#
|
||||||
6
LICENSE
6
LICENSE
@ -208,8 +208,8 @@ If you develop a new program, and you want it to be of the greatest possible use
|
|||||||
|
|
||||||
To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the “copyright” line and a pointer to where the full notice is found.
|
To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the “copyright” line and a pointer to where the full notice is found.
|
||||||
|
|
||||||
py-tools
|
shs-tools
|
||||||
Copyright (C) 2023 DF_Public
|
Copyright (C) 2023 Stefan Harmuth
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
||||||
|
|
||||||
@ -221,7 +221,7 @@ Also add information on how to contact you by electronic and paper mail.
|
|||||||
|
|
||||||
If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode:
|
If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode:
|
||||||
|
|
||||||
py-tools Copyright (C) 2023 DF_Public
|
shs-tools Copyright (C) 2023 Stefan Harmuth
|
||||||
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||||
This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details.
|
This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details.
|
||||||
|
|
||||||
|
|||||||
@ -1,2 +1,8 @@
|
|||||||
# py-tools
|
# py-tools
|
||||||
|
|
||||||
|
An assortment of helper functions, primarily developed for use in [Advent Of Code](https://adventofcode.com/)
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
`pip install shs-tools`
|
||||||
|
|
||||||
|
|||||||
@ -1,56 +0,0 @@
|
|||||||
from heapq import heappop, heappush
|
|
||||||
from tools.trees import MinHeap, BinarySearchTree
|
|
||||||
from tools.stopwatch import StopWatch
|
|
||||||
|
|
||||||
|
|
||||||
s = StopWatch()
|
|
||||||
h = []
|
|
||||||
for x in range(100_000):
|
|
||||||
heappush(h, x)
|
|
||||||
print("Heappush:", s.elapsed())
|
|
||||||
s.reset()
|
|
||||||
while h:
|
|
||||||
heappop(h)
|
|
||||||
print("Heappop:", s.elapsed())
|
|
||||||
|
|
||||||
s = StopWatch()
|
|
||||||
h = MinHeap()
|
|
||||||
for x in range(100_000):
|
|
||||||
h.add(x)
|
|
||||||
print("MinHeap.add():", s.elapsed())
|
|
||||||
s.reset()
|
|
||||||
while not h.empty():
|
|
||||||
h.pop()
|
|
||||||
print("MinHeap.pop():", s.elapsed())
|
|
||||||
|
|
||||||
s = StopWatch()
|
|
||||||
b = set()
|
|
||||||
for x in range(1_000_000):
|
|
||||||
b.add(x)
|
|
||||||
print("set.add():", s.elapsed())
|
|
||||||
s.reset()
|
|
||||||
for x in range(1_000_000):
|
|
||||||
_ = x in b
|
|
||||||
print("x in set:", s.elapsed())
|
|
||||||
|
|
||||||
s = StopWatch()
|
|
||||||
b = BinarySearchTree()
|
|
||||||
for x in range(1_000_000):
|
|
||||||
b.add(x)
|
|
||||||
print("AVL.add():", s.elapsed())
|
|
||||||
s.reset()
|
|
||||||
for x in range(1_000_000):
|
|
||||||
_ = x in b
|
|
||||||
print("x in AVL:", s.elapsed())
|
|
||||||
|
|
||||||
print("DFS/BFS Test")
|
|
||||||
b = BinarySearchTree()
|
|
||||||
for x in range(20):
|
|
||||||
b.add(x)
|
|
||||||
b.print()
|
|
||||||
print("DFS:")
|
|
||||||
for x in b.iter_depth_first():
|
|
||||||
print(x)
|
|
||||||
print("BFS:")
|
|
||||||
for x in b.iter_breadth_first():
|
|
||||||
print(x)
|
|
||||||
26
pyproject.toml
Normal file
26
pyproject.toml
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
[build-system]
|
||||||
|
requires = ['setuptools', "wheel", "setuptools-git-versioning"]
|
||||||
|
build-backend = 'setuptools.build_meta'
|
||||||
|
|
||||||
|
[tool.setuptools-git-versioning]
|
||||||
|
enabled = true
|
||||||
|
|
||||||
|
[project]
|
||||||
|
dynamic = ['version']
|
||||||
|
name = "shs-tools"
|
||||||
|
authors = [
|
||||||
|
{ name="Stefan Harmuth", email="pennywise@drock.de" },
|
||||||
|
]
|
||||||
|
description = "An assortment of little helper functions"
|
||||||
|
readme = "README.md"
|
||||||
|
requires-python = ">=3.6"
|
||||||
|
classifiers = [
|
||||||
|
"Programming Language :: Python :: 3",
|
||||||
|
"Development Status :: 4 - Beta",
|
||||||
|
"License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)",
|
||||||
|
"Operating System :: OS Independent",
|
||||||
|
]
|
||||||
|
|
||||||
|
[project.urls]
|
||||||
|
"homepage" = "https://git.domainforge.de/public/py-tools"
|
||||||
|
"Bug Tracker" = "https://git.domainforge.de/public/py-tools/issues"
|
||||||
12
setup.py
12
setup.py
@ -1,12 +0,0 @@
|
|||||||
from setuptools import setup
|
|
||||||
|
|
||||||
setup(
|
|
||||||
name='py-tools',
|
|
||||||
version='0.2',
|
|
||||||
packages=['tools'],
|
|
||||||
url='',
|
|
||||||
license='GPLv3',
|
|
||||||
author='Stefan Harmuth',
|
|
||||||
author_email='pennywise@drock.de',
|
|
||||||
description='Just some small tools to make life easier'
|
|
||||||
)
|
|
||||||
@ -6,8 +6,8 @@ import requests
|
|||||||
import time
|
import time
|
||||||
import webbrowser
|
import webbrowser
|
||||||
from bs4 import BeautifulSoup
|
from bs4 import BeautifulSoup
|
||||||
from tools.datafiles import JSONFile
|
from src.tools.datafiles import JSONFile
|
||||||
from tools.stopwatch import StopWatch
|
from src.tools.stopwatch import StopWatch
|
||||||
from typing import Any, Callable, List, Tuple, Type, Union
|
from typing import Any, Callable, List, Tuple, Type, Union
|
||||||
from .tools import get_script_dir
|
from .tools import get_script_dir
|
||||||
|
|
||||||
@ -278,7 +278,7 @@ class HexCoordinate(Coordinate):
|
|||||||
|
|
||||||
def __init__(self, x: int, y: int, z: int):
|
def __init__(self, x: int, y: int, z: int):
|
||||||
assert (x + y + z) == 0
|
assert (x + y + z) == 0
|
||||||
super().__init__(x, y, z)
|
super(HexCoordinate, self).__init__(x, y, z)
|
||||||
|
|
||||||
def get_length(self) -> int:
|
def get_length(self) -> int:
|
||||||
return (abs(self.x) + abs(self.y) + abs(self.z)) // 2
|
return (abs(self.x) + abs(self.y) + abs(self.z)) // 2
|
||||||
@ -321,7 +321,7 @@ class HexCoordinateF(HexCoordinate):
|
|||||||
}
|
}
|
||||||
|
|
||||||
def __init__(self, x: int, y: int, z: int):
|
def __init__(self, x: int, y: int, z: int):
|
||||||
super().__init__(x, y, z)
|
super(HexCoordinateF, self).__init__(x, y, z)
|
||||||
|
|
||||||
|
|
||||||
class Shape:
|
class Shape:
|
||||||
@ -393,7 +393,7 @@ class Shape:
|
|||||||
|
|
||||||
class Square(Shape):
|
class Square(Shape):
|
||||||
def __init__(self, top_left, bottom_right):
|
def __init__(self, top_left, bottom_right):
|
||||||
super().__init__(top_left, bottom_right)
|
super(Square, self).__init__(top_left, bottom_right)
|
||||||
self.mode_3d = False
|
self.mode_3d = False
|
||||||
|
|
||||||
|
|
||||||
@ -401,4 +401,4 @@ class Cube(Shape):
|
|||||||
def __init__(self, top_left, bottom_right):
|
def __init__(self, top_left, bottom_right):
|
||||||
if top_left.z is None or bottom_right.z is None:
|
if top_left.z is None or bottom_right.z is None:
|
||||||
raise ValueError("Both Coordinates need to be 3D")
|
raise ValueError("Both Coordinates need to be 3D")
|
||||||
super().__init__(top_left, bottom_right)
|
super(Cube, self).__init__(top_left, bottom_right)
|
||||||
@ -1,6 +1,6 @@
|
|||||||
from dataclasses import dataclass, field
|
from dataclasses import dataclass, field
|
||||||
from enum import Enum
|
from enum import Enum
|
||||||
from tools.lists import Queue, Stack
|
from src.tools.lists import Queue, Stack
|
||||||
from typing import Any, List, Union
|
from typing import Any, List, Union
|
||||||
|
|
||||||
|
|
||||||
Loading…
Reference in New Issue
Block a user