From 720cc6f10c2e99d7790110549eaca56894ac5e92 Mon Sep 17 00:00:00 2001 From: Henry Webel Date: Wed, 23 Jul 2025 13:03:41 +0200 Subject: [PATCH 1/2] :memo::wrench: start adressing recommendations from Sebastian, see #5 --- Contributing.md | 36 ++++++++++++++++++++++++++++++++++++ docs/tutorial/.jupytext | 6 +++++- pyproject.toml | 2 +- 3 files changed, 42 insertions(+), 2 deletions(-) create mode 100644 Contributing.md diff --git a/Contributing.md b/Contributing.md new file mode 100644 index 0000000..94d1032 --- /dev/null +++ b/Contributing.md @@ -0,0 +1,36 @@ +# Contributing code + +Install the code with development dependencies: + +```bash +pip install -e '.[dev]' +``` + +## Format code and sort imports + +```bash +black . +isort . +``` + +## lint code + +```bash +ruff check . +``` + +## Run tests + +```bash +pytest +``` + +## Sync notebooks with jupytext + +For easier diffs, you can use jupytext to sync notebooks in the `docs/tutorial` directory with the percent format. + +```bash +jupytext --sync docs/tutorial/*.ipynb +``` + +This is configured in the [`.jupytext`](docs/tutorial/.jupytext) file in that directory. diff --git a/docs/tutorial/.jupytext b/docs/tutorial/.jupytext index 46e9467..c213311 100644 --- a/docs/tutorial/.jupytext +++ b/docs/tutorial/.jupytext @@ -1,2 +1,6 @@ -# all notebooks in this directory are in the percent format +# all notebooks in this directory are synced percent format when typing +# (jupytext is a dev dependency) +# jupytext --sync *.ipynb +# or from root directory +# jupytext --sync docs/api_examples/*.ipynb formats = "ipynb,py:percent" diff --git a/pyproject.toml b/pyproject.toml index 8d614cd..1afdec2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -43,7 +43,7 @@ docs = [ "sphinx-copybutton", ] # local development options -dev = ["black[jupyter]", "ruff", "pytest"] +dev = ["black[jupyter]", "ruff", "pytest", "isort", "jupytext"] [tool.ruff] # https://docs.astral.sh/ruff/rules/#flake8-bandit-s From 7535642e4f84554f73523d1785eabfb7a6c7bf99 Mon Sep 17 00:00:00 2001 From: Henry Webel Date: Wed, 23 Jul 2025 13:10:12 +0200 Subject: [PATCH 2/2] :art: add default citation --- CITATION.cff | 12 ++++++++++++ README.md | 7 ++++--- 2 files changed, 16 insertions(+), 3 deletions(-) create mode 100644 CITATION.cff diff --git a/CITATION.cff b/CITATION.cff new file mode 100644 index 0000000..b78dd26 --- /dev/null +++ b/CITATION.cff @@ -0,0 +1,12 @@ +# https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-citation-files +cff-version: 1.2.0 +message: "If you use this software, please cite it as below." +authors: +- family-names: "Last" + given-names: "First" + orcid: "https://orcid.org/0000-0000-0000-0000" +title: "Python Package Template repository" +version: 0.0.1 +doi: 10.5281/zenodo.1234 +date-released: 2025-07-23 +url: "https://github.com/biosustain/python_package" diff --git a/README.md b/README.md index a248d35..0b2d238 100644 --- a/README.md +++ b/README.md @@ -11,14 +11,15 @@ see [GitHub documentation](https://docs.github.com/en/repositories/creating-and- You will need to find and replace occurences of - `python_package` -> `your_package_name` - - also the folder `src/python_package` + - also the folder `src/python_package` - `RasmussenLab` -> `GitHub_user_name` (or `organization`) -with the name of your package and GitHub user name (or organization). + with the name of your package and GitHub user name (or organization). - look for `First Last` to see where to replace with your name - choose a license, see [GitHub documentation](https://docs.github.com/en/repositories/creating-and-managing-repositories/licensing-a-repository) and [Creative Commons](https://creativecommons.org/chooser/). Replace [`LICENSE`](LICENSE) file with the license you choose. +- Update the `CITATION.cff` file with your information. ## Development environment @@ -41,7 +42,7 @@ print(hello_world(4)) ## Readthedocs The documentation can be build using readthedocs automatically. See -[project on Readthedocs](https://readthedocs.org/projects/rasmussenlab-python-package/) +[project on Readthedocs](https://readthedocs.org/projects/rasmussenlab-python-package/) for the project based on this template. A new project needs to [be registered on ReadTheDocs](https://docs.readthedocs.com/platform/stable/intro/add-project.html).