From c51199dc1240aa2954d8e9ad1c53bcbf24461090 Mon Sep 17 00:00:00 2001 From: James Bayley <36523314+jamesbayley@users.noreply.github.com> Date: Fri, 3 May 2024 18:36:04 +0000 Subject: [PATCH] Update project structure --- .devcontainer/devcontainer.json | 2 +- .vscode/settings.json | 7 +++---- gazelle/Cargo.lock => Cargo.lock | 0 Cargo.toml | 11 +++++++++++ gazelle/Cargo.toml | 14 -------------- gazelle/python/__init__.py | 0 gazelle/poetry.toml => poetry.toml | 0 gazelle/pyproject.toml => pyproject.toml | 4 ++-- .../.d/bluebook/properties/cf-chs.json | 0 .../.d/bluebook/properties/cf-rhs.json | 0 .../.d/bluebook/properties/cf-shs.json | 0 .../.d/bluebook/properties/equal-l.json | 0 .../.d/bluebook/properties/hf-chs.json | 0 .../.d/bluebook/properties/hf-ehs.json | 0 .../.d/bluebook/properties/hf-rhs.json | 0 .../.d/bluebook/properties/hf-shs.json | 0 .../.d/bluebook/properties/pfc.json | 0 .../.d/bluebook/properties/t-split-from-ub.json | 0 .../.d/bluebook/properties/t-split-from-uc.json | 0 .../.d/bluebook/properties/ub.json | 0 .../.d/bluebook/properties/ubp.json | 0 .../.d/bluebook/properties/uc.json | 0 .../.d/bluebook/properties/unequal-l.json | 0 python/__init__.py | 5 +++++ {gazelle/python => python}/main.py | 2 +- {gazelle/python => python}/steel.py | 4 ++-- {gazelle/python => python}/units.py | 2 +- {gazelle/rust => src}/lib.rs | 1 + 28 files changed, 27 insertions(+), 25 deletions(-) rename gazelle/Cargo.lock => Cargo.lock (100%) create mode 100644 Cargo.toml delete mode 100644 gazelle/Cargo.toml delete mode 100644 gazelle/python/__init__.py rename gazelle/poetry.toml => poetry.toml (100%) rename gazelle/pyproject.toml => pyproject.toml (96%) rename {gazelle/python => python}/.d/bluebook/properties/cf-chs.json (100%) rename {gazelle/python => python}/.d/bluebook/properties/cf-rhs.json (100%) rename {gazelle/python => python}/.d/bluebook/properties/cf-shs.json (100%) rename {gazelle/python => python}/.d/bluebook/properties/equal-l.json (100%) rename {gazelle/python => python}/.d/bluebook/properties/hf-chs.json (100%) rename {gazelle/python => python}/.d/bluebook/properties/hf-ehs.json (100%) rename {gazelle/python => python}/.d/bluebook/properties/hf-rhs.json (100%) rename {gazelle/python => python}/.d/bluebook/properties/hf-shs.json (100%) rename {gazelle/python => python}/.d/bluebook/properties/pfc.json (100%) rename {gazelle/python => python}/.d/bluebook/properties/t-split-from-ub.json (100%) rename {gazelle/python => python}/.d/bluebook/properties/t-split-from-uc.json (100%) rename {gazelle/python => python}/.d/bluebook/properties/ub.json (100%) rename {gazelle/python => python}/.d/bluebook/properties/ubp.json (100%) rename {gazelle/python => python}/.d/bluebook/properties/uc.json (100%) rename {gazelle/python => python}/.d/bluebook/properties/unequal-l.json (100%) create mode 100644 python/__init__.py rename {gazelle/python => python}/main.py (76%) rename {gazelle/python => python}/steel.py (99%) rename {gazelle/python => python}/units.py (99%) rename {gazelle/rust => src}/lib.rs (95%) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index aa7c866..6d7da56 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -2,7 +2,7 @@ "name": "Gazelle", "runArgs": ["--name", "gazelle"], "build": { "dockerfile": "Dockerfile" }, - "postCreateCommand": "cd gazelle && poetry install", + "postCreateCommand": "poetry install && cargo build", "privileged": true, "features": { "ghcr.io/devcontainers/features/git:1": {}, diff --git a/.vscode/settings.json b/.vscode/settings.json index c3f7887..92280a3 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -14,12 +14,11 @@ "files.exclude": { "**/.git": false, "**/bin": false, - "**/obj": true, - "**/target/": false, + "**/target/": true, "**/poetry.lock": true, "**/__pycache__": true, "**/.pytest_cache": true, - "**/.venv": false + "**/.venv": true }, "git.autofetch": true, @@ -38,7 +37,7 @@ "powershell.suppressAdditionalExeNotFoundWarning": false, "python.analysis.autoFormatStrings": true, - "python.defaultInterpreterPath": "gazelle/.venv/bin/python", + "python.defaultInterpreterPath": ".venv/bin/python", "python.languageServer": "Pylance", "python.testing.pytestEnabled": true, "python.testing.pytestPath": "pytest", diff --git a/gazelle/Cargo.lock b/Cargo.lock similarity index 100% rename from gazelle/Cargo.lock rename to Cargo.lock diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 0000000..22880ac --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,11 @@ +[package] +name = "gazelle" +version = "0.1.0" +edition = "2021" + +[dependencies] +pyo3 = { version = "0.21.2", features = ["extension-module"] } + +[lib] +name = "gazelle" +crate-type = ["cdylib"] diff --git a/gazelle/Cargo.toml b/gazelle/Cargo.toml deleted file mode 100644 index 423d400..0000000 --- a/gazelle/Cargo.toml +++ /dev/null @@ -1,14 +0,0 @@ -[package] -name = "gazelle" -version = "0.1.0" -edition = "2021" -description = "A fast, open-source engine for civil engineers." -repository = "https://github.com/gazellekit/gazelle.git" -license = "AGPL-3.0-or-later" - -[dependencies] -pyo3 = { version = "0.21.2", features = ["extension-module"] } - -[lib] -path = "rust/lib.rs" -crate-type = ["cdylib", "rlib"] diff --git a/gazelle/python/__init__.py b/gazelle/python/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/gazelle/poetry.toml b/poetry.toml similarity index 100% rename from gazelle/poetry.toml rename to poetry.toml diff --git a/gazelle/pyproject.toml b/pyproject.toml similarity index 96% rename from gazelle/pyproject.toml rename to pyproject.toml index 27f4dfa..f562288 100644 --- a/gazelle/pyproject.toml +++ b/pyproject.toml @@ -1,12 +1,12 @@ [tool.poetry] name = "gazelle" version = "0.1.0" -readme = "../README.md" +readme = "README.md" license = "AGPL-3.0-or-later" documentation = "https://docs.gazelle.sh" -description = "A fast, open-source engine for civil engineers." repository = "https://github.com/gazellekit/gazelle.git" authors = ["James S. Bayley "] +description = "A fast, open-source engine for civil engineers." packages = [{ include = "python" }] classifiers = [ "Programming Language :: Rust", diff --git a/gazelle/python/.d/bluebook/properties/cf-chs.json b/python/.d/bluebook/properties/cf-chs.json similarity index 100% rename from gazelle/python/.d/bluebook/properties/cf-chs.json rename to python/.d/bluebook/properties/cf-chs.json diff --git a/gazelle/python/.d/bluebook/properties/cf-rhs.json b/python/.d/bluebook/properties/cf-rhs.json similarity index 100% rename from gazelle/python/.d/bluebook/properties/cf-rhs.json rename to python/.d/bluebook/properties/cf-rhs.json diff --git a/gazelle/python/.d/bluebook/properties/cf-shs.json b/python/.d/bluebook/properties/cf-shs.json similarity index 100% rename from gazelle/python/.d/bluebook/properties/cf-shs.json rename to python/.d/bluebook/properties/cf-shs.json diff --git a/gazelle/python/.d/bluebook/properties/equal-l.json b/python/.d/bluebook/properties/equal-l.json similarity index 100% rename from gazelle/python/.d/bluebook/properties/equal-l.json rename to python/.d/bluebook/properties/equal-l.json diff --git a/gazelle/python/.d/bluebook/properties/hf-chs.json b/python/.d/bluebook/properties/hf-chs.json similarity index 100% rename from gazelle/python/.d/bluebook/properties/hf-chs.json rename to python/.d/bluebook/properties/hf-chs.json diff --git a/gazelle/python/.d/bluebook/properties/hf-ehs.json b/python/.d/bluebook/properties/hf-ehs.json similarity index 100% rename from gazelle/python/.d/bluebook/properties/hf-ehs.json rename to python/.d/bluebook/properties/hf-ehs.json diff --git a/gazelle/python/.d/bluebook/properties/hf-rhs.json b/python/.d/bluebook/properties/hf-rhs.json similarity index 100% rename from gazelle/python/.d/bluebook/properties/hf-rhs.json rename to python/.d/bluebook/properties/hf-rhs.json diff --git a/gazelle/python/.d/bluebook/properties/hf-shs.json b/python/.d/bluebook/properties/hf-shs.json similarity index 100% rename from gazelle/python/.d/bluebook/properties/hf-shs.json rename to python/.d/bluebook/properties/hf-shs.json diff --git a/gazelle/python/.d/bluebook/properties/pfc.json b/python/.d/bluebook/properties/pfc.json similarity index 100% rename from gazelle/python/.d/bluebook/properties/pfc.json rename to python/.d/bluebook/properties/pfc.json diff --git a/gazelle/python/.d/bluebook/properties/t-split-from-ub.json b/python/.d/bluebook/properties/t-split-from-ub.json similarity index 100% rename from gazelle/python/.d/bluebook/properties/t-split-from-ub.json rename to python/.d/bluebook/properties/t-split-from-ub.json diff --git a/gazelle/python/.d/bluebook/properties/t-split-from-uc.json b/python/.d/bluebook/properties/t-split-from-uc.json similarity index 100% rename from gazelle/python/.d/bluebook/properties/t-split-from-uc.json rename to python/.d/bluebook/properties/t-split-from-uc.json diff --git a/gazelle/python/.d/bluebook/properties/ub.json b/python/.d/bluebook/properties/ub.json similarity index 100% rename from gazelle/python/.d/bluebook/properties/ub.json rename to python/.d/bluebook/properties/ub.json diff --git a/gazelle/python/.d/bluebook/properties/ubp.json b/python/.d/bluebook/properties/ubp.json similarity index 100% rename from gazelle/python/.d/bluebook/properties/ubp.json rename to python/.d/bluebook/properties/ubp.json diff --git a/gazelle/python/.d/bluebook/properties/uc.json b/python/.d/bluebook/properties/uc.json similarity index 100% rename from gazelle/python/.d/bluebook/properties/uc.json rename to python/.d/bluebook/properties/uc.json diff --git a/gazelle/python/.d/bluebook/properties/unequal-l.json b/python/.d/bluebook/properties/unequal-l.json similarity index 100% rename from gazelle/python/.d/bluebook/properties/unequal-l.json rename to python/.d/bluebook/properties/unequal-l.json diff --git a/python/__init__.py b/python/__init__.py new file mode 100644 index 0000000..cd4814e --- /dev/null +++ b/python/__init__.py @@ -0,0 +1,5 @@ +import gazelle as gz + +__doc__ = gz.__doc__ +if hasattr(gz, "__all__"): + __all__ = gz.__all__ \ No newline at end of file diff --git a/gazelle/python/main.py b/python/main.py similarity index 76% rename from gazelle/python/main.py rename to python/main.py index 1ddfde5..f7dbd4d 100644 --- a/gazelle/python/main.py +++ b/python/main.py @@ -1,5 +1,5 @@ import gazelle as gz -from python.steel import SteelFabricator, SectionCategory, UniversalBeam +from .steel import SteelFabricator, SectionCategory, UniversalBeam print("Welcome to Gazelle! 🦌") print(f'The answer is: {gz.sum_as_string(10, 32)}') diff --git a/gazelle/python/steel.py b/python/steel.py similarity index 99% rename from gazelle/python/steel.py rename to python/steel.py index f86830c..9a6a4b8 100644 --- a/gazelle/python/steel.py +++ b/python/steel.py @@ -1,5 +1,5 @@ # SPDX-License-Identifier: AGPL-3.0-or-later -# Gazelle: A fast engine for civil engineering design. +# Gazelle: A fast, open-source engine for civil engineers. # Copyright (C) 2024 James S. Bayley """ @@ -17,7 +17,7 @@ from enum import Enum from typing import Generic, NewType, Tuple, TypeVar, Union -from python.units import ( +from .units import ( Area, Carbon, Centimetre, diff --git a/gazelle/python/units.py b/python/units.py similarity index 99% rename from gazelle/python/units.py rename to python/units.py index 0ba0875..0642c1c 100644 --- a/gazelle/python/units.py +++ b/python/units.py @@ -1,5 +1,5 @@ # SPDX-License-Identifier: AGPL-3.0-or-later -# Gazelle: A fast engine for civil engineering design. +# Gazelle: A fast, open-source engine for civil engineers. # Copyright (C) 2024 James S. Bayley diff --git a/gazelle/rust/lib.rs b/src/lib.rs similarity index 95% rename from gazelle/rust/lib.rs rename to src/lib.rs index c67f779..fe65afa 100644 --- a/gazelle/rust/lib.rs +++ b/src/lib.rs @@ -10,6 +10,7 @@ fn sum_as_string(a: usize, b: usize) -> PyResult { /// the `lib.name` setting in the `Cargo.toml`, else Python will not be able to /// import the module. #[pymodule] +#[pyo3(name="gazelle")] fn gazelle(m: &Bound<'_, PyModule>) -> PyResult<()> { m.add_function(wrap_pyfunction!(sum_as_string, m)?)?; Ok(())