Skip to content

Commit

Permalink
Release GMime v1.0.0 🔥
Browse files Browse the repository at this point in the history
  • Loading branch information
gryumov committed Oct 7, 2024
0 parents commit 87bc248
Show file tree
Hide file tree
Showing 28 changed files with 166,285 additions and 0 deletions.
9 changes: 9 additions & 0 deletions .JuliaFormatter.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# .JuliaFormatter.toml

margin = 92 # The maximum line length for code
short_to_long_function_def = true # Whether to use short or long function definitions
always_use_return = true # Whether to always use the return keyword in functions
separate_kwargs_with_semicolon = false # Whether to separate keyword arguments with semicolons instead of commas
join_lines_based_on_source = false # Whether to join lines based on source code instead of formatting rules
whitespace_in_kwargs = true # Whether to include whitespace around keyword argument separators
remove_extra_newlines = true # Whether to remove extra newlines in code
7 changes: 7 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/.github/ @aklochkov @gryumov
/src/ @aklochkov @gryumov
/test/ @aklochkov @gryumov
/.JuliaFormatter.toml @aklochkov @gryumov
/.gitignore @aklochkov @gryumov
/LICENSE @aklochkov @gryumov
/Project.toml @aklochkov @gryumov
41 changes: 41 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
---
name: 'Bug report'
about: Create a report to help us improve
title: ''
labels: bug
assignees: ''

---

Describe the bug
---
> A clear and concise description of what the bug is.


To Reproduce
---
> Add a Minimal, Complete, and Verifiable example (for more details, see e.g. https://stackoverflow.com/help/mcve)
>
> If the code is too long, feel free to put it in a public gist and link
it in the issue: https://gist.github.com

```julia
# Past your code here.
```



Expected behavior
---
> A clear and concise description of what you expected to happen.


Additional context
---
> Add any other context about the problem here.\
> Please include the output of\
> `julia> versioninfo()`\
> and\
> `pkg> st`
32 changes: 32 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: 'feature'
assignees: ''

---

Is your feature request related to a problem? Please describe.
---
> A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]


Describe the solution you'd like
---
> A clear and concise description of what you want to happen.


Describe alternatives you've considered
---
> A clear and concise description of any alternative solutions or features you've considered.


Additional context
---
> Add any other context or screenshots about the feature request here.

6 changes: 6 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
### Pull request checklist

- [ ] Did you bump the project version?
- [ ] Did you add a description to the Pull Request?
- [ ] Did you add new tests?
- [ ] Did you add reviewers?
8 changes: 8 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/" # Location of package manifests
schedule:
interval: "weekly"

81 changes: 81 additions & 0 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
name: CI

on:
push:
branches:
- master
tags: ['*']
pull_request:
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }}

jobs:
test:
name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ github.event_name }}
runs-on: ${{ matrix.os }}
timeout-minutes: 60
permissions:
actions: write
contents: read
strategy:
fail-fast: false
matrix:
version:
- '1'
- '1.8'
- '1.9'
- '1.10'
os:
- ubuntu-latest
arch:
- x64
steps:
- uses: actions/checkout@v4
- uses: julia-actions/setup-julia@v2
with:
version: ${{ matrix.version }}
arch: ${{ matrix.arch }}
- uses: julia-actions/cache@v2
- uses: julia-actions/julia-buildpkg@v1
- uses: julia-actions/julia-runtest@v1
- uses: julia-actions/julia-processcoverage@v1
- uses: codecov/codecov-action@v4
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
with:
files: lcov.info

docs:
permissions:
contents: write
statuses: write
actions: write
pull-requests: write
name: Documentation
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: julia-actions/setup-julia@latest
- uses: julia-actions/cache@v2
- name: Install dependencies
run: julia --project=docs/ -e 'using Pkg; Pkg.develop(PackageSpec(; path = pwd())); Pkg.instantiate();'
- name: Build and deploy
env:
GITHUB_TOKEN: ${{ github.token }}
run: julia --project=docs/ docs/make.jl
- name: Make comment with preview link
if: ${{ github.event_name == 'pull_request' && github.event.action == 'opened'}}
uses: actions/github-script@v7
with:
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: ':blue_book: A preview of the documentation will be [here](${{env.preview_url}}) soon'
})
env:
preview_url: https://${{ github.repository_owner }}.github.io/${{ github.event.repository.name }}/previews/PR${{ github.event.number }}/
18 changes: 18 additions & 0 deletions .github/workflows/CompatHelper.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: CompatHelper

on:
schedule:
- cron: 0 0 * * *
workflow_dispatch:

