Skip to content

Commit

Permalink
Use Poetry (#104)
Browse files Browse the repository at this point in the history
* Switch to Poetry.

* Update docs workflow.

* Manually update coolprop.

* Missing call to poetry...

* Change project name.

* Bring back setup.py.
  • Loading branch information
lymereJ authored Aug 12, 2024
1 parent 3a42fbf commit 56d41d2
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 12 deletions.
9 changes: 8 additions & 1 deletion .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,23 @@ jobs:
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
- name: Install Poetry
uses: snok/install-poetry@v1
with:
virtualenvs-create: true
virtualenvs-in-project: true
installer-parallel: true
- name: Update pip and install python dependencies
run: |
python -m pip install --upgrade pip
pip install -e .[dev]
poetry install
- name: Install documentation dependencies
run: |
pip install sphinx sphinx-rtd-theme
- name: Sphinx build
run: |
sphinx-build docs/source build
poetry run sphinx-build docs/source build
- name: Deploy
uses: peaceiris/actions-gh-pages@v3
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/develop' }}
Expand Down
26 changes: 19 additions & 7 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,27 @@ on:
release:
types: [published]
jobs:
pypi:
pypi_release:
name: Builds Using Poetry and Publishes to PyPI
runs-on: ubuntu-latest
steps:
- name: Checkout
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0
- run: python3 -m pip install --upgrade build && python3 -m build
- name: Publish package
uses: pypa/gh-action-pypi-publish@release/v1
ref: ${{github.event.release.tag_name}}
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Install Poetry
uses: snok/install-poetry@v1
with:
password: ${{ secrets.PYPI_API_TOKEN }}
virtualenvs-create: true
virtualenvs-in-project: true
installer-parallel: true
- name: Install venv
run: poetry install
- name: Configure Poetry For Publication
run: poetry config pypi-token.pypi "${{secrets.PYPI_API_TOKEN}}"
- name: Publish package
run: poetry publish --build
25 changes: 22 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,24 @@
[tool.poetry]
name = "copper"
version = "0.2.1"
description = "Performance curve generator for building energy simulation"
authors = ["Lerond, Jeremy <jeremy.lerond@pnnl.gov>", "Rahman, Aowabin <aowabin.rahman@pnnl.gov>", "Wan, Hanlong <hanlong.wan@pnnl.gov>", "Singh, Manan <manan.singh@pnnl.gov>"]
readme = "README.md"

[tool.poetry.dependencies]
python = "^3.10"
numpy = "^2.0.1"
matplotlib = "^3.9.1"
pandas = "^2.2.2"
statsmodels = "^0.14.2"
CoolProp = "^6.6.0"
scipy = "^1.14.0"
click = "^8.1.7"
jsonschema = "^4.23.0"

[build-system]
requires = ["setuptools>=45", "setuptools_scm[toml]>=6.2"]
build-backend = "setuptools.build_meta"
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"

[tool.setuptools_scm]
[tool.poetry.plugins."console_scripts"]
"copper" = "copper.cli:cli"
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@
},
include_package_data=True,
package_data={"copper": ["copper/data/*.json", "copper/data/schema/*.json"]},
)
)

0 comments on commit 56d41d2

Please sign in to comment.