diff --git a/.github/workflows/publish-to-pypi.yml b/.github/workflows/publish-to-pypi.yml new file mode 100644 index 0000000..9df1a37 --- /dev/null +++ b/.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.12 + uses: actions/setup-python@v4 + with: + python-version: 3.12 + - 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 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. - diff --git a/README.md b/README.md index 4abef9b..93533a7 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. @@ -27,6 +27,7 @@ This repository contains: ``` python -m pip install . ``` + (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: ```