Skip to content

Commit

Permalink
Merge pull request #37 from UBC-MDS/new_dev_working_script
Browse files Browse the repository at this point in the history
New dev working script
  • Loading branch information
javiermtzo99 authored Jan 17, 2025
2 parents d6b0b46 + faf2d5c commit 69ee212
Show file tree
Hide file tree
Showing 11 changed files with 151 additions and 11 deletions.
42 changes: 42 additions & 0 deletions dev_builder.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#!/bin/bash

# Step 1: Ensure conda is available
if ! command -v conda &> /dev/null
then
echo "Conda could not be found. Please install Miniconda or Anaconda."
exit 1
fi

# Step 2: Extract environment name correctly (remove extra quotes)
env_name=$(grep "^name:" environment.yml | awk '{print $2}' | tr -d '"')

if [ -z "$env_name" ]; then
echo "Error: Could not determine the environment name from environment.yml."
exit 1
fi

echo "Checking if the environment '$env_name' exists..."
if conda info --envs | awk '{print $1}' | grep -qx "$env_name"; then
echo "Environment '$env_name' already exists. Skipping creation."
else
echo "Creating the Conda environment: $env_name"
conda env create -f environment.yml
fi

# Step 3: Ensure Conda is properly initialized
eval "$(conda shell.bash hook)"

# Step 4: Install dependencies using Poetry
echo "Installing dependencies with Poetry..."
if ! command -v poetry &> /dev/null
then
echo "Poetry is not installed. Installing Poetry..."
curl -sSL https://install.python-poetry.org | python3 -
export PATH="$HOME/.local/bin:$PATH"
fi

poetry install

# Step 5: Confirm successful setup
echo "Setup complete! To activate your environment, run:"
echo " conda activate $env_name"
9 changes: 9 additions & 0 deletions environment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
name: "datastructpy"

channels:
- conda-forge
- defaults

dependencies:
- python=3.11
- poetry=2.0.1
80 changes: 80 additions & 0 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ readme = "README.md"
[tool.poetry.dependencies]
python = "^3.11"

[tool.poetry.group.dev.dependencies]
pytest = "^8.3.4"

[tool.semantic_release]
version_toml = [
"pyproject.toml:tool.poetry.version",
Expand Down
8 changes: 4 additions & 4 deletions src/datastructpy/__init__.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# read version from installed package
# Read version from installed package
from importlib.metadata import version
__version__ = version("datastructpy")

# Import key submodules or classes for easy access
from node import Node
from non_linear.trees.binary_search_tree import BinarySearchTree
# Use absolute imports
from datastructpy.node import Node
from datastructpy.non_linear.trees.binary_search_tree import BinarySearchTree

# Define the public API of the package
__all__ = [
Expand Down
9 changes: 9 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import sys
import os

# Get the absolute path to the src directory
src_path = os.path.abspath(os.path.join(os.path.dirname(__file__), "../src"))

# Add it to sys.path if not already included
if src_path not in sys.path:
sys.path.insert(0, src_path)
2 changes: 1 addition & 1 deletion tests/non-linear/trees/binary_search_tree/test_delete.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
from datastructpy.non_linear.trees.binary_search_trees import BinarySearchTree
from datastructpy.non_linear.trees.binary_search_tree import BinarySearchTree

2 changes: 1 addition & 1 deletion tests/non-linear/trees/binary_search_tree/test_insert.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
from datastructpy.non_linear.trees.binary_search_trees import BinarySearchTree
from datastructpy.non_linear.trees.binary_search_tree import BinarySearchTree
Original file line number Diff line number Diff line change
@@ -1 +1 @@
from datastructpy.non_linear.trees.binary_search_trees import BinarySearchTree
from datastructpy.non_linear.trees.binary_search_tree import BinarySearchTree
2 changes: 1 addition & 1 deletion tests/non-linear/trees/binary_search_tree/test_search.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
from datastructpy.non_linear.trees.binary_search_trees import BinarySearchTree
from datastructpy.non_linear.trees.binary_search_tree import BinarySearchTree
3 changes: 0 additions & 3 deletions tests/test_datastructpy.py

This file was deleted.

0 comments on commit 69ee212

Please sign in to comment.