From 7949c539c2c1769c82dc579d146e75fbe78615cb Mon Sep 17 00:00:00 2001 From: Remi Lehe Date: Tue, 9 Jul 2024 05:20:29 -0700 Subject: [PATCH 1/4] Add script to automatically publish new releases to PyPI --- .../.github/workflows/publish-to-pypi.yml | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 PICMI_Python/.github/workflows/publish-to-pypi.yml diff --git a/PICMI_Python/.github/workflows/publish-to-pypi.yml b/PICMI_Python/.github/workflows/publish-to-pypi.yml new file mode 100644 index 0000000..cb98a13 --- /dev/null +++ b/PICMI_Python/.github/workflows/publish-to-pypi.yml @@ -0,0 +1,35 @@ +name: Publish package to PyPI + +on: + release: + types: [created] + +jobs: + build-n-publish: + name: Build and publish package to PyPI + runs-on: ubuntu-latest + permissions: + # IMPORTANT: this permission is mandatory for trusted publishing + id-token: write + steps: + - uses: actions/checkout@v3 + - name: Set up Python 3.11 + uses: actions/setup-python@v4 + with: + python-version: 3.11 + - name: Install pypa/build + run: >- + python3 -m + pip install + build + --user + - name: Build a binary wheel and a source tarball + run: >- + python3 -m + build + --sdist + --wheel + --outdir dist/ + . + - name: Publish package distribution to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 \ No newline at end of file From e0b09a0fdfc0657b4531ba91caa6015521634ce4 Mon Sep 17 00:00:00 2001 From: Remi Lehe Date: Tue, 9 Jul 2024 05:22:31 -0700 Subject: [PATCH 2/4] Fix formatting --- PICMI_Python/.github/workflows/publish-to-pypi.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PICMI_Python/.github/workflows/publish-to-pypi.yml b/PICMI_Python/.github/workflows/publish-to-pypi.yml index cb98a13..8e57f0d 100644 --- a/PICMI_Python/.github/workflows/publish-to-pypi.yml +++ b/PICMI_Python/.github/workflows/publish-to-pypi.yml @@ -32,4 +32,4 @@ jobs: --outdir dist/ . - name: Publish package distribution to PyPI - uses: pypa/gh-action-pypi-publish@release/v1 \ No newline at end of file + uses: pypa/gh-action-pypi-publish@release/v1 From 1e16d31465a51ea97cc9ebd36905b03b8d9403d4 Mon Sep 17 00:00:00 2001 From: Remi Lehe Date: Tue, 9 Jul 2024 11:57:56 -0700 Subject: [PATCH 3/4] Incorporate review comments --- .../.github => .github}/workflows/publish-to-pypi.yml | 4 ++-- README.md | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) rename {PICMI_Python/.github => .github}/workflows/publish-to-pypi.yml (92%) diff --git a/PICMI_Python/.github/workflows/publish-to-pypi.yml b/.github/workflows/publish-to-pypi.yml similarity index 92% rename from PICMI_Python/.github/workflows/publish-to-pypi.yml rename to .github/workflows/publish-to-pypi.yml index 8e57f0d..9df1a37 100644 --- a/PICMI_Python/.github/workflows/publish-to-pypi.yml +++ b/.github/workflows/publish-to-pypi.yml @@ -13,10 +13,10 @@ jobs: id-token: write steps: - uses: actions/checkout@v3 - - name: Set up Python 3.11 + - name: Set up Python 3.12 uses: actions/setup-python@v4 with: - python-version: 3.11 + python-version: 3.12 - name: Install pypa/build run: >- python3 -m diff --git a/README.md b/README.md index 4f86eb8..cb2314e 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ The goal of the standard is to propose a set (or dictionary) of names and defini Just as two persons do generally not use the exact same set of words from a dictionary (whatever the language), each code will use syntax (associated with unique functionalities of the code) that others will not. However, it is expected that, just like two persons will use and understand the same words and syntax for the most common topics, codes will share the same language for common definitions and tasks. -For example, it is expected that most PIC codes can share the same syntax to define a grid, a commonly-used field solver, a set of particles, etc. On the other hand, only a subset of the codes will offer, e.g. mesh refinement, field ionization, or code steering by the user. In this case, it is up to the implementation with each code to decide whether to ignore, raise a warning or an error, when an undefined statement is encountered. For more flexibility and robustness, conditional statements are available to the user to execute or read lines of the input script, based on the targeted code. +For example, it is expected that most PIC codes can share the same syntax to define a grid, a commonly-used field solver, a set of particles, etc. On the other hand, only a subset of the codes will offer, e.g. mesh refinement, field ionization, or code steering by the user. In this case, it is up to the implementation with each code to decide whether to ignore, raise a warning or an error, when an undefined statement is encountered. For more flexibility and robustness, conditional statements are available to the user to execute or read lines of the input script, based on the targeted code. The intent is for the standard to be agnostic of the language of implementation, which can then potentially be performed using JSON, Python, FORTRAN or other means. @@ -28,6 +28,7 @@ This repository contains: ``` pip install picmistandard ``` + (The code will be automatically uploaded to PyPI upon creation of a new release on Github.) - The sources to generate the **Sphinx documentation** for the PICMI standard (in the directory `Docs`). In order to generate the Sphinx documentation, first install [Sphinx](http://www.sphinx-doc.org/en/master/), as well as the version of the PICMI standard that you would like to document (e.g. via `python setup.py`). Then type: ``` From b83a06e6149fb108e1e0623da39f89fd02dc3cd3 Mon Sep 17 00:00:00 2001 From: Remi Lehe Date: Thu, 18 Jul 2024 14:16:19 -0700 Subject: [PATCH 4/4] Remove instructions to upload to PyPI --- PICMI_Python/README.md | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/PICMI_Python/README.md b/PICMI_Python/README.md index d7f300a..a01b3c0 100644 --- a/PICMI_Python/README.md +++ b/PICMI_Python/README.md @@ -54,14 +54,3 @@ Change the tag number as needed to match the version number. Now, go to the [GitHub releases page](https://github.com/picmi-standard/picmi/releases) and create a release matching the pushed tag. If you are not signing your tags with GPG keys, the tagging and GitHub release can also be done in one step on this page. - -The final step is to update the version on PyPI. It is recommended to use the twine command. Here are the commands (run from the main directory since this uses the pyproject.toml file): - - ``` - python -m build --sdist --wheel - twine upload dist/* - ``` - -The first builds the distribution, the second uploads it. Note that it is good practice to delete the dist directory -afterwards so that each time uploads only the most recent version. -