jobs:
CompatHelper:
runs-on: ubuntu-latest
steps:
- name: Pkg.add("CompatHelper")
run: julia -e 'using Pkg; Pkg.add("CompatHelper")'
- name: CompatHelper.main()
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COMPATHELPER_PRIV: ${{ secrets.DOCUMENTER_KEY }}
run: julia -e 'using CompatHelper; CompatHelper.main()'
31 changes: 31 additions & 0 deletions .github/workflows/TagBot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: TagBot
on:
issue_comment:
types:
- created
workflow_dispatch:
inputs:
lookback:
default: 3
permissions:
actions: read
checks: read
contents: write
deployments: read
issues: read
discussions: read
packages: read
pages: read
pull-requests: read
repository-projects: read
security-events: read
statuses: read
jobs:
TagBot:
if: github.event_name == 'workflow_dispatch' || github.actor == 'JuliaTagBot'
runs-on: ubuntu-latest
steps:
- uses: JuliaRegistries/TagBot@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
ssh: ${{ secrets.DOCUMENTER_KEY }}
30 changes: 30 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# MacOS system files
.DS_Store

# Visual Studio Code settings
.vscode

# Files generated by invoking Julia with --code-coverage
*.jl.cov
*.jl.*.cov

# Files generated by invoking Julia with --track-allocation
*.jl.mem

# System-specific files and directories generated by the BinaryProvider and BinDeps packages
# They contain absolute paths specific to the host computer, and so should not be committed
deps/deps.jl
deps/build.log
deps/downloads/
deps/usr/
deps/src/

# Build artifacts for creating documentation generated by the Documenter package
docs/build/
docs/site/

# File generated by Pkg, the package manager, based on a corresponding Project.toml
# It records a fixed state of all packages used by the project. As such, it should not be
# committed for packages, but should be committed for applications that require a static
# environment.
Manifest.toml
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# GMime.jl Changelog

The latest version of this file can be found at the master branch of the [GMime.jl repository](https://github.com/bhftbootcamp/GMime.jl).
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2024 Betterhand AG

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
11 changes: 11 additions & 0 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name = "GMime"
uuid = "158299e7-fc4f-4c3e-9fda-ad8bb0e07f1e"
version = "1.0.0"

[deps]
Dates = "ade2ca70-3891-5945-98fb-dc099432e06a"
gmime_jll = "84a963f3-210d-52bd-a31c-8c93a6d2cb5c"

[compat]
gmime_jll = "3.2.15"
julia = "1.8"
71 changes: 71 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# GMime.jl

[![Stable](https://img.shields.io/badge/docs-stable-blue.svg)](https://bhftbootcamp.github.io/GMime.jl/stable/)
[![Dev](https://img.shields.io/badge/docs-dev-blue.svg)](https://bhftbootcamp.github.io/GMime.jl/dev/)
[![Build Status](https://github.com/bhftbootcamp/GMime.jl/actions/workflows/CI.yml/badge.svg?branch=master)](https://github.com/bhftbootcamp/GMime.jl/actions/workflows/CI.yml?query=branch%3Amaster)
[![Coverage](https://codecov.io/gh/bhftbootcamp/GMime.jl/branch/master/graph/badge.svg)](https://codecov.io/gh/bhftbootcamp/GMime.jl)
[![Registry](https://img.shields.io/badge/registry-General-4063d8)](https://github.com/JuliaRegistries/General)

GMime is a convenient wrapper around the [GMime](https://github.com/jstedfast/gmime) library for parsing email messages in Julia, such as sender, recipient, date, body text, and attachments.​

## Installation

To install GMime, simply use the Julia package manager:

```julia
] add Gmime
```

## Usage

A small example of parsing the content from an email body:

```julia
using GMime
using EasyCurl

# Fetch the email data from an IMAP server
response = imap_request(
"imaps://imap.gmail.com:993",
get(ENV, "IMAP_USER", ""),
get(ENV, "IMAP_PASSWORD", ""),
mailbox = "INBOX",
path = "MAILINDEX=993"
)

# Extract the raw email body
data = imap_body(response)

# Parse the email using GMime
julia> email = parse_email(data)
📧 Email:
📤 From: Broker Support <support@broker.com>
📥 To: Portfolio Manager <pm@hedgefund.com>
🕒 Date: 2024-08-06T17:34:04
📎 Attachments:
1. 📎 Attachment:
📄 Name: CashFlowReport_Q3_2024.pdf
🛠️ Encoding: base64
🏷 Mime type: application/pdf
📏 Size: 18000 bytes

2. 📎 Attachment:
📄 Name: ClosedPositions_Summary_2024-08-06.csv
🛠️ Encoding: base64
🏷 Mime type: text/csv
📏 Size: 250000 bytes

3. 📎 Attachment:
📄 Name: DailyTransaction_2024-08-06.csv
🛠️ Encoding: base64
🏷 Mime type: text/csv
📏 Size: 12800 bytes
```

## Useful Links
1. Turn on the IMAP support at email provider cabinet. See this [Gmail](https://support.getmailbird.com/hc/en-us/articles/220106527-Enabling-IMAP-for-Gmail) guide.
2. Create an app-specific password for your email. See [here](https://support.google.com/accounts/answer/185833?hl=en) for details.

## Contributing

Contributions to GMime are welcome! If you encounter a bug, have a feature request, or would like to contribute code, please open an issue or a pull request on GitHub.
3 changes: 3 additions & 0 deletions docs/Project.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[deps]
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
GMime = "158299e7-fc4f-4c3e-9fda-ad8bb0e07f1e"
Loading

0 comments on commit 87bc248

Please sign in to comment.