diff --git a/.github/publish_to_pypi.yml b/.github/publish_to_pypi.yml new file mode 100644 index 0000000..341b4e0 --- /dev/null +++ b/.github/publish_to_pypi.yml @@ -0,0 +1,31 @@ +name: Upload to PyPi + +on: + release: + types: [published] + +jobs: + deploy: + runs-on: ubuntu-latest + if: github.event.action == 'published' + environment: + name: pypi-publishing + url: https://pypi.org/p/electrolyzer + permissions: + id-token: write + steps: + - uses: actions/checkout@v6 + - name: Set up Python + uses: actions/setup-python@v6 + with: + python-version: 3.13 + - name: Build package + run: | + python -m pip install --upgrade pip + pip install setuptools build wheel twine + python -m build + twine check --strict dist/* + - name: Publish package to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 + with: + verbose: True diff --git a/.github/publish_to_test_pypi.yml b/.github/publish_to_test_pypi.yml new file mode 100644 index 0000000..cd5e8f8 --- /dev/null +++ b/.github/publish_to_test_pypi.yml @@ -0,0 +1,33 @@ +name: Upload to Test PyPi + +on: + push: + tags: + - 'v*' + +jobs: + deploy: + runs-on: ubuntu-latest + if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') + environment: + name: pypi-publishing + url: https://test.pypi.org/p/electrolyzer + permissions: + id-token: write + steps: + - uses: actions/checkout@v6 + - name: Set up Python + uses: actions/setup-python@v6 + with: + python-version: 3.13 + - name: Build package + run: | + python -m pip install --upgrade pip + pip install setuptools build wheel twine + python -m build + twine check --strict dist/* + - name: Publish package to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 + with: + verbose: True + repository-url: https://test.pypi.org/legacy/ diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst index e0e2e5d..4b5ca98 100644 --- a/CONTRIBUTING.rst +++ b/CONTRIBUTING.rst @@ -69,7 +69,6 @@ Ready to contribute? Here's how to set up ``electrolyzer`` for local development $ cd electrolyzer $ python -m venv env $ source env/bin/activate - $ pip install -r requirements.txt $ pip install -e . $ pre-commit install @@ -121,3 +120,8 @@ Then run:: $ bump2version patch # possible: major / minor / patch $ git push $ git push --tags + +This will trigger the publishing to Test PyPI. If the action runs unsucessfully, then +delete the tag from local and remote, restore the old version number, fix the issue, and +try again. If the action runs successfully, then simply create the release on the github +to trigger the publishing to PyPI. diff --git a/pyproject.toml b/pyproject.toml index 5ecffd2..531c271 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -39,16 +39,17 @@ classifiers = [ [project.optional-dependencies] develop = [ + "pre-commit", "pytest", + "pytest_mock", "pytest-subtests", "pytest-dependency", - "pre-commit", - "pytest_mock", "responses", - "jupyter-book", - "readthedocs-sphinx-ext", "Sphinx", + "jupyter-book", "sphinxcontrib-napoleon", + "readthedocs-sphinx-ext", + "bump2version", ] examples = ["jupyterlab"] all = ["electrolyzer[develop,examples]"] diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index 9904cb3..0000000 --- a/requirements.txt +++ /dev/null @@ -1,19 +0,0 @@ -# Requirements for Electrolyzer - -# Prod -numpy -scipy -pandas -matplotlib -rainflow -attrs -jsonschema -ruamel.yaml - -# Dev -pytest -pytest_mock -pre-commit - -# Examples -ipykernel