Skip to content

Commit bc7580c

Browse files
committed
feat: add workflows and rules
1 parent 62827a9 commit bc7580c

File tree

9 files changed

+478
-0
lines changed

9 files changed

+478
-0
lines changed

.cursor/Dockerfile

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Use the latest Ubuntu base image
2+
FROM ubuntu:22.04
3+
4+
# Create a non-root user
5+
RUN useradd -m -s /bin/bash cursor
6+
7+
# Install Python 3, pip, and venv for Python development
8+
RUN apt-get update -y && \
9+
apt-get install -y \
10+
build-essential \
11+
curl \
12+
git \
13+
python3 \
14+
python3-pip \
15+
python3-venv && \
16+
rm -rf /var/lib/apt/lists/*
17+
18+
# Switch to the non-root user
19+
USER cursor
20+
21+
# Set the working directory to the user's home directory
22+
WORKDIR /home/cursor
23+
24+
# Install Python dependencies
25+
RUN pip3 install --user pytest
26+
27+
CMD ["bash"]

.cursor/environment.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"build": {
3+
"dockerfile": "Dockerfile",
4+
"context": "."
5+
},
6+
"terminals": []
7+
}

.cursor/rules/doc-writing-rules.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
alwaysApply: true
3+
---
4+
5+
## Documentation Writing Rules
6+
7+
- Agents **MUST** add new markdown documentation files only inside the `docs/agentdocs` folder, unless specifically requested otherwise.
8+
- This rule applies to all documentation except for the main `README.md` file.
9+
- Agents **MUST NOT** create or modify markdown documentation outside of `docs/agentdocs` unless the instructions explicitly say to do so (with the exception of `README.md`).
10+
- Agents **SHOULD** create sub-directories in `docs/agentdocs` for the current **feature**
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
alwaysApply: true
3+
---
4+
5+
## PyPi Publish Guidelines
6+

.github/workflows/pypi-publish.yml

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
name: pypi-publish
2+
3+
on:
4+
push:
5+
branches: [ main, master ]
6+
7+
permissions:
8+
id-token: write
9+
contents: read
10+
11+
jobs:
12+
build-and-publish:
13+
runs-on: ubuntu-latest
14+
steps: - uses: actions/checkout@v4
15+
- name: Set up Python
16+
uses: actions/setup-python@v5
17+
with:
18+
python-version: '3.x'
19+
20+
- name: Extract version from pyproject.toml
21+
id: get-version
22+
run: |
23+
VERSION=$(python -c "import tomllib; print(tomllib.load(open('pyproject.toml', 'rb'))['project']['version'])")
24+
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
25+
echo "Current version: $VERSION"
26+
27+
- name: Check if version exists on PyPI
28+
id: check-pypi
29+
run: |
30+
python -m pip install --upgrade pip requests
31+
32+
# Check if package version exists on PyPI
33+
PACKAGE_NAME=$(python -c "import tomllib; print(tomllib.load(open('pyproject.toml', 'rb'))['project']['name'])")
34+
VERSION="${{ steps.get-version.outputs.VERSION }}"
35+
36+
python -c "
37+
import requests
38+
import sys
39+
40+
package = '$PACKAGE_NAME'
41+
version = '$VERSION'
42+
43+
try:
44+
response = requests.get(f'https://pypi.org/pypi/{package}/{version}/json')
45+
if response.status_code == 200:
46+
print(f'Version {version} already exists on PyPI')
47+
sys.exit(0)
48+
else:
49+
print(f'Version {version} does not exist on PyPI, proceeding with publish')
50+
sys.exit(1)
51+
except Exception as e:
52+
print(f'Error checking PyPI: {e}')
53+
print(f'Assuming version {version} does not exist, proceeding with publish')
54+
sys.exit(1)
55+
" || echo "SHOULD_PUBLISH=true" >> $GITHUB_OUTPUT
56+
57+
- name: Build wheel and sdist
58+
if: steps.check-pypi.outputs.SHOULD_PUBLISH == 'true'
59+
run: |
60+
python -m pip install --upgrade pip build
61+
python -m build
62+
63+
- name: Publish to PyPI via Trusted Publisher
64+
if: steps.check-pypi.outputs.SHOULD_PUBLISH == 'true'
65+
uses: pypa/gh-action-pypi-publish@release/v1
66+
with:
67+
print-hash: true

.github/workflows/test.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: tests
2+
3+
on:
4+
push:
5+
branches: [ main, master ]
6+
pull_request:
7+
8+
jobs:
9+
test:
10+
runs-on: ubuntu-latest
11+
strategy:
12+
matrix:
13+
python-version: ["3.10"]
14+
steps:
15+
- uses: actions/checkout@v4
16+
- name: Set up Python ${{ matrix.python-version }}
17+
uses: actions/setup-python@v5
18+
with:
19+
python-version: ${{ matrix.python-version }}
20+
- name: Install package and pytest
21+
run: |
22+
python -m pip install --upgrade pip
23+
pip install -e .
24+
pip install pytest
25+
- name: Run tests
26+
run: pytest -q

.gitignore

Lines changed: 205 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,205 @@
1+
# Byte-compiled / optimized / DLL files
2+
__pycache__/
3+
*.py[cod]
4+
*$py.class
5+
6+
# C extensions
7+
*.so
8+
9+
# Distribution / packaging
10+
.Python
11+
build/
12+
develop-eggs/
13+
dist/
14+
downloads/
15+
eggs/
16+
.eggs/
17+
lib/
18+
lib64/
19+
parts/
20+
sdist/
21+
var/
22+
wheels/
23+
share/python-wheels/
24+
*.egg-info/
25+
.installed.cfg
26+
*.egg
27+
MANIFEST
28+
29+
# PyInstaller
30+
# Usually these files are written by a python script from a template
31+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
32+
*.manifest
33+
*.spec
34+
35+
# Installer logs
36+
pip-log.txt
37+
pip-delete-this-directory.txt
38+
39+
# Unit test / coverage reports
40+
htmlcov/
41+
.tox/
42+
.nox/
43+
.coverage
44+
.coverage.*
45+
.cache
46+
nosetests.xml
47+
coverage.xml
48+
*.cover
49+
*.py,cover
50+
.hypothesis/
51+
.pytest_cache/
52+
cover/
53+
54+
# Translations
55+
*.mo
56+
*.pot
57+
58+
# Django stuff:
59+
*.log
60+
local_settings.py
61+
db.sqlite3
62+
db.sqlite3-journal
63+
64+
# Flask stuff:
65+
instance/
66+
.webassets-cache
67+
68+
# Scrapy stuff:
69+
.scrapy
70+
71+
# Sphinx documentation
72+
docs/_build/
73+
74+
# PyBuilder
75+
.pybuilder/
76+
target/
77+
78+
# Jupyter Notebook
79+
.ipynb_checkpoints
80+
81+
# IPython
82+
profile_default/
83+
ipython_config.py
84+
85+
# pyenv
86+
# For a library or package, you might want to ignore these files since the code is
87+
# intended to run in multiple environments; otherwise, check them in:
88+
# .python-version
89+
90+
# pipenv
91+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
92+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
93+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
94+
# install all needed dependencies.
95+
#Pipfile.lock
96+
97+
# poetry
98+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
99+
# This is especially recommended for binary packages to ensure reproducibility, and is more
100+
# commonly ignored for libraries.
101+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
102+
#poetry.lock
103+
104+
# pdm
105+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
106+
#pdm.lock
107+
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
108+
# in version control.
109+
# https://pdm.fming.dev/#use-with-ide
110+
.pdm.toml
111+
112+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
113+
__pypackages__/
114+
115+
# Celery stuff
116+
celerybeat-schedule
117+
celerybeat.pid
118+
119+
# SageMath parsed files
120+
*.sage.py
121+
122+
# Environments
123+
.env
124+
.venv
125+
env/
126+
venv/
127+
ENV/
128+
env.bak/
129+
venv.bak/
130+
131+
# Spyder project settings
132+
.spyderproject
133+
.spyproject
134+
135+
# Rope project settings
136+
.ropeproject
137+
138+
# mkdocs documentation
139+
/site
140+
141+
# mypy
142+
.mypy_cache/
143+
.dmypy.json
144+
dmypy.json
145+
146+
# Pyre type checker
147+
.pyre/
148+
149+
# pytype static type analyzer
150+
.pytype/
151+
152+
# Cython debug symbols
153+
cython_debug/
154+
155+
# PyCharm
156+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
157+
# be added to the global gitignore or merged into this project gitignore. For a PyCharm
158+
# project, it is recommended to include the following files:
159+
# .idea/
160+
# *.iml
161+
# *.ipr
162+
# *.iws
163+
164+
# VS Code
165+
.vscode/
166+
167+
# Sublime Text
168+
*.sublime-project
169+
*.sublime-workspace
170+
171+
# Vim
172+
*.swp
173+
*.swo
174+
*~
175+
176+
# Emacs
177+
*~
178+
\#*\#
179+
/.emacs.desktop
180+
/.emacs.desktop.lock
181+
*.elc
182+
auto-save-list
183+
tramp
184+
.\#*
185+
186+
# macOS
187+
.DS_Store
188+
.AppleDouble
189+
.LSOverride
190+
191+
# Windows
192+
Thumbs.db
193+
Thumbs.db:encryptable
194+
ehthumbs.db
195+
ehthumbs_vista.db
196+
*.tmp
197+
*.temp
198+
Desktop.ini
199+
$RECYCLE.BIN/
200+
*.cab
201+
*.msi
202+
*.msix
203+
*.msm
204+
*.msp
205+
*.lnk

0 commit comments

Comments
 (0)