Skip to content

Commit dc1305b

Browse files
committed
Use UV
0 parents  commit dc1305b

File tree

18 files changed

+1693
-0
lines changed

18 files changed

+1693
-0
lines changed

.github/workflows/build.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: build
2+
on: [push]
3+
4+
jobs:
5+
check:
6+
runs-on: ubuntu-latest
7+
steps:
8+
- name: Check out repo
9+
uses: actions/checkout
10+
11+
- name: Set up uv
12+
uses: astral-sh/setup-uv
13+
14+
- name: Set up Python
15+
uses: actions/setup-python
16+
with:
17+
python-version: 3.13
18+
19+
- name: Run Tests
20+
run: |
21+
uv sync
22+
tox -e py313
23+
24+
# TODO: Add fix, check, types, coverage, docs, etc

.github/workflows/release.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Release
2+
on:
3+
workflow_dispatch:
4+
push:
5+
branches: ['main']
6+
jobs:
7+
release:
8+
runs-on: ubuntu-latest
9+
permissions:
10+
id-token: write
11+
steps:
12+
- name: Checkout code
13+
uses: actions/checkout
14+
15+
- name: Set up uv
16+
uses: astral-sh/setup-uv
17+
18+
- name: Set up Python
19+
uses: actions/setup-python
20+
with:
21+
python-version: 3.13
22+
23+
- name: Release
24+
run: |
25+
uv build
26+
uv publish --publish-url https://test.pypi.org/legacy/ --trusted-publishing always

.gitignore

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Python-generated files
2+
__pycache__/
3+
*.py[oc]
4+
build/
5+
dist/
6+
wheels/
7+
*.egg-info
8+
9+
# Virtual environments
10+
.venv
11+
12+
# Coverage
13+
.coverage.*

.python-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
3.13.2

LICENSE.txt

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2025 Fernando Chorney
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# PyStructTypes
2+
3+
Leverage Python Types to Define C-Struct Interfaces
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{{obj.name}}
2+
{{obj.name|length * "="}}
3+
4+
.. automodule:: {{obj.name}}{%- block subpackages %}
5+
{%- if obj.subpackages %}
6+
7+
Subpackages
8+
-----------
9+
10+
.. toctree::
11+
:titlesonly:
12+
:maxdepth: 1
13+
{% for subpackage in obj.subpackages %}
14+
{% if subpackage.display %}{{ subpackage.short_name }}/index.rst{% endif -%}
15+
{%- endfor %}
16+
{%- endif %}{%- endblock -%}{%- block submodules %}
17+
{%- if obj.submodules %}
18+
19+
Submodules
20+
----------
21+
22+
.. toctree::
23+
:titlesonly:
24+
:maxdepth: 1
25+
{% for submodule in obj.submodules %}
26+
{% if submodule.display %}{{ submodule.short_name }}/index.rst{% endif -%}
27+
{%- endfor %}
28+
{%- endif %}{%- endblock -%}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{% extends "python/module.rst" %}

docs/conf.py

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
from datetime import datetime
2+
3+
from recommonmark.parser import CommonMarkParser
4+
from recommonmark.transform import AutoStructify
5+
6+
# from pystructtype import __version__
7+
8+
9+
# This exists to fix a bug in recommonmark due to a missing function definition
10+
# https://github.com/readthedocs/recommonmark/issues/177
11+
class CustomCommonMarkParser(CommonMarkParser):
12+
def visit_document(self, node):
13+
pass
14+
15+
16+
# Sphinx Base --------------------------------------------------------------------------
17+
# Extensions
18+
extensions = [
19+
# http://www.sphinx-doc.org/en/master/usage/extensions/autodoc.html
20+
"sphinx.ext.autodoc",
21+
# http://www.sphinx-doc.org/en/master/usage/extensions/napoleon.html
22+
"sphinx.ext.napoleon",
23+
# http://www.sphinx-doc.org/en/master/usage/extensions/todo.html
24+
"sphinx.ext.todo",
25+
# http://www.sphinx-doc.org/en/master/usage/extensions/viewcode.html
26+
"sphinx.ext.viewcode",
27+
# https://sphinx-autoapi.readthedocs.io/en/latest/
28+
"autoapi.extension",
29+
# https://github.com/invenia/sphinxcontrib-runcmd
30+
"sphinxcontrib.runcmd",
31+
]
32+
33+
# Set initial page name
34+
master_doc = "index"
35+
36+
# Project settings
37+
project = "PyStructType"
38+
year = datetime.now().year
39+
author = "Fernando Chorney"
40+
copyright = f"{year}, {author}"
41+
42+
# Short version name
43+
version = "0.1.0"
44+
45+
# Long version name
46+
release = version
47+
48+
# HTML Settings
49+
html_theme = "sphinx_rtd_theme"
50+
html_last_updated_fmt = "%b %d, %Y"
51+
html_short_title = f"{project}-{version}"
52+
53+
# Pygments Style Settings
54+
pygments_style = "monokai"
55+
56+
# Sphinx Extension Autodoc -------------------------------------------------------------
57+
58+
# Order members by source order
59+
autodoc_member_order = "bysource"
60+
61+
# Always show members, and member-inheritance by default
62+
autodoc_default_options = {"members": True, "show-inheritance": True}
63+
64+
# Sphinx Extension Napoleon ------------------------------------------------------------
65+
66+
# We want to force google style docstrings, so disable numpy style
67+
napoleon_numpy_docstring = False
68+
69+
# Set output style
70+
napoleon_use_ivar = True
71+
napoleon_use_rtype = False
72+
napoleon_use_param = False
73+
74+
# Sphinx Extension AutoAPI -------------------------------------------------------------
75+
autoapi_type = "python"
76+
autoapi_dirs = ["../src/pystructtype/"]
77+
autoapi_template_dir = "./autoapi_templates"
78+
autoapi_root = "autoapi"
79+
autoapi_add_toctree_entry = False
80+
autoapi_keep_files = False
81+
82+
# Exclude the autoapi templates in the doc building
83+
exclude_patterns = ["autoapi_templates"]
84+
85+
86+
# Add any Sphinx plugin settings here that don't have global variables exposed.
87+
def setup(app):
88+
# App Settings ---------------------------------------------------------------------
89+
# Set source filetype(s)
90+
# Allow .rst files along with .md
91+
app.add_source_suffix(".rst", "restructuredtext")
92+
app.add_source_suffix(".md", "markdown")
93+
app.add_source_parser(CustomCommonMarkParser)
94+
95+
# RecommonMark Settings ------------------------------------------------------------
96+
# Enable the evaluation of rst directive in .md files
97+
# https://recommonmark.readthedocs.io/en/latest/auto_structify.html
98+
app.add_config_value("recommonmark_config", {"enable_eval_rst": True}, True)
99+
app.add_transform(AutoStructify)

docs/index.rst

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
PyStructType
2+
============
3+
4+
Add Stuff Here
5+
6+
.. toctree::
7+
:maxdepth: 1
8+
:caption: Code Reference
9+
:name: sec-code-ref
10+
11+
autoapi/pystructtype/index

0 commit comments

Comments
 (0)