Skip to content

Commit 7713759

Browse files
committed
fix: modernize project structure and fix path output (#7)
1 parent 3a3e3b7 commit 7713759

File tree

20 files changed

+3905
-2879
lines changed

20 files changed

+3905
-2879
lines changed

.editorconfig

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# EditorConfig for a Python project
2+
# Adjust as needed for your team's conventions.
3+
4+
root = true
5+
6+
[*]
7+
charset = utf-8
8+
end_of_line = lf
9+
insert_final_newline = true
10+
trim_trailing_whitespace = true
11+
indent_style = space
12+
indent_size = 4
13+
14+
# Python source files
15+
[*.{py,pyi,pyx,pxd}]
16+
indent_style = space
17+
indent_size = 4
18+
# Common hint matching Black's default line length
19+
max_line_length = 120
20+
21+
# Config and data files
22+
[*.{json,jsonc,toml,yml,yaml}]
23+
indent_style = space
24+
indent_size = 2
25+
26+
# Markdown: keep trailing spaces (they can mean a line break)
27+
[*.md]
28+
trim_trailing_whitespace = false
29+
30+
# Makefile requires tabs
31+
[Makefile]
32+
indent_style = tab
33+
34+
# Shell scripts
35+
[*.{sh,bash,zsh}]
36+
indent_style = space
37+
indent_size = 2
38+
39+
# This file itself
40+
[*.editorconfig]
41+
indent_style = space
42+
indent_size = 2

.github/workflows/ci.yml

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main, dev]
6+
pull_request:
7+
branches: [main, dev]
8+
9+
jobs:
10+
lint:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout code
14+
uses: actions/checkout@v6
15+
16+
- name: Set up Python
17+
uses: actions/setup-python@v6
18+
with:
19+
python-version: "3.12"
20+
21+
- name: Install uv
22+
uses: astral-sh/setup-uv@v7
23+
with:
24+
version: "latest"
25+
26+
- name: Install dependencies
27+
run: uv sync --extra dev
28+
29+
- name: Run ruff format check
30+
run: uv run ruff format --check .
31+
32+
- name: Run ruff lint
33+
run: uv run ruff check .
34+
35+
test:
36+
runs-on: ${{ matrix.os }}
37+
strategy:
38+
matrix:
39+
os: [ubuntu-latest, windows-latest, macos-latest]
40+
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]
41+
steps:
42+
- name: Checkout code
43+
uses: actions/checkout@v6
44+
45+
- name: Set up Python ${{ matrix.python-version }}
46+
uses: actions/setup-python@v6
47+
with:
48+
python-version: ${{ matrix.python-version }}
49+
50+
- name: Install uv
51+
uses: astral-sh/setup-uv@v7
52+
with:
53+
version: "latest"
54+
55+
- name: Install dependencies
56+
run: uv sync --extra dev
57+
58+
- name: Run tests
59+
run: uv run pytest -v --cov=jsonpath --cov-report=xml
60+
61+
- name: Upload coverage
62+
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.12'
63+
uses: codecov/codecov-action@v5
64+
with:
65+
file: ./coverage.xml
66+
flags: unittests
67+
token: ${{ secrets.CODECOV_TOKEN }}

.github/workflows/docs.yml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
name: Deploy Documentation
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- dev
8+
workflow_dispatch:
9+
10+
permissions:
11+
contents: read
12+
pages: write
13+
id-token: write
14+
15+
concurrency:
16+
group: "pages"
17+
cancel-in-progress: false
18+
19+
jobs:
20+
build:
21+
runs-on: ubuntu-latest
22+
steps:
23+
- uses: actions/checkout@v6
24+
with:
25+
fetch-depth: 0 # Fetch all history for git info
26+
27+
- name: Set up Python
28+
uses: actions/setup-python@v6
29+
with:
30+
python-version: "3.12"
31+
32+
- name: Install uv
33+
uses: astral-sh/setup-uv@v7
34+
with:
35+
version: "latest"
36+
37+
- name: Install dependencies
38+
run: uv sync --extra docs
39+
40+
- name: Build documentation
41+
run: uv run mkdocs build --strict
42+
43+
- name: Upload artifact
44+
uses: actions/upload-pages-artifact@v4
45+
with:
46+
path: ./site
47+
48+
deploy:
49+
environment:
50+
name: github-pages
51+
url: ${{ steps.deployment.outputs.page_url }}
52+
runs-on: ubuntu-latest
53+
needs: build
54+
# Temporarily allow deployment from dev branch for testing
55+
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/dev'
56+
steps:
57+
- name: Deploy to GitHub Pages
58+
id: deployment
59+
uses: actions/deploy-pages@v4.0.5

