Skip to content

Commit 087ecff

Browse files
authored
refactor: Re-arrange the project to make improvements (#34)
### Description This PR adds a few things: - [x] Documentation page - [x] Pre-commit CI - [ ] Pytest CI - [x] Integration test CI Fixes #29 This is a breaking changes.
1 parent 63de899 commit 087ecff

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+4840
-1248
lines changed

.codespell-ignore

Whitespace-only changes.

.github/ISSUE_TEMPLATE/build.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ body:
1010
label: "Where?"
1111
description: "Provide path from the root of the repository."
1212
placeholder: "mqpy/"
13-
13+
1414
- type: textarea
1515
id: requested_change
1616
attributes:

.github/ISSUE_TEMPLATE/feat.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@ body:
1616
attributes:
1717
label: Task Description
1818
description: Provide a clear and concise description of what needs to be done.
19-
placeholder: Describe the problem or proposed solution.
19+
placeholder: Describe the problem or proposed solution.

.github/ISSUE_TEMPLATE/perf.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,3 @@ body:
1717
label: Area for Performance Improvement
1818
description: Specify the part of the codebase or system that requires optimization. Explain why it needs improvement and describe the current performance issue as the proposed solution.
1919
placeholder: e.g., "The sorting algorithm in module X is slow when handling large datasets."
20-

.github/workflows/deploy-mkdocs.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Deploy | Deploy MkDocs
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches: ['main']
7+
8+
permissions:
9+
contents: read
10+
pages: write
11+
id-token: write
12+
13+
jobs:
14+
deploy:
15+
runs-on: windows-latest
16+
environment:
17+
name: github-pages
18+
url: ${{ steps.deployment.outputs.page_url }}
19+
steps:
20+
- name: Checkout
21+
uses: actions/checkout@v4
22+
23+
- name: Install uv and set the python version
24+
uses: astral-sh/setup-uv@v5
25+
with:
26+
python-version: "3.11"
27+
28+
- name: Install the project
29+
run: uv sync --locked --group docs
30+
31+
- name: Build MkDocs
32+
run: mkdocs build --site-dir ./deploy
33+
34+
- name: Setup Pages
35+
uses: actions/configure-pages@v4
36+
37+
- name: Upload artifact
38+
uses: actions/upload-pages-artifact@v3
39+
with:
40+
path: './deploy'
41+
42+
- name: Deploy to GitHub Pages
43+
id: deployment
44+
uses: actions/deploy-pages@v4
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Deploy | Semantic Release
2+
3+
on:
4+
workflow_dispatch:
5+
6+
jobs:
7+
release:
8+
runs-on: windows-latest
9+
concurrency: release
10+
permissions:
11+
contents: write
12+
13+
steps:
14+
- name: Checkout repository
15+
uses: actions/checkout@v4
16+
with:
17+
fetch-depth: 0
18+
19+
- name: Python Release
20+
uses: python-semantic-release/python-semantic-release@v9.20.0
21+
with:
22+
github_token: ${{ secrets.GITHUB_TOKEN }}
23+
push: "true"
24+
changelog: "true"

.github/workflows/deploy.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@ name: Publish distributions
22

33
on:
44
push:
5-
branches:
6-
- '*'
5+
branches: ['main']
76
tags:
87
- v*
98

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
name: Test | Integration Test
2+
3+
on: [push]
4+
5+
jobs:
6+
build:
7+
runs-on: windows-latest
8+
timeout-minutes: 15
9+
steps:
10+
- name: Checkout repository
11+
uses: actions/checkout@v4
12+
13+
- name: Set up Python
14+
uses: actions/setup-python@v4
15+
with:
16+
python-version: '3.11'
17+
18+
- name: Download MetaTrader5 Installer
19+
shell: pwsh
20+
run: |
21+
$url = "https://download.mql5.com/cdn/web/metaquotes.software.corp/mt5/mt5setup.exe"
22+
$output = "$env:GITHUB_WORKSPACE\mt5setup.exe"
23+
Invoke-WebRequest -Uri $url -OutFile $output
24+
Write-Host "Download completed. File size: $((Get-Item $output).Length) bytes"
25+
26+
- name: Install MetaTrader5
27+
run: |
28+
$process = Start-Process -FilePath ".\mt5setup.exe" -ArgumentList "/auto", "/portable" -PassThru
29+
$process.WaitForExit(300000)
30+
if (-not $process.HasExited) {
31+
Write-Host "MT5 installer stuck, killing..."
32+
Stop-Process -Id $process.Id -Force
33+
exit 1
34+
}
35+
shell: pwsh
36+
37+
- name: Launch MT5
38+
shell: pwsh
39+
run: |
40+
$mt5Path = Resolve-Path "C:\Program Files\MetaTrader 5\terminal64.exe"
41+
42+
# Launch with diagnostics
43+
Start-Process $mt5Path -ArgumentList @(
44+
"/portable",
45+
"/headless",
46+
"/config:config",
47+
"/noreport"
48+
) -NoNewWindow
49+
50+
# Verify process start
51+
$attempts = 0
52+
while ($attempts -lt 10) {
53+
if (Get-Process terminal64 -ErrorAction SilentlyContinue) {
54+
Write-Host "MT5 process detected"
55+
break
56+
}
57+
$attempts++
58+
Start-Sleep 5
59+
}
60+
61+
if (-not (Get-Process terminal64 -ErrorAction SilentlyContinue)) {
62+
Get-Content ".\MetaTrader 5\logs\*.log" | Write-Host
63+
throw "MT5 failed to start"
64+
}
65+
66+
- name: Install MetaTrader5 Python package
67+
run: pip install MetaTrader5
68+
69+
- name: Run MT5 Test
70+
env:
71+
MT5_LOGIN: ${{ secrets.MT5_LOGIN }}
72+
MT5_PASSWORD: ${{ secrets.MT5_PASSWORD }}
73+
MT5_SERVER: "MetaQuotes-Demo"
74+
MT5_PATH: "C:\\Program Files\\MetaTrader 5\\terminal64.exe"
75+
run: |
76+
python tests/integration/test_mt5_connection.py
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: Test | Pre-commit
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches: ['*']
7+
8+
jobs:
9+
pre-commit:
10+
permissions: write-all
11+
runs-on: windows-latest
12+
13+
steps:
14+
- name: Checkout repository
15+
uses: actions/checkout@v4
16+
17+
- name: Run Pre-commit
18+
uses: pre-commit/action@v3.0.1
19+
with:
20+
extra_args: --all-files

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
.env
2-
*.pyc
2+
*.pyc

.pre-commit-config.yaml

Lines changed: 67 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,72 @@
1+
default_language_version:
2+
python: python3
13
repos:
2-
- repo: https://github.com/pre-commit/pre-commit-hooks
3-
rev: v4.5.0
4-
hooks:
5-
- id: trailing-whitespace
6-
- id: end-of-file-fixer
7-
- id: check-yaml
8-
- id: check-added-large-files
9-
language_version: python3
4+
- repo: https://github.com/pre-commit/pre-commit-hooks
5+
rev: v5.0.0
6+
hooks:
7+
- id: check-added-large-files
8+
- id: check-ast
9+
- id: check-builtin-literals
10+
- id: check-byte-order-marker
11+
- id: check-case-conflict
12+
- id: check-docstring-first
13+
- id: check-executables-have-shebangs
14+
- id: check-json
15+
- id: check-merge-conflict
16+
- id: check-shebang-scripts-are-executable
17+
- id: check-symlinks
18+
- id: check-yaml
19+
- id: debug-statements
20+
- id: destroyed-symlinks
21+
- id: end-of-file-fixer
22+
- id: file-contents-sorter
23+
- id: trailing-whitespace
1024

25+
- repo: https://github.com/astral-sh/ruff-pre-commit
26+
rev: v0.8.6
27+
hooks:
28+
- id: ruff
29+
args: [--fix, --exit-non-zero-on-fix]
30+
- id: ruff-format
1131

32+
- repo: https://github.com/codespell-project/codespell
33+
rev: v2.3.0
34+
hooks:
35+
- id: codespell
36+
language: python
37+
types: [text]
38+
entry: codespell --ignore-words=.codespell-ignore --check-filenames
39+
exclude: uv.lock
1240

13-
- repo: https://github.com/psf/black
14-
rev: 23.11.0
15-
hooks:
16-
- id: black
17-
args: [--safe, --line-length=120]
41+
- repo: https://github.com/pre-commit/mirrors-mypy
42+
rev: v1.14.1
43+
hooks:
44+
- id: mypy
45+
name: mypy
46+
pass_filenames: false
47+
args:
48+
[
49+
--strict-equality,
50+
--disallow-untyped-calls,
51+
--disallow-untyped-defs,
52+
--disallow-incomplete-defs,
53+
--disallow-any-generics,
54+
--check-untyped-defs,
55+
--disallow-untyped-decorators,
56+
--warn-redundant-casts,
57+
--warn-unused-ignores,
58+
--no-warn-no-return,
59+
--warn-unreachable,
60+
]
61+
additional_dependencies: ["types-requests", "types-PyYAML"]
1862

19-
- repo: https://github.com/pycqa/isort
20-
rev: 5.12.0
21-
hooks:
22-
- id: isort
23-
args: [--profile=black]
63+
- repo: local
64+
hooks:
65+
- id: pylint
66+
name: pylint
67+
entry: pylint
68+
language: python
69+
additional_dependencies: ["pylint"]
70+
types: [python]
71+
args: ["--disable=all", "--enable=missing-docstring,unused-argument"]
72+
exclude: 'test_\.py$'

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2021 Joao Euko
3+
Copyright (c) 2021-2025 Joao Euko
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
<div style="display: flex; justify-content: center;">
2+
<img src="docs/assets/logo.svg" alt="MQPy Logo" style="width: 200px; height: 200px;">
3+
</div>
4+
5+
16
![PyPI - Downloads](https://img.shields.io/pypi/dm/mqpy)
27
![PyPI](https://img.shields.io/pypi/v/mqpy)
38
![PyPI - Wheel](https://img.shields.io/pypi/wheel/mqpy)

docs/assets/favicon.svg

Lines changed: 27 additions & 0 deletions
Loading

docs/assets/logo-icon.svg

Lines changed: 34 additions & 0 deletions
Loading

0 commit comments

Comments
 (0)