Skip to content

Commit c35cea6

Browse files
committed
Reorganize and enhance repository structure
Major improvements to the todo-list-cli project: ## Project Structure - Reorganized code into proper Python package structure (src/todolist/) - Created modular architecture with separate core.py, __main__.py, and cli.py - Updated todo.py as legacy entry point for backwards compatibility ## Features Added - Priority system (high, medium, low) for tasks - Task status tracking (pending, completed) with timestamps - Search functionality to find tasks by keywords - Ability to filter tasks by status and priority - Clear completed tasks command - Enhanced CLI with argparse for better UX ## Code Quality - Added comprehensive type hints throughout the codebase - Added detailed docstrings following Google style guide - Improved error handling and validation - Created unit tests with pytest (17 test cases) ## Documentation - Created comprehensive README.md with usage examples - Added CONTRIBUTING.md with development guidelines - Added CODE_OF_CONDUCT.md for community standards - Created examples directory with Python and shell script examples - Added detailed inline documentation ## Development Infrastructure - Added pyproject.toml for modern Python packaging - Created GitHub Actions CI/CD workflow for automated testing - Added requirements-dev.txt for development dependencies - Updated .gitignore to exclude tasks.json data files - Added support for pip installation (pip install -e .) ## Testing - Created comprehensive test suite with pytest - Added tests for all core functionality - Included edge case and error condition testing - Set up code coverage reporting The repository is now production-ready with professional structure, comprehensive documentation, and automated testing.
1 parent 90f3fc0 commit c35cea6

File tree

17 files changed

+1614
-56
lines changed

17 files changed

+1614
-56
lines changed

.github/workflows/ci.yml

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [ main, develop ]
6+
pull_request:
7+
branches: [ main, develop ]
8+
9+
jobs:
10+
test:
11+
runs-on: ${{ matrix.os }}
12+
strategy:
13+
matrix:
14+
os: [ubuntu-latest, windows-latest, macos-latest]
15+
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
16+
17+
steps:
18+
- uses: actions/checkout@v4
19+
20+
- name: Set up Python ${{ matrix.python-version }}
21+
uses: actions/setup-python@v5
22+
with:
23+
python-version: ${{ matrix.python-version }}
24+
25+
- name: Install dependencies
26+
run: |
27+
python -m pip install --upgrade pip
28+
pip install -e ".[dev]"
29+
30+
- name: Run tests
31+
run: |
32+
pytest tests/ -v --cov=todolist --cov-report=xml --cov-report=term
33+
34+
- name: Upload coverage to Codecov
35+
uses: codecov/codecov-action@v4
36+
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.11'
37+
with:
38+
file: ./coverage.xml
39+
flags: unittests
40+
name: codecov-umbrella
41+
42+
lint:
43+
runs-on: ubuntu-latest
44+
45+
steps:
46+
- uses: actions/checkout@v4
47+
48+
- name: Set up Python
49+
uses: actions/setup-python@v5
50+
with:
51+
python-version: '3.11'
52+
53+
- name: Install dependencies
54+
run: |
55+
python -m pip install --upgrade pip
56+
pip install black flake8 mypy
57+
58+
- name: Check code formatting with Black
59+
run: |
60+
black --check src/
61+
62+
- name: Lint with flake8
63+
run: |
64+
flake8 src/ --count --select=E9,F63,F7,F82 --show-source --statistics
65+
flake8 src/ --count --exit-zero --max-complexity=10 --max-line-length=88 --statistics
66+
67+
- name: Type check with mypy
68+
run: |
69+
mypy src/todolist/ --ignore-missing-imports
70+
continue-on-error: true

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,3 +172,8 @@ cython_debug/
172172

173173
# PyPI configuration file
174174
.pypirc
175+
176+
# Project-specific files
177+
tasks.json
178+
*.json
179+
!pyproject.toml