.github/workflows/release.yml

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
name: Release
2+
3+
on:
4+
workflow_run:
5+
workflows: ["CI"]
6+
types:
7+
- completed
8+
branches:
9+
- main
10+
- dev
11+
12+
permissions:
13+
contents: write
14+
issues: write
15+
pull-requests: write
16+
id-token: write
17+
18+
jobs:
19+
release:
20+
runs-on: ubuntu-latest
21+
if: github.event.workflow_run.conclusion == 'success'
22+
environment:
23+
name: pypi
24+
url: https://pypi.org/project/jsonpath-python/
25+
26+
steps:
27+
- name: Checkout code
28+
uses: actions/checkout@v6
29+
with:
30+
fetch-depth: 0
31+
persist-credentials: false
32+
33+
- name: Set up Python
34+
uses: actions/setup-python@v6
35+
with:
36+
python-version: "3.12"
37+
38+
- name: Set up Node.js
39+
uses: actions/setup-node@v6
40+
with:
41+
node-version: "lts/*"
42+
43+
- name: Install semantic-release
44+
run: |
45+
npm install -g semantic-release@latest
46+
npm install -g @semantic-release/changelog@latest
47+
npm install -g @semantic-release/exec@latest
48+
npm install -g @semantic-release/git@latest
49+
npm install -g @semantic-release/github@latest
50+
npm install -g conventional-changelog-conventionalcommits@latest
51+
52+
- name: Install uv
53+
uses: astral-sh/setup-uv@v7
54+
with:
55+
version: "latest"
56+
57+
- name: Release
58+
env:
59+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
60+
GIT_AUTHOR_NAME: github-actions[bot]
61+
GIT_AUTHOR_EMAIL: github-actions[bot]@users.noreply.github.com
62+
GIT_COMMITTER_NAME: github-actions[bot]
63+
GIT_COMMITTER_EMAIL: github-actions[bot]@users.noreply.github.com
64+
run: npx semantic-release
65+
66+
- name: Publish to PyPI
67+
if: success() && hashFiles('dist/*') != ''
68+
uses: pypa/gh-action-pypi-publish@release/v1

.gitignore

Lines changed: 80 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1-
.vscode/
2-
.idea/
3-
tmp.py
4-
### Python template
1+
/.ref/
2+
/AGENTS.md
3+
/.serena/
4+
/cohn_credentials.json
5+
56
# Byte-compiled / optimized / DLL files
67
__pycache__/
7-
*.py[cod]
8+
*.py[codz]
89
*$py.class
910

1011
# C extensions
@@ -50,7 +51,7 @@ htmlcov/
5051
nosetests.xml
5152
coverage.xml
5253
*.cover
53-
*.py,cover
54+
*.py.cover
5455
.hypothesis/
5556
.pytest_cache/
5657
cover/
@@ -75,6 +76,9 @@ instance/
7576
# Sphinx documentation
7677
docs/_build/
7778

79+
# MkDocs
80+
site/
81+
7882
# PyBuilder
7983
.pybuilder/
8084
target/
@@ -98,7 +102,37 @@ ipython_config.py
98102
# install all needed dependencies.
99103
#Pipfile.lock
100104

101-
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
105+
# UV
106+
# Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
107+
# This is especially recommended for binary packages to ensure reproducibility, and is more
108+
# commonly ignored for libraries.
109+
#uv.lock
110+
111+
# poetry
112+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
113+
# This is especially recommended for binary packages to ensure reproducibility, and is more
114+
# commonly ignored for libraries.
115+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
116+
#poetry.lock
117+
#poetry.toml
118+
119+
# pdm
120+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
121+
# pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
122+
# https://pdm-project.org/en/latest/usage/project/#working-with-version-control
123+
#pdm.lock
124+
#pdm.toml
125+
.pdm-python
126+
.pdm-build/
127+
128+
# pixi
129+
# Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
130+
#pixi.lock
131+
# Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
132+
# in the .venv directory. It is recommended not to include this directory in version control.
133+
.pixi
134+
135+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
102136
__pypackages__/
103137

104138
# Celery stuff
@@ -110,6 +144,7 @@ celerybeat.pid
110144

111145
# Environments
112146
.env
147+
.envrc
113148
.venv
114149
env/
115150
venv/
@@ -140,3 +175,41 @@ dmypy.json
140175

141176
# Cython debug symbols
142177
cython_debug/
178+
179+
# PyCharm
180+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
181+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
182+
# and can be added to the global gitignore or merged into this file. For a more nuclear
183+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
184+
#.idea/
185+
186+
# Abstra
187+
# Abstra is an AI-powered process automation framework.
188+
# Ignore directories containing user credentials, local state, and settings.
189+
# Learn more at https://abstra.io/docs
190+
.abstra/
191+
192+
# Visual Studio Code
193+
# Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
194+
# that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
195+
# and can be added to the global gitignore or merged into this file. However, if you prefer,
196+
# you could uncomment the following to ignore the entire vscode folder
197+
# .vscode/
198+
199+
# Ruff stuff:
200+
.ruff_cache/
201+
202+
# PyPI configuration file
203+
.pypirc
204+
205+
# Cursor
206+
# Cursor is an AI-powered code editor. `.cursorignore` specifies files/directories to
207+
# exclude from AI features like autocomplete and code analysis. Recommended for sensitive data
208+
# refer to https://docs.cursor.com/context/ignore-files
209+
.cursorignore
210+
.cursorindexingignore
211+
212+
# Marimo
213+
marimo/_static/
214+
marimo/_lsp/
215+
__marimo__/

0 commit comments

Comments
 (0)