pysgn 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- pysgn-0.1.0/.github/ISSUE_TEMPLATE/asking-help.md +9 -0
- pysgn-0.1.0/.github/ISSUE_TEMPLATE/bug-report.md +21 -0
- pysgn-0.1.0/.github/ISSUE_TEMPLATE/feature-request.md +14 -0
- pysgn-0.1.0/.github/workflows/build.yml +68 -0
- pysgn-0.1.0/.github/workflows/draft-pdf.yml +28 -0
- pysgn-0.1.0/.github/workflows/release.yml +46 -0
- pysgn-0.1.0/.gitignore +334 -0
- pysgn-0.1.0/.pre-commit-config.yaml +27 -0
- pysgn-0.1.0/.readthedocs.yml +26 -0
- pysgn-0.1.0/CONTRIBUTING.md +94 -0
- pysgn-0.1.0/LICENSE +21 -0
- pysgn-0.1.0/PKG-INFO +146 -0
- pysgn-0.1.0/README.md +79 -0
- pysgn-0.1.0/codecov.yaml +41 -0
- pysgn-0.1.0/docs/Makefile +177 -0
- pysgn-0.1.0/docs/apis/api_main.md +9 -0
- pysgn-0.1.0/docs/apis/geo_erdos_renyi_network.rst +4 -0
- pysgn-0.1.0/docs/apis/geo_watts_strogatz_network.rst +4 -0
- pysgn-0.1.0/docs/conf.py +294 -0
- pysgn-0.1.0/docs/getting_started.ipynb +1039 -0
- pysgn-0.1.0/docs/index.md +96 -0
- pysgn-0.1.0/paper/paper.bib +17 -0
- pysgn-0.1.0/paper/paper.md +56 -0
- pysgn-0.1.0/pyproject.toml +140 -0
- pysgn-0.1.0/pysgn/__init__.py +17 -0
- pysgn-0.1.0/pysgn/geo_erdos_renyi_network.py +156 -0
- pysgn-0.1.0/pysgn/geo_watts_strogatz_network.py +375 -0
- pysgn-0.1.0/pysgn/utils.py +99 -0
- pysgn-0.1.0/tests/__init__.py +0 -0
- pysgn-0.1.0/tests/test_geo_erdos_renyi_network.py +167 -0
- pysgn-0.1.0/tests/test_geo_watts_strogatz_network.py +264 -0
- pysgn-0.1.0/tests/test_utils.py +57 -0
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Asking for help
|
|
3
|
+
about: If you need help using PySGN, you should post in https://github.com/wang-boyu/pysgn/discussions
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
<!--
|
|
7
|
+
ATTENTION: Don't raise an issue here!
|
|
8
|
+
If you need help, ask in https://github.com/wang-boyu/pysgn/discussions
|
|
9
|
+
-->
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Bug report
|
|
3
|
+
about: Let us know if something is broken on PySGN
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
**Describe the bug**
|
|
8
|
+
<!-- A clear and concise description the bug -->
|
|
9
|
+
|
|
10
|
+
**Expected behavior**
|
|
11
|
+
<!-- A clear and concise description of what you expected to happen -->
|
|
12
|
+
|
|
13
|
+
**To Reproduce**
|
|
14
|
+
<!-- Steps to reproduce the bug, or a link to a project where the bug is visible -->
|
|
15
|
+
|
|
16
|
+
**Additional context**
|
|
17
|
+
<!--
|
|
18
|
+
Add any other context here.
|
|
19
|
+
Any details about your specific platform:
|
|
20
|
+
* If the problem is in the browser, what browser, version, and OS?
|
|
21
|
+
-->
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Feature request
|
|
3
|
+
about: Suggest a new feature for PySGN
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
**What's the problem this feature will solve?**
|
|
8
|
+
<!-- A clear and concise description of what the problem is. -->
|
|
9
|
+
|
|
10
|
+
**Describe the solution you'd like**
|
|
11
|
+
<!-- A clear and concise description of what you want to happen. -->
|
|
12
|
+
|
|
13
|
+
**Additional context**
|
|
14
|
+
<!-- Add any other context, links, etc. about the feature here. -->
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
name: build
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- main
|
|
7
|
+
paths-ignore:
|
|
8
|
+
- '**.md'
|
|
9
|
+
pull_request:
|
|
10
|
+
branches:
|
|
11
|
+
- main
|
|
12
|
+
paths-ignore:
|
|
13
|
+
- '**.md'
|
|
14
|
+
|
|
15
|
+
# This will cancel previous run if a newer job that obsoletes the said previous
|
|
16
|
+
# run, is started.
|
|
17
|
+
# Based on https://github.com/zulip/zulip/commit/4a11642cee3c8aec976d305d51a86e60e5d70522
|
|
18
|
+
concurrency:
|
|
19
|
+
group: "${{ github.workflow }}-${{ github.head_ref || github.run_id }}"
|
|
20
|
+
cancel-in-progress: true
|
|
21
|
+
|
|
22
|
+
jobs:
|
|
23
|
+
test:
|
|
24
|
+
runs-on: ${{ matrix.os }}-latest
|
|
25
|
+
strategy:
|
|
26
|
+
matrix:
|
|
27
|
+
os: [ubuntu, macos, windows]
|
|
28
|
+
python-version: ["3.10", "3.11", "3.12", "3.13"]
|
|
29
|
+
|
|
30
|
+
steps:
|
|
31
|
+
- uses: actions/checkout@v4
|
|
32
|
+
|
|
33
|
+
- name: Set up Python ${{ matrix.python-version }}
|
|
34
|
+
uses: actions/setup-python@v5
|
|
35
|
+
with:
|
|
36
|
+
python-version: ${{ matrix.python-version }}
|
|
37
|
+
allow-prereleases: true
|
|
38
|
+
cache: 'pip'
|
|
39
|
+
|
|
40
|
+
- name: Install Python dependencies
|
|
41
|
+
run: |
|
|
42
|
+
python -m pip install --upgrade pip
|
|
43
|
+
python -m pip install uv
|
|
44
|
+
uv pip install --system .[dev]
|
|
45
|
+
|
|
46
|
+
- name: Cache dependencies
|
|
47
|
+
uses: actions/cache@v3
|
|
48
|
+
with:
|
|
49
|
+
path: ~/.cache/pip
|
|
50
|
+
key: ${{ runner.os }}-pip-${{ hashFiles('**/pyproject.toml') }}
|
|
51
|
+
restore-keys: |
|
|
52
|
+
${{ runner.os }}-pip-
|
|
53
|
+
|
|
54
|
+
- name: Lint with Ruff
|
|
55
|
+
run: |
|
|
56
|
+
ruff check .
|
|
57
|
+
ruff format --check .
|
|
58
|
+
|
|
59
|
+
- name: Run tests with pytest
|
|
60
|
+
run: |
|
|
61
|
+
pytest tests/ --cov=pysgn --cov-report=xml
|
|
62
|
+
|
|
63
|
+
- name: Upload coverage to Codecov
|
|
64
|
+
uses: codecov/codecov-action@v4
|
|
65
|
+
with:
|
|
66
|
+
file: ./coverage.xml
|
|
67
|
+
fail_ci_if_error: true
|
|
68
|
+
token: ${{ secrets.CODECOV_TOKEN }}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
name: draft-pdf
|
|
2
|
+
on:
|
|
3
|
+
push:
|
|
4
|
+
paths:
|
|
5
|
+
- paper/**
|
|
6
|
+
- .github/workflows/draft-pdf.yml
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
paper:
|
|
10
|
+
runs-on: ubuntu-latest
|
|
11
|
+
name: Paper Draft
|
|
12
|
+
steps:
|
|
13
|
+
- name: Checkout
|
|
14
|
+
uses: actions/checkout@v4
|
|
15
|
+
- name: Build draft PDF
|
|
16
|
+
uses: openjournals/openjournals-draft-action@master
|
|
17
|
+
with:
|
|
18
|
+
journal: joss
|
|
19
|
+
# This should be the path to the paper within your repo.
|
|
20
|
+
paper-path: paper/paper.md
|
|
21
|
+
- name: Upload
|
|
22
|
+
uses: actions/upload-artifact@v4
|
|
23
|
+
with:
|
|
24
|
+
name: paper
|
|
25
|
+
# This is the output path where Pandoc will write the compiled
|
|
26
|
+
# PDF. Note, this should be the same directory as the input
|
|
27
|
+
# paper.md
|
|
28
|
+
path: paper/paper.pdf
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
name: release
|
|
2
|
+
on:
|
|
3
|
+
push:
|
|
4
|
+
tags:
|
|
5
|
+
- "v*"
|
|
6
|
+
branches:
|
|
7
|
+
- main
|
|
8
|
+
- release**
|
|
9
|
+
paths-ignore:
|
|
10
|
+
- '**.md'
|
|
11
|
+
- '**.rst'
|
|
12
|
+
pull_request:
|
|
13
|
+
paths-ignore:
|
|
14
|
+
- '**.md'
|
|
15
|
+
- '**.rst'
|
|
16
|
+
workflow_dispatch:
|
|
17
|
+
|
|
18
|
+
permissions:
|
|
19
|
+
id-token: write
|
|
20
|
+
|
|
21
|
+
jobs:
|
|
22
|
+
release:
|
|
23
|
+
name: Deploy release to PyPI
|
|
24
|
+
runs-on: ubuntu-latest
|
|
25
|
+
permissions:
|
|
26
|
+
id-token: write
|
|
27
|
+
steps:
|
|
28
|
+
- name: Checkout source
|
|
29
|
+
uses: actions/checkout@v4
|
|
30
|
+
- name: Set up Python
|
|
31
|
+
uses: actions/setup-python@v5
|
|
32
|
+
with:
|
|
33
|
+
python-version: "3.12"
|
|
34
|
+
- name: Install dependencies
|
|
35
|
+
run: pip install -U pip build wheel setuptools
|
|
36
|
+
- name: Build distributions
|
|
37
|
+
run: python -m build
|
|
38
|
+
- name: Upload package as artifact to GitHub
|
|
39
|
+
if: github.repository == 'wang-boyu/pysgn' && startsWith(github.ref, 'refs/tags')
|
|
40
|
+
uses: actions/upload-artifact@v4
|
|
41
|
+
with:
|
|
42
|
+
name: package
|
|
43
|
+
path: dist/
|
|
44
|
+
- name: Publish package to PyPI
|
|
45
|
+
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
|
|
46
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
pysgn-0.1.0/.gitignore
ADDED
|
@@ -0,0 +1,334 @@
|
|
|
1
|
+
#################
|
|
2
|
+
## Eclipse
|
|
3
|
+
#################
|
|
4
|
+
|
|
5
|
+
*.pydevproject
|
|
6
|
+
.project
|
|
7
|
+
.metadata
|
|
8
|
+
bin/
|
|
9
|
+
tmp/
|
|
10
|
+
*.tmp
|
|
11
|
+
*.bak
|
|
12
|
+
*.swp
|
|
13
|
+
*~.nib
|
|
14
|
+
local.properties
|
|
15
|
+
.classpath
|
|
16
|
+
.settings/
|
|
17
|
+
.loadpath
|
|
18
|
+
|
|
19
|
+
# External tool builders
|
|
20
|
+
.externalToolBuilders/
|
|
21
|
+
|
|
22
|
+
# Locally stored "Eclipse launch configurations"
|
|
23
|
+
*.launch
|
|
24
|
+
|
|
25
|
+
# CDT-specific
|
|
26
|
+
.cproject
|
|
27
|
+
|
|
28
|
+
# PDT-specific
|
|
29
|
+
.buildpath
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
#################
|
|
33
|
+
## Visual Studio
|
|
34
|
+
#################
|
|
35
|
+
|
|
36
|
+
## Ignore Visual Studio temporary files, build results, and
|
|
37
|
+
## files generated by popular Visual Studio add-ons.
|
|
38
|
+
|
|
39
|
+
# User-specific files
|
|
40
|
+
*.suo
|
|
41
|
+
*.user
|
|
42
|
+
*.sln.docstates
|
|
43
|
+
|
|
44
|
+
# Build results
|
|
45
|
+
|
|
46
|
+
[Dd]ebug/
|
|
47
|
+
[Rr]elease/
|
|
48
|
+
x64/
|
|
49
|
+
build/
|
|
50
|
+
[Bb]in/
|
|
51
|
+
[Oo]bj/
|
|
52
|
+
|
|
53
|
+
# MSTest test Results
|
|
54
|
+
[Tt]est[Rr]esult*/
|
|
55
|
+
[Bb]uild[Ll]og.*
|
|
56
|
+
|
|
57
|
+
*_i.c
|
|
58
|
+
*_p.c
|
|
59
|
+
*.ilk
|
|
60
|
+
*.meta
|
|
61
|
+
*.obj
|
|
62
|
+
*.pch
|
|
63
|
+
*.pdb
|
|
64
|
+
*.pgc
|
|
65
|
+
*.pgd
|
|
66
|
+
*.rsp
|
|
67
|
+
*.sbr
|
|
68
|
+
*.tlb
|
|
69
|
+
*.tli
|
|
70
|
+
*.tlh
|
|
71
|
+
*.tmp
|
|
72
|
+
*.tmp_proj
|
|
73
|
+
*.log
|
|
74
|
+
*.vspscc
|
|
75
|
+
*.vssscc
|
|
76
|
+
.builds
|
|
77
|
+
*.pidb
|
|
78
|
+
*.log
|
|
79
|
+
*.scc
|
|
80
|
+
|
|
81
|
+
# Visual C++ cache files
|
|
82
|
+
ipch/
|
|
83
|
+
*.aps
|
|
84
|
+
*.ncb
|
|
85
|
+
*.opensdf
|
|
86
|
+
*.sdf
|
|
87
|
+
*.cachefile
|
|
88
|
+
|
|
89
|
+
# Visual Studio profiler
|
|
90
|
+
*.psess
|
|
91
|
+
*.vsp
|
|
92
|
+
*.vspx
|
|
93
|
+
|
|
94
|
+
# Guidance Automation Toolkit
|
|
95
|
+
*.gpState
|
|
96
|
+
|
|
97
|
+
# ReSharper is a .NET coding add-in
|
|
98
|
+
_ReSharper*/
|
|
99
|
+
*.[Rr]e[Ss]harper
|
|
100
|
+
|
|
101
|
+
# TeamCity is a build add-in
|
|
102
|
+
_TeamCity*
|
|
103
|
+
|
|
104
|
+
# DotCover is a Code Coverage Tool
|
|
105
|
+
*.dotCover
|
|
106
|
+
|
|
107
|
+
# NCrunch
|
|
108
|
+
*.ncrunch*
|
|
109
|
+
.*crunch*.local.xml
|
|
110
|
+
|
|
111
|
+
# Installshield output folder
|
|
112
|
+
[Ee]xpress/
|
|
113
|
+
|
|
114
|
+
# DocProject is a documentation generator add-in
|
|
115
|
+
DocProject/buildhelp/
|
|
116
|
+
DocProject/Help/*.HxT
|
|
117
|
+
DocProject/Help/*.HxC
|
|
118
|
+
DocProject/Help/*.hhc
|
|
119
|
+
DocProject/Help/*.hhk
|
|
120
|
+
DocProject/Help/*.hhp
|
|
121
|
+
DocProject/Help/Html2
|
|
122
|
+
DocProject/Help/html
|
|
123
|
+
|
|
124
|
+
# Click-Once directory
|
|
125
|
+
publish/
|
|
126
|
+
|
|
127
|
+
# Publish Web Output
|
|
128
|
+
*.Publish.xml
|
|
129
|
+
*.pubxml
|
|
130
|
+
*.publishproj
|
|
131
|
+
|
|
132
|
+
# Windows Azure Build Output
|
|
133
|
+
csx
|
|
134
|
+
*.build.csdef
|
|
135
|
+
|
|
136
|
+
# Windows Store app package directory
|
|
137
|
+
AppPackages/
|
|
138
|
+
|
|
139
|
+
# Others
|
|
140
|
+
sql/
|
|
141
|
+
*.Cache
|
|
142
|
+
ClientBin/
|
|
143
|
+
[Ss]tyle[Cc]op.*
|
|
144
|
+
~$*
|
|
145
|
+
*~
|
|
146
|
+
*.dbmdl
|
|
147
|
+
*.[Pp]ublish.xml
|
|
148
|
+
*.pfx
|
|
149
|
+
*.publishsettings
|
|
150
|
+
|
|
151
|
+
# RIA/Silverlight projects
|
|
152
|
+
Generated_Code/
|
|
153
|
+
|
|
154
|
+
# Backup & report files from converting an old project file to a newer
|
|
155
|
+
# Visual Studio version. Backup files are not needed, because we have git ;-)
|
|
156
|
+
_UpgradeReport_Files/
|
|
157
|
+
Backup*/
|
|
158
|
+
UpgradeLog*.XML
|
|
159
|
+
UpgradeLog*.htm
|
|
160
|
+
|
|
161
|
+
# SQL Server files
|
|
162
|
+
App_Data/*.mdf
|
|
163
|
+
App_Data/*.ldf
|
|
164
|
+
|
|
165
|
+
#############
|
|
166
|
+
## Windows detritus
|
|
167
|
+
#############
|
|
168
|
+
|
|
169
|
+
# Windows image file caches
|
|
170
|
+
Thumbs.db
|
|
171
|
+
ehthumbs.db
|
|
172
|
+
|
|
173
|
+
# Folder config file
|
|
174
|
+
Desktop.ini
|
|
175
|
+
|
|
176
|
+
# Recycle Bin used on file shares
|
|
177
|
+
$RECYCLE.BIN/
|
|
178
|
+
|
|
179
|
+
# Mac crap
|
|
180
|
+
.DS_Store
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
#############
|
|
184
|
+
## Python
|
|
185
|
+
#############
|
|
186
|
+
|
|
187
|
+
*.py[cod]
|
|
188
|
+
|
|
189
|
+
# Packages
|
|
190
|
+
*.egg
|
|
191
|
+
*.egg-info
|
|
192
|
+
dist/
|
|
193
|
+
build/
|
|
194
|
+
eggs/
|
|
195
|
+
|
|
196
|
+
# Byte-compiled / optimized / DLL files
|
|
197
|
+
__pycache__/
|
|
198
|
+
*.py[cod]
|
|
199
|
+
*$py.class
|
|
200
|
+
|
|
201
|
+
# C extensions
|
|
202
|
+
*.so
|
|
203
|
+
|
|
204
|
+
# Distribution / packaging
|
|
205
|
+
.Python
|
|
206
|
+
build/
|
|
207
|
+
develop-eggs/
|
|
208
|
+
dist/
|
|
209
|
+
downloads/
|
|
210
|
+
eggs/
|
|
211
|
+
.eggs/
|
|
212
|
+
lib/
|
|
213
|
+
lib64/
|
|
214
|
+
parts/
|
|
215
|
+
sdist/
|
|
216
|
+
var/
|
|
217
|
+
wheels/
|
|
218
|
+
*.egg-info/
|
|
219
|
+
.installed.cfg
|
|
220
|
+
*.egg
|
|
221
|
+
MANIFEST
|
|
222
|
+
|
|
223
|
+
# PyInstaller
|
|
224
|
+
# Usually these files are written by a python script from a template
|
|
225
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
226
|
+
*.manifest
|
|
227
|
+
*.spec
|
|
228
|
+
|
|
229
|
+
# Installer logs
|
|
230
|
+
pip-log.txt
|
|
231
|
+
pip-delete-this-directory.txt
|
|
232
|
+
|
|
233
|
+
# Unit test / coverage reports
|
|
234
|
+
htmlcov/
|
|
235
|
+
.tox/
|
|
236
|
+
.coverage
|
|
237
|
+
.coverage.*
|
|
238
|
+
.cache
|
|
239
|
+
nosetests.xml
|
|
240
|
+
coverage.xml
|
|
241
|
+
*.cover
|
|
242
|
+
.hypothesis/
|
|
243
|
+
|
|
244
|
+
# Translations
|
|
245
|
+
*.mo
|
|
246
|
+
*.pot
|
|
247
|
+
|
|
248
|
+
# Django stuff:
|
|
249
|
+
*.log
|
|
250
|
+
local_settings.py
|
|
251
|
+
|
|
252
|
+
# Flask stuff:
|
|
253
|
+
instance/
|
|
254
|
+
.webassets-cache
|
|
255
|
+
|
|
256
|
+
# Scrapy stuff:
|
|
257
|
+
.scrapy
|
|
258
|
+
|
|
259
|
+
# Sphinx documentation
|
|
260
|
+
docs/_build/
|
|
261
|
+
docs/html/
|
|
262
|
+
docs/jupyter_execute/
|
|
263
|
+
|
|
264
|
+
# PyBuilder
|
|
265
|
+
target/
|
|
266
|
+
|
|
267
|
+
# Jupyter Notebook
|
|
268
|
+
.ipynb_checkpoints
|
|
269
|
+
*.virtual_documents
|
|
270
|
+
|
|
271
|
+
|
|
272
|
+
# pyenv
|
|
273
|
+
.python-version
|
|
274
|
+
|
|
275
|
+
# celery beat schedule file
|
|
276
|
+
celerybeat-schedule
|
|
277
|
+
|
|
278
|
+
# SageMath parsed files
|
|
279
|
+
*.sage.py
|
|
280
|
+
|
|
281
|
+
# Environments
|
|
282
|
+
.env
|
|
283
|
+
.venv
|
|
284
|
+
env/
|
|
285
|
+
venv/
|
|
286
|
+
ENV/
|
|
287
|
+
env.bak/
|
|
288
|
+
venv.bak/
|
|
289
|
+
|
|
290
|
+
# Spyder project settings
|
|
291
|
+
.spyderproject
|
|
292
|
+
.spyproject
|
|
293
|
+
|
|
294
|
+
# Rope project settings
|
|
295
|
+
.ropeproject
|
|
296
|
+
|
|
297
|
+
# mkdocs documentation
|
|
298
|
+
/site
|
|
299
|
+
|
|
300
|
+
# mypy
|
|
301
|
+
.mypy_cache/
|
|
302
|
+
parts/
|
|
303
|
+
var/
|
|
304
|
+
sdist/
|
|
305
|
+
develop-eggs/
|
|
306
|
+
.installed.cfg
|
|
307
|
+
|
|
308
|
+
# Installer logs
|
|
309
|
+
pip-log.txt
|
|
310
|
+
|
|
311
|
+
# Unit test / coverage reports
|
|
312
|
+
.coverage
|
|
313
|
+
.tox
|
|
314
|
+
.pytest_cache
|
|
315
|
+
|
|
316
|
+
#Translations
|
|
317
|
+
*.mo
|
|
318
|
+
|
|
319
|
+
#Mr Developer
|
|
320
|
+
.mr.developer.cfg
|
|
321
|
+
|
|
322
|
+
#Visual studio code
|
|
323
|
+
.vscode
|
|
324
|
+
|
|
325
|
+
# Idea file
|
|
326
|
+
.idea
|
|
327
|
+
|
|
328
|
+
# Cursor file
|
|
329
|
+
.cursorrules
|
|
330
|
+
|
|
331
|
+
data/
|
|
332
|
+
docs/cache/
|
|
333
|
+
notebooks/
|
|
334
|
+
references/
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
ci:
|
|
2
|
+
autoupdate_schedule: 'monthly'
|
|
3
|
+
autofix_prs: true
|
|
4
|
+
|
|
5
|
+
repos:
|
|
6
|
+
- repo: https://github.com/astral-sh/ruff-pre-commit
|
|
7
|
+
# Ruff version.
|
|
8
|
+
rev: v0.7.2
|
|
9
|
+
hooks:
|
|
10
|
+
# Run the linter with fix argument.
|
|
11
|
+
- id: ruff
|
|
12
|
+
types_or: [ python, pyi, jupyter ]
|
|
13
|
+
args: [--fix] # This will enable automatic fixing of lint issues where possible.
|
|
14
|
+
# Run the formatter.
|
|
15
|
+
- id: ruff-format
|
|
16
|
+
types_or: [ python, pyi, jupyter ]
|
|
17
|
+
- repo: https://github.com/asottile/pyupgrade
|
|
18
|
+
rev: v3.19.0
|
|
19
|
+
hooks:
|
|
20
|
+
- id: pyupgrade
|
|
21
|
+
args: [--py310-plus]
|
|
22
|
+
- repo: https://github.com/pre-commit/pre-commit-hooks
|
|
23
|
+
rev: v5.0.0 # Use the ref you want to point at
|
|
24
|
+
hooks:
|
|
25
|
+
- id: trailing-whitespace
|
|
26
|
+
- id: check-toml
|
|
27
|
+
- id: check-yaml
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# Read the Docs configuration file
|
|
2
|
+
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
|
|
3
|
+
|
|
4
|
+
# Required
|
|
5
|
+
version: 2
|
|
6
|
+
|
|
7
|
+
# Build documentation in the docs/ directory with Sphinx
|
|
8
|
+
sphinx:
|
|
9
|
+
configuration: docs/conf.py
|
|
10
|
+
|
|
11
|
+
# Optionally build your docs in additional formats such as PDF
|
|
12
|
+
formats:
|
|
13
|
+
- pdf
|
|
14
|
+
|
|
15
|
+
build:
|
|
16
|
+
os: ubuntu-lts-latest
|
|
17
|
+
tools:
|
|
18
|
+
python: latest
|
|
19
|
+
|
|
20
|
+
# Optionally set the version of Python and requirements required to build your docs
|
|
21
|
+
python:
|
|
22
|
+
install:
|
|
23
|
+
- method: pip
|
|
24
|
+
path: .
|
|
25
|
+
extra_requirements:
|
|
26
|
+
- docs
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
Contributing
|
|
2
|
+
============
|
|
3
|
+
|
|
4
|
+
As an open source project, PySGN welcomes contributions of many forms, and from beginners to experts. If you are curious or just want to see what is happening, we post our development session agendas and development session notes on [PySGN discussions].
|
|
5
|
+
|
|
6
|
+
In no particular order, examples include:
|
|
7
|
+
|
|
8
|
+
- Code patches
|
|
9
|
+
- Bug reports and patch reviews
|
|
10
|
+
- New features
|
|
11
|
+
- Documentation improvements
|
|
12
|
+
- Tutorials
|
|
13
|
+
|
|
14
|
+
[PySGN discussions]: https://github.com/wang-boyu/pysgn/discussions
|
|
15
|
+
[issue]: https://github.com/wang-boyu/pysgn/issues
|
|
16
|
+
|
|
17
|
+
**To submit a contribution**
|
|
18
|
+
|
|
19
|
+
- Create a ticket for the item that you are working on.
|
|
20
|
+
- Fork the PySGN repository.
|
|
21
|
+
- [Clone your repository] from GitHub to your machine.
|
|
22
|
+
- Create a new branch in your fork: `git checkout -b BRANCH_NAME`
|
|
23
|
+
- Run `git config pull.rebase true`. This prevents messy merge commits when updating your branch on top of PySGN main branch.
|
|
24
|
+
- Install an editable version with developer requirements locally: `pip install -e ".[dev]"`
|
|
25
|
+
- Edit the code. Save.
|
|
26
|
+
- Git add the new files and files with changes: `git add FILE_NAME`
|
|
27
|
+
- Git commit your changes with a meaningful message: `git commit -m "Fix issue X"`
|
|
28
|
+
- If implementing a new feature, include some documentation in docs folder.
|
|
29
|
+
- Make sure that your submission passes the [GH Actions build]. See "Testing and Standards below" to be able to run these locally.
|
|
30
|
+
- Make sure that your code is formatted according to the [black] standard (you can do it via [pre-commit]).
|
|
31
|
+
- Push your changes to your fork on Github: `git push origin NAME_OF_BRANCH`.
|
|
32
|
+
- [Create a pull request].
|
|
33
|
+
- Describe the change w/ ticket number(s) that the code fixes.
|
|
34
|
+
|
|
35
|
+
[Clone your repository]: https://help.github.com/articles/cloning-a-repository/
|
|
36
|
+
[GH Actions build]: https://github.com/wang-boyu/pysgn/actions/workflows/ci.yml
|
|
37
|
+
[Create a pull request]: https://help.github.com/articles/creating-a-pull-request/
|
|
38
|
+
[pre-commit]: https://github.com/pre-commit/pre-commit
|
|
39
|
+
[black]: https://github.com/psf/black
|
|
40
|
+
|
|
41
|
+
Testing and Code Standards
|
|
42
|
+
--------------------------
|
|
43
|
+
|
|
44
|
+
[](https://codecov.io/gh/wang-boyu/pysgn) [](https://github.com/psf/black)
|
|
45
|
+
|
|
46
|
+
As part of our contribution process, we practice continuous integration and use GH Actions to help enforce best practices.
|
|
47
|
+
|
|
48
|
+
If you're changing previous PySGN features, please make sure of the following:
|
|
49
|
+
|
|
50
|
+
- Your changes pass the current tests.
|
|
51
|
+
- Your changes pass our style standards.
|
|
52
|
+
- Your changes don't break the models or your changes include updated models.
|
|
53
|
+
- Additional features or rewrites of current features are accompanied by tests.
|
|
54
|
+
- New features are demonstrated in a model, so folks can understand more easily.
|
|
55
|
+
|
|
56
|
+
We test by implementing simple models and through traditional unit tests in the tests/ folder. The following only covers unit tests coverage. Ensure that your test coverage has not gone down. If it has and you need help, we will offer advice on how to structure tests for the contribution.
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
pytest --cov=pysgn tests/
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
With respect to code standards, we follow [PEP8] and the [Google Style Guide]. We recommend to use [black] as an automated code formatter. You can automatically format your code using [pre-commit], which will prevent `git commit` of unstyled code and will automatically apply black style so you can immediately re-run `git commit`. To set up pre-commit run the following commands:
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
pre-commit install
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
You should no longer have to worry about code formatting. If still in doubt you may run the following command. If the command generates errors, fix all errors that are returned.
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
pre-commit run --all-files
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
[PEP8]: https://www.python.org/dev/peps/pep-0008
|
|
75
|
+
[Google Style Guide]: https://google.github.io/styleguide/pyguide.html
|
|
76
|
+
[pre-commit]: https://github.com/pre-commit/pre-commit
|
|
77
|
+
[black]: https://github.com/psf/black
|
|
78
|
+
|
|
79
|
+
Licensing
|
|
80
|
+
---------
|
|
81
|
+
|
|
82
|
+
The license of this project is located in [LICENSE]. By submitting a contribution to this project, you are agreeing that your contribution will be released under the terms of this license.
|
|
83
|
+
|
|
84
|
+
[LICENSE]: https://github.com/wang-boyu/pysgn/blob/main/LICENSE
|
|
85
|
+
|
|
86
|
+
Special Thanks
|
|
87
|
+
--------------
|
|
88
|
+
|
|
89
|
+
A special thanks to the following projects who offered inspiration for this contributing file.
|
|
90
|
+
|
|
91
|
+
- [Mesa](https://github.com/projectmesa/mesa/blob/main/CONTRIBUTING.md)
|
|
92
|
+
- [Django](https://github.com/django/django/blob/master/CONTRIBUTING.rst)
|
|
93
|
+
- [18F's FOIA](https://github.com/18F/foia-hub/blob/master/CONTRIBUTING.md)
|
|
94
|
+
- [18F's Midas](https://github.com/18F/midas/blob/devel/CONTRIBUTING.md)
|
pysgn-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Wang Boyu
|
|
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.
|