diff --git a/.github/workflows/continuous_development.yml b/.github/workflows/continuous_development.yml new file mode 100644 index 0000000..edca2b7 --- /dev/null +++ b/.github/workflows/continuous_development.yml @@ -0,0 +1,54 @@ +name: Publish release to PyPi + +on: + pull_request: + types: + - closed + branches: + - master + +jobs: + build: + name: build + if: github.event.pull_request.merged == true + runs-on: ubuntu-latest + steps: + - name: Checkout the source ode + uses: actions/checkout@v3 + + - name: Setup the Python environment + uses: actions/setup-python@v5 + with: + python-version: "3.11" + + - name: Build the universal wheel + run: | + python -m pip install hatchling + python -m hatchling build + + - uses: actions/upload-artifact@v4 + with: + name: wheel + path: dist/ + + publish: + name: publish + needs: build + runs-on: ubuntu-latest + permissions: + id-token: write # IMPORTANT: mandatory for trusted publishing + environment: + name: pypi + url: https://pypi.org/p/appabuild + steps: + - uses: actions/download-artifact@v4 + with: + name: wheel + path: dist/ + + - name: Publish distribution package to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 + with: + verbose: true + packages-dir: dist + password: ${{ secrets.PYPI_TOKEN }} diff --git a/app/cli/__main__.py b/app/cli/__main__.py deleted file mode 100644 index c5054f7..0000000 --- a/app/cli/__main__.py +++ /dev/null @@ -1,11 +0,0 @@ -from .database import app as database_app -from .lca import app as lca_app -import typer - -app = typer.Typer() -app.add_typer(database_app, name="database") -app.add_typer(lca_app, name="lca") - - -if __name__ == "__main__": - typer.run(app) diff --git a/app/cli/main.py b/app/cli/main.py new file mode 100644 index 0000000..a4b15b8 --- /dev/null +++ b/app/cli/main.py @@ -0,0 +1,12 @@ +from app.cli.database import app as database_app +from app.cli.lca import app as lca_app +import typer + + +cli_app = typer.Typer() +cli_app.add_typer(database_app, name="database") +cli_app.add_typer(lca_app, name="lca") + + +if __name__ == "__main__": + cli_app() diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..61c54f8 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,58 @@ +[build-system] +requires = ["hatchling"] +build-backend = "hatchling.build" + +[tool.hatch.build.targets.wheel] +packages = ["app", "appabuild"] + +[project] +name = "appabuild" +version = "0.3.0" +authors = [{ name = "Maxime Peralta", email = "maxime.peralta@cea.fr"}] +maintainers= [{name = "Maxime Peralta", email = "maxime.peralta@cea.fr"}] +description = "Appa Build is a package to build impact models" +keywords = ["ecodesign", "life cycle assessment"] +license = { file = "LICENSE.md" } +readme = "README.md" +classifiers = [ + "License :: OSI Approved :: Eclipse Public License 2.0 (EPL-2.0)", + "Programming Language :: Python", + "Programming Language :: Python :: 3", + "Intended Audience :: Developers", + "Intended Audience :: Manufacturing", + "Intended Audience :: Science/Research", + "Topic :: Scientific/Engineering", +] +requires-python = ">=3.11,<3.12" +dependencies = [ + "numpy==1.26.4", + "pandas==2.0.0", + "brightway2==2.4.7", + "bw2io==0.8.12", + "lca_algebraic==1.0.0", + "fastapi", + "uvicorn[standard]", + "flake8", + "black", + "isort", + "typer", + "omegaconf", + "pydantic", + "scipy", + "matplotlib==3.10.0", + "seaborn==0.12.2", + "plotly", + "aenum", + "kaleido", + "tqdm", + "ruamel.yaml", + "apparun==0.3.1", + "pre-commit", + "typer==0.15.1", +] + +[project.scripts] +appabuild = "app.cli.main:cli_app" + +[project.urls] +"Source" = "https://github.com/appalca/appabuild/" \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index 0d4c463..59b3ff1 100644 --- a/requirements.txt +++ b/requirements.txt @@ -8,7 +8,7 @@ uvicorn[standard] flake8 black isort -typer +typer==0.15.1 omegaconf pydantic scipy @@ -22,3 +22,4 @@ tqdm ruamel.yaml apparun==0.3.0 pre-commit +hatchling diff --git a/setup.py b/setup.py deleted file mode 100644 index 1cff867..0000000 --- a/setup.py +++ /dev/null @@ -1,15 +0,0 @@ -from setuptools import find_packages, setup - -setup( - name="appabuild", - version="0.3.0", - author="Maxime Peralta", - author_email="maxime.peralta@cea.fr", - description="Appa Build is a package to build impact models", - packages=find_packages(), - entry_points={ - "console_scripts": [ - "appabuild=app.cli.__main__:app", - ], - }, -) \ No newline at end of file