Skip to content

Commit 64c0934

Browse files
committed
Initial commit
0 parents  commit 64c0934

File tree

20 files changed

+800
-0
lines changed

20 files changed

+800
-0
lines changed

.github/workflows/lint.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: lint
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
8+
jobs:
9+
lint:
10+
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- uses: actions/checkout@v4
15+
- name: Set up Python
16+
uses: actions/setup-python@v5
17+
with:
18+
python-version: "3.12"
19+
- name: Install dependencies
20+
run: |
21+
python -m pip install --upgrade pip
22+
pip install flake8
23+
- name: Lint with flake8
24+
run: |
25+
flake8 . --count --max-line-length=99 --statistics

.github/workflows/publish.yml

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
name: Build & Publish package to PyPI
2+
3+
# CI setup instructions:
4+
# 1. Replace 'assessingsolar/sunlib' and 'sunlib' with your GitHub organization and repository name
5+
# 2. Create a new environment for additional protection and security in the GitHub UI:
6+
# Settings > Environments
7+
# Name: release
8+
# 3. Setup trusted publishing for the release environment:
9+
# https://docs.pypi.org/trusted-publishers/
10+
# 4. Ensure your main development branch is named 'main'; if not, update the workflow or rename the branch
11+
12+
# This workflow is triggered on pull requests that target the main branch
13+
# on pushes to the main branch new tags that start with 'v' (for example, 'v1.0.0').
14+
# Only the main branch is used for publishing to PyPI, in the second job.
15+
on:
16+
pull_request:
17+
branches:
18+
- main
19+
push:
20+
branches:
21+
- main
22+
tags:
23+
- "v*"
24+
25+
env:
26+
python-version: "3.12"
27+
28+
jobs:
29+
build-distribution:
30+
name: Build distribution
31+
runs-on: ubuntu-latest
32+
steps:
33+
- uses: actions/checkout@v4
34+
# Deep clone to fetch all commits and tags, by setting the fetch-depth to 0
35+
with:
36+
fetch-depth: 0
37+
38+
- name: Set up Python
39+
uses: actions/setup-python@v5
40+
with:
41+
python-version: ${{ env.python-version }}
42+
43+
- name: Install build tools
44+
run: |
45+
python -m pip install --upgrade pip
46+
python -m pip install --upgrade setuptools wheel build twine
47+
48+
- name: Build packages
49+
# creates the necessary distribution files to /dist
50+
run: python -m build
51+
52+
- name: Check metadata verification
53+
# this step ensures the metadata is correct and complete
54+
# it is a good practice to run this before publishing to PyPI
55+
run: python -m twine check --strict dist/*
56+
57+
- name: Distribution files & installation sizes
58+
# this step is useful to get some useful metrics and ensure changes do not break the size of the distribution
59+
run: |
60+
echo "Distribution files sizes"
61+
du -sh dist/*
62+
python -m pip install dist/*.whl --target /tmp/assessingsolar --quiet --quiet
63+
echo "Installation size of wheel"
64+
du -sh /tmp/assessingsolar/sunlib
65+
66+
- name: Upload artifact with distribution files
67+
# this step uploads the distribution files to the GitHub artifact store if they are needed later to publish to PyPI
68+
if: github.repository == 'assessingsolar/sunlib' && github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
69+
uses: actions/upload-artifact@v4
70+
with:
71+
name: distro-files
72+
path: dist/
73+
if-no-files-found: error # files are required in the next job
74+
retention-days: 1 # delete the artifact after 1 day, no need to keep it for too long
75+
compression-level: 0 # no need to compress the files
76+
77+
publish-distribution:
78+
name: Upload distribution to PyPI
79+
runs-on: ubuntu-latest
80+
needs: build-distribution # first build, then publish
81+
# only publish distribution to PyPI in tagged commits
82+
if: github.repository == 'assessingsolar/sunlib' && github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
83+
environment: release
84+
permissions:
85+
id-token: write # this permission mandatory for trusted publishing
86+
steps:
87+
- name: Download artifact with distribution files
88+
uses: actions/download-artifact@v4
89+
with:
90+
name: distro-files
91+
path: dist/
92+
93+
- name: Publish distribution to PyPI
94+
# this step publishes the distribution files to PyPI by using PyPI trusted publishers
95+
# https://docs.pypi.org/trusted-publishers/
96+
uses: pypa/gh-action-pypi-publish@release/v1

.github/workflows/test.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: test
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
schedule:
8+
- cron: '0 0 * * 0'
9+
10+
jobs:
11+
test:
12+
13+
strategy:
14+
fail-fast: false # don't cancel other matrix jobs when one fails
15+
matrix:
16+
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
17+
os: [ubuntu-latest, macos-latest, windows-latest]
18+
19+
runs-on: ${{ matrix.os }}
20+
21+
steps:
22+
- uses: actions/checkout@v4
23+
- name: Set up Python
24+
uses: actions/setup-python@v5
25+
with:
26+
python-version: ${{ matrix.python-version }}
27+
- name: Install dependencies
28+
run: |
29+
python -m pip install --upgrade pip
30+
pip install .[test]
31+
- name: Run tests
32+
run: |
33+
pytest

.gitignore

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

.readthedocs.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
version: 2
2+
3+
sphinx:
4+
configuration: docs/source/conf.py
5+
fail_on_warning: true
6+
7+
build:
8+
os: ubuntu-20.04
9+
tools:
10+
python: "3.12"
11+
12+
python:
13+
14+
install:
15+
- method: pip
16+
path: .
17+
extra_requirements:
18+
- doc

LICENSE

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
BSD 3-Clause License
2+
3+
Copyright (c) 2021-2022, twoaxistracking Development Team
4+
All rights reserved.
5+
6+
Redistribution and use in source and binary forms, with or without
7+
modification, are permitted provided that the following conditions are met:
8+
9+
1. Redistributions of source code must retain the above copyright notice, this
10+
list of conditions and the following disclaimer.
11+
12+
2. Redistributions in binary form must reproduce the above copyright notice,
13+
this list of conditions and the following disclaimer in the documentation
14+
and/or other materials provided with the distribution.
15+
16+
3. Neither the name of the copyright holder nor the names of its
17+
contributors may be used to endorse or promote products derived from
18+
this software without specific prior written permission.
19+
20+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
24+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
26+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
27+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
28+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

0 commit comments

Comments
 (0)