Skip to content

Commit

Permalink
Merge branch 'main' of github.com:UBC-MDS/hexdropper
Browse files Browse the repository at this point in the history
  • Loading branch information
monazhu committed Jan 24, 2024
2 parents 6d3ef6e + 998eab9 commit a3c7934
Show file tree
Hide file tree
Showing 7 changed files with 291 additions and 64 deletions.
76 changes: 67 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@

A Python package designed for graphic designers, developers, and color enthusiasts. It simplifies the process of obtaining hex color codes from images. Given a cropped image, hexdropper quickly identifies and outputs the corresponding hex color code, streamlining design and development workflows.

## Contributors

- [Julia Everitt](https://github.com/juliaeveritt)
- [Hancheng Qin](https://github.com/hchqin)
- [Joey Wu](https://github.com/joeywwwu)
- [Mona Zhu](https://github.com/monazhu)

## Features
The key functionalities include:

Expand All @@ -15,10 +22,68 @@ The key functionalities include:

## Installation

```bash
$ pip install hexdropper
The current package is still under development. We have provided below a set of developer installation instructions.

### Developer Installation

#### Getting Started

Clone a copy of [this repository](https://github.com/UBC-MDS/hexdropper) onto your local machine. See [this page](https://docs.github.com/en/repositories/creating-and-managing-repositories/cloning-a-repository) for details on how to clone a repository.

#### Setting up a Conda Environment

We recommend creating an isolated conda environment on your local machine to test and develop the package. To create a conda environment for this project, type in the below command in your terminal, replacing `[your_env_name]` with your desired environment name (e.g., hexdropper)

```
$ conda create --name [your_env_name] python=3.9 -y
```

#### Using Poetry for Package Management

Please follow the official poetry [documentation](https://python-poetry.org/docs/) to install poetry on your local machine. Note that poetry should **always be installed on a dedicated virtual environment.**

Navigate to the root directory of your project folder. Ensure that your virtual conda environment has been activated. Run the following line of code to install existing packages required for the `hexdropper` package:

```
$ poetry install
```

If you would like to add a new package or dependency, run the following code in your terminal, replacing `[name-of-dependency]` with the package you would like to install (e.g., numpy)

```
$ poetry add [name-of-dependency]
```

You can also pin the specific version of the package you would like to install like so:

```
$ poetry add numpy=1.22.0 --dry-run
```

#### Running Tests

Ensure `pytest` and `pytest-cov` are installed via poetry. If not, run the following in your terminal:

```
$ poetry add --group dev pytest
```
```
$ poetry add --group dev pytest-cov
```

Ensuring that your test scripts are completed, then run the following code in your terminal to run the tests for all functions in the package:

```
$ pytest tests/
```

To run coverage tests, run the following command:

```
$ pytest tests/ --cov=pycounts
```


## Usage

- TODO
Expand All @@ -29,13 +94,6 @@ hexdropper fills a unique niche in the Python ecosystem. While there are package
- [Pillow](https://python-pillow.org/): For comprehensive image processing capabilities.
- [Matplotlib](https://matplotlib.org/): For creating visualizations and figures.

## Contributors

- [Julia Everitt](https://github.com/juliaeveritt)
- [Hancheng Qin](https://github.com/hchqin)
- [Joey Wu](https://github.com/joeywwwu)
- [Mona Zhu](https://github.com/monazhu)

## Contributing

Interested in contributing? Check out the contributing guidelines. Please note that this project is released with a Code of Conduct. By contributing to this project, you agree to abide by its terms.
Expand Down
177 changes: 134 additions & 43 deletions docs/example.ipynb

Large diffs are not rendered by default.

87 changes: 86 additions & 1 deletion poetry.lock

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

3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "hexdropper"
version = "0.1.0"
version = "2.0.0"
description = "Python package for determining the hex colour code given a cropped image."
authors = ["Julia Everitt, Hancheng Qin, Joey Wu, Mona Zhu"]
license = "MIT"
Expand All @@ -16,6 +16,7 @@ matplotlib = "^3.8.2"

[tool.poetry.group.dev.dependencies]
pytest = "^7.4.4"
pytest-cov = "^4.1.0"

[build-system]
requires = ["poetry-core>=1.0.0"]
Expand Down
2 changes: 0 additions & 2 deletions tests/test_create_color_image.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import pytest
import os
from PIL import Image
import sys
sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
from hexdropper.create_color_image import create_color_image

# Test data
Expand Down
5 changes: 1 addition & 4 deletions tests/test_read_image.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
import pytest
import sys
import os
import numpy as np
sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
from src.hexdropper.read_image import read_image
from hexdropper.read_image import read_image

# Test data
filepath_cropped_image_jpg = "tests/images/cropped_img.jpg"
Expand Down
5 changes: 1 addition & 4 deletions tests/test_rgb_to_hex.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
import sys
import os
sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
from src.hexdropper.rgb_to_hex import rgb_to_hex
from hexdropper.rgb_to_hex import rgb_to_hex

def test_standard_colors():
assert rgb_to_hex(255, 0, 0) == '#FF0000'
Expand Down

0 comments on commit a3c7934

Please sign in to comment.