diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..62cd726 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,33 @@ +name: Publish to PyPI + +on: + pull_request: + types: + - closed + branches: + - main + +permissions: + contents: read + id-token: write + +jobs: + publish: + name: Publish to PyPI + if: | + github.event.pull_request.merged && contains(github.event.pull_request.labels.*.name, 'autorelease: tagged') + runs-on: ubuntu-latest + environment: + name: pypi + url: https://pypi.org/project/bikenetlib/ + + steps: + - uses: actions/checkout@v4 + + - name: Build package + run: | + python -m pip install build + python -m build + + - name: Publish to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 diff --git a/.github/workflows/release-please.yml b/.github/workflows/release-please.yml new file mode 100644 index 0000000..1a2c43a --- /dev/null +++ b/.github/workflows/release-please.yml @@ -0,0 +1,19 @@ +name: release-please + +on: + push: + branches: + - main + +permissions: + contents: write + pull-requests: write + +jobs: + release-please: + runs-on: ubuntu-latest + steps: + - uses: googleapis/release-please-action@v4 + with: + token: ${{ secrets.GITHUB_TOKEN }} + config-file: release-please-config.json diff --git a/docs/changelog.md b/docs/changelog.md new file mode 100644 index 0000000..9cdb184 --- /dev/null +++ b/docs/changelog.md @@ -0,0 +1,6 @@ +# Changelog + +## Version 0.5.0 (2026-05-22) + +- ✨ Initial release ✨ +- 🔧 Copy code from current packages GrowBikeNet and FixBikeNet diff --git a/docs/conf.py b/docs/conf.py new file mode 100644 index 0000000..8456468 --- /dev/null +++ b/docs/conf.py @@ -0,0 +1,121 @@ +# Configuration file for the Sphinx documentation builder. +# +# For the full list of built-in configuration values, see the documentation: +# https://www.sphinx-doc.org/en/master/usage/configuration.html + +# -- Project information ----------------------------------------------------- +# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information + +project = "BikeNetLib" +copyright = "2026, BikeNetLib developers" +author = "Szell, Knepper, Vybornova" + +# -- General configuration --------------------------------------------------- +# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration + +import os # noqa +import sys # noqa + +sys.path.insert(0, os.path.abspath("..")) +import bikenetlib # noqa + +# version = bikenetlib.__version__ +version = "0.5.0" +release = version + +# Add any Sphinx extension module names here, as strings. They can be +# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom +# ones. +extensions = [ + "sphinx.ext.autodoc", + "sphinx.ext.autosummary", + "sphinx.ext.linkcode", + "sphinxcontrib.bibtex", + "sphinx.ext.mathjax", + "sphinx.ext.doctest", + "sphinx.ext.intersphinx", + "numpydoc", + "nbsphinx", + "matplotlib.sphinxext.plot_directive", + "IPython.sphinxext.ipython_console_highlighting", + "myst_parser", + "sphinx_copybutton", + "sphinx_gallery.load_style", +] + +templates_path = ["_templates"] +exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"] + +# path to bib file with references +bibtex_bibfiles = ["_static/references.bib"] +bibtex_reference_style = "author_year" + +# -- Options for HTML output ------------------------------------------------- +# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output +html_static_path = ["_static"] + +### select html theme +# html_theme = 'alabaster' +html_theme = "pydata_sphinx_theme" + +html_theme_options = { + "github_url": "https://github.com/BikeNetKit/BikeNetLib", + "twitter_url": "notwitter.com", + "pygment_light_style": "tango", + "logo": { + "image_light": "logo.png", + "image_dark": "logo.png", + }, +} + +# Generate the API documentation when building +autosummary_generate = True +autosummary_imported_members = True +numpydoc_show_class_members = True +class_members_toctree = True +numpydoc_show_inherited_class_members = True +numpydoc_class_members_toctree = False +numpydoc_use_plots = True +autodoc_typehints = "none" + +# -- Extension configuration ------------------------------------------------- +nbsphinx_prolog = r""" +{% set docname = env.doc2path(env.docname, base=None) %} + +.. only:: html + + .. role:: raw-html(raw) + :format: html + + .. note:: + + | This page was generated from `{{ docname }}`__. + | Interactive online version: :raw-html:`Binder badge` + + __ https://github.com/BikeNetKit/BikeNetLib/blob/master/docs/{{ docname }} +""" # noqa: E501 + + +def linkcode_resolve(domain, info): + def find_source(): + # try to find the file and line number, based on code from numpy: + # https://github.com/numpy/numpy/blob/master/doc/source/conf.py#L286 + obj = sys.modules[info["module"]] + for part in info["fullname"].split("."): + obj = getattr(obj, part) + import inspect + import os + + fn = inspect.getsourcefile(obj) + fn = os.path.relpath(fn, start=os.path.dirname(bikenetlib.__file__)) + source, lineno = inspect.getsourcelines(obj) + return fn, lineno, lineno + len(source) - 1 + + if domain != "py" or not info["module"]: + return None + try: + filename = "BikeNetLib/%s#L%d-L%d" % find_source() # noqa: UP031 + except Exception: + filename = info["module"].replace(".", "/") + ".py" + tag = "main" if "+" in release else ("v" + release) + return f"https://github.com/BikeNetKit/BikeNetLib/blob/{tag}/{filename}" diff --git a/pyproject.toml b/pyproject.toml index 76b118f..83f1790 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -16,6 +16,7 @@ readme = "README.md" description = "BikeNetKit Python core utility package" keywords = ["Bicycle network planning", "Networks", "OpenStreetMap", "Urban Planning", "Urban Mobility"] classifiers = [ + "Development Status :: 3 - Alpha", "Intended Audience :: Developers", "Intended Audience :: Science/Research", "Operating System :: OS Independent",