CODE_OF_CONDUCT.md

Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
# Code of Conduct
2+
3+
## Our Pledge
4+
5+
We as members, contributors, and leaders pledge to make participation in our
6+
community a harassment-free experience for everyone, regardless of age, body
7+
size, visible or invisible disability, ethnicity, sex characteristics, gender
8+
identity and expression, level of experience, education, socio-economic status,
9+
nationality, personal appearance, race, religion, or sexual identity
10+
and orientation.
11+
12+
We pledge to act and interact in ways that contribute to an open, welcoming,
13+
diverse, inclusive, and healthy community.
14+
15+
## Our Standards
16+
17+
Examples of behavior that contributes to a positive environment for our
18+
community include:
19+
20+
* Demonstrating empathy and kindness toward other people
21+
* Being respectful of differing opinions, viewpoints, and experiences
22+
* Giving and gracefully accepting constructive feedback
23+
* Accepting responsibility and apologizing to those affected by our mistakes,
24+
and learning from the experience
25+
* Focusing on what is best not just for us as individuals, but for the
26+
overall community
27+
28+
Examples of unacceptable behavior include:
29+
30+
* The use of sexualized language or imagery, and sexual attention or
31+
advances of any kind
32+
* Trolling, insulting or derogatory comments, and personal or political attacks
33+
* Public or private harassment
34+
* Publishing others' private information, such as a physical or email
35+
address, without their explicit permission
36+
* Other conduct which could reasonably be considered inappropriate in a
37+
professional setting
38+
39+
## Enforcement Responsibilities
40+
41+
Community leaders are responsible for clarifying and enforcing our standards of
42+
acceptable behavior and will take appropriate and fair corrective action in
43+
response to any behavior that they deem inappropriate, threatening, offensive,
44+
or harmful.
45+
46+
Community leaders have the right and responsibility to remove, edit, or reject
47+
comments, commits, code, wiki edits, issues, and other contributions that are
48+
not aligned to this Code of Conduct, and will communicate reasons for moderation
49+
decisions when appropriate.
50+
51+
## Scope
52+
53+
This Code of Conduct applies within all community spaces, and also applies when
54+
an individual is officially representing the community in public spaces.
55+
Examples of representing our community include using an official e-mail address,
56+
posting via an official social media account, or acting as an appointed
57+
representative at an online or offline event.
58+
59+
## Enforcement
60+
61+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
62+
reported to the community leaders responsible for enforcement through GitHub
63+
issues or by contacting the project maintainers directly.
64+
65+
All complaints will be reviewed and investigated promptly and fairly.
66+
67+
All community leaders are obligated to respect the privacy and security of the
68+
reporter of any incident.
69+
70+
## Enforcement Guidelines
71+
72+
Community leaders will follow these Community Impact Guidelines in determining
73+
the consequences for any action they deem in violation of this Code of Conduct:
74+
75+
### 1. Correction
76+
77+
**Community Impact**: Use of inappropriate language or other behavior deemed
78+
unprofessional or unwelcome in the community.
79+
80+
**Consequence**: A private, written warning from community leaders, providing
81+
clarity around the nature of the violation and an explanation of why the
82+
behavior was inappropriate. A public apology may be requested.
83+
84+
### 2. Warning
85+
86+
**Community Impact**: A violation through a single incident or series
87+
of actions.
88+
89+
**Consequence**: A warning with consequences for continued behavior. No
90+
interaction with the people involved, including unsolicited interaction with
91+
those enforcing the Code of Conduct, for a specified period of time. This
92+
includes avoiding interactions in community spaces as well as external channels
93+
like social media. Violating these terms may lead to a temporary or
94+
permanent ban.
95+
96+
### 3. Temporary Ban
97+
98+
**Community Impact**: A serious violation of community standards, including
99+
sustained inappropriate behavior.
100+
101+
**Consequence**: A temporary ban from any sort of interaction or public
102+
communication with the community for a specified period of time. No public or
103+
private interaction with the people involved, including unsolicited interaction
104+
with those enforcing the Code of Conduct, is allowed during this period.
105+
Violating these terms may lead to a permanent ban.
106+
107+
### 4. Permanent Ban
108+
109+
**Community Impact**: Demonstrating a pattern of violation of community
110+
standards, including sustained inappropriate behavior, harassment of an
111+
individual, or aggression toward or disparagement of classes of individuals.
112+
113+
**Consequence**: A permanent ban from any sort of public interaction within
114+
the community.
115+
116+
## Attribution
117+
118+
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
119+
version 2.0, available at
120+
https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
121+
122+
Community Impact Guidelines were inspired by [Mozilla's code of conduct
123+
enforcement ladder](https://github.com/mozilla/diversity).
124+
125+
[homepage]: https://www.contributor-covenant.org
126+
127+
For answers to common questions about this code of conduct, see the FAQ at
128+
https://www.contributor-covenant.org/faq. Translations are available at
129+
https://www.contributor-covenant.org/translations.

CONTRIBUTING.md

Lines changed: 187 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,187 @@
1+
# Contributing to Todo List CLI
2+
3+
Thank you for your interest in contributing to Todo List CLI! This document provides guidelines and instructions for contributing to this project.
4+
5+
## Code of Conduct
6+
7+
By participating in this project, you agree to abide by our [Code of Conduct](CODE_OF_CONDUCT.md). Please read it before contributing.
8+
9+
## How Can I Contribute?
10+
11+
### Reporting Bugs
12+
13+
Before creating bug reports, please check the existing issues to avoid duplicates. When creating a bug report, include:
14+
15+
- A clear and descriptive title
16+
- Steps to reproduce the issue
17+
- Expected behavior
18+
- Actual behavior
19+
- Your environment (OS, Python version)
20+
- Any relevant logs or error messages
21+
22+
### Suggesting Enhancements
23+
24+
Enhancement suggestions are welcome! Please provide:
25+
26+
- A clear and descriptive title
27+
- Detailed description of the proposed feature
28+
- Use cases and benefits
29+
- Any potential drawbacks or considerations
30+
31+
### Pull Requests
32+
33+
1. **Fork the repository** and create your branch from `main`
34+
2. **Make your changes** following our coding standards
35+
3. **Add tests** for any new functionality
36+
4. **Ensure all tests pass** by running `pytest`
37+
5. **Update documentation** if needed
38+
6. **Commit your changes** with clear, descriptive messages
39+
7. **Push to your fork** and submit a pull request
40+
41+
## Development Setup
42+
43+
### Prerequisites
44+
45+
- Python 3.8 or higher
46+
- pip
47+
- git
48+
49+
### Setting Up Your Development Environment
50+
51+
1. Clone your fork:
52+
```bash
53+
git clone https://github.com/YOUR_USERNAME/todo-list-cli.git
54+
cd todo-list-cli
55+
```
56+
57+
2. Create a virtual environment:
58+
```bash
59+
python -m venv venv
60+
source venv/bin/activate # On Windows: venv\Scripts\activate
61+
```
62+
63+
3. Install the package in development mode with dev dependencies:
64+
```bash
65+
pip install -e ".[dev]"
66+
```
67+
68+
### Running Tests
69+
70+
Run the test suite:
71+
```bash
72+
pytest tests/
73+
```
74+
75+
Run tests with coverage:
76+
```bash
77+
pytest --cov=todolist tests/
78+
```
79+
80+
### Code Style
81+
82+
We use several tools to maintain code quality:
83+
84+
- **Black** for code formatting:
85+
```bash
86+
black src/
87+
```
88+
89+
- **Flake8** for linting:
90+
```bash
91+
flake8 src/
92+
```
93+
94+
- **MyPy** for type checking:
95+
```bash
96+
mypy src/todolist/
97+
```
98+
99+
Before submitting a PR, ensure your code passes all checks:
100+
```bash
101+
black src/
102+
flake8 src/
103+
mypy src/todolist/ --ignore-missing-imports
104+
pytest tests/
105+
```
106+
107+
## Coding Standards
108+
109+
### Python Style Guide
110+
111+
- Follow [PEP 8](https://www.python.org/dev/peps/pep-0008/)
112+
- Use type hints for function parameters and return values
113+
- Maximum line length: 88 characters (Black default)
114+
- Use descriptive variable and function names
115+
116+
### Documentation
117+
118+
- Add docstrings to all public functions, classes, and methods
119+
- Follow [Google Python Style Guide](https://google.github.io/styleguide/pyguide.html) for docstrings
120+
- Update README.md if you add new features
121+
- Include examples in docstrings where appropriate
122+
123+
### Testing
124+
125+
- Write unit tests for all new functionality
126+
- Maintain or improve code coverage
127+
- Test edge cases and error conditions
128+
- Use descriptive test names that explain what is being tested
129+
130+
### Commit Messages
131+
132+
Write clear, concise commit messages:
133+
134+
- Use the present tense ("Add feature" not "Added feature")
135+
- Use the imperative mood ("Move cursor to..." not "Moves cursor to...")
136+
- Limit the first line to 72 characters or less
137+
- Reference issues and pull requests liberally after the first line
138+
139+
Examples:
140+
```
141+
Add search functionality for tasks
142+
143+
- Implement case-insensitive search
144+
- Add tests for search feature
145+
- Update documentation
146+
147+
Fixes #123
148+
```
149+
150+
## Project Structure
151+
152+
```
153+
todo-list-cli/
154+
├── src/
155+
│ └── todolist/
156+
│ ├── __init__.py
157+
│ ├── __main__.py
158+
│ ├── core.py
159+
│ └── cli.py
160+
├── tests/
161+
│ ├── __init__.py
162+
│ └── test_core.py
163+
├── .github/
164+
│ └── workflows/
165+
│ └── ci.yml
166+
├── README.md
167+
├── LICENSE
168+
├── pyproject.toml
169+
└── todo.py
170+
```
171+
172+
## Release Process
173+
174+
Releases are managed by project maintainers. Version numbers follow [Semantic Versioning](https://semver.org/):
175+
176+
- MAJOR version for incompatible API changes
177+
- MINOR version for new functionality in a backwards compatible manner
178+
- PATCH version for backwards compatible bug fixes
179+
180+
## Questions?
181+
182+
Feel free to:
183+
- Open an issue for questions
184+
- Start a discussion in the Issues section
185+
- Reach out to project maintainers
186+
187+
Thank you for contributing to Todo List CLI!

0 commit comments

Comments
 (0)