mirror of
https://github.com/guezoloic/millesima-ai-engine.git
synced 2026-03-28 18:03:47 +00:00
ajout: modification dependances et ajout documentation
This commit is contained in:
52
.github/workflows/python-app.yml
vendored
52
.github/workflows/python-app.yml
vendored
@@ -5,35 +5,41 @@ name: Python application
|
|||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: [ "main" ]
|
branches: ["main"]
|
||||||
pull_request:
|
pull_request:
|
||||||
branches: [ "main" ]
|
branches: ["main"]
|
||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
contents: read
|
contents: write
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
|
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- name: Set up Python 3.10
|
|
||||||
uses: actions/setup-python@v3
|
- name: Set up Python 3.10
|
||||||
with:
|
uses: actions/setup-python@v4
|
||||||
python-version: "3.10"
|
with:
|
||||||
- name: Install dependencies
|
python-version: "3.10"
|
||||||
run: |
|
|
||||||
python -m pip install --upgrade pip
|
- name: install dependencies
|
||||||
pip install flake8 pytest
|
run: |
|
||||||
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
|
python -m pip install --upgrade pip
|
||||||
- name: Lint with flake8
|
pip install ".[test,doc]"
|
||||||
run: |
|
|
||||||
# stop the build if there are Python syntax errors or undefined names
|
- name: Lint with flake8
|
||||||
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
|
run: |
|
||||||
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
|
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
|
||||||
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
|
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
|
||||||
- name: Test with pytest
|
|
||||||
run: |
|
- name: Test with pytest
|
||||||
pytest
|
run: pytest
|
||||||
|
|
||||||
|
- name: Deploy Doc
|
||||||
|
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
|
||||||
|
run: |
|
||||||
|
git config user.name github-actions
|
||||||
|
git config user.email github-actions@github.com
|
||||||
|
mkdocs gh-deploy --force
|
||||||
|
|||||||
5
docs/index.md
Normal file
5
docs/index.md
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
# Bienvenue sur la doc de Millesima
|
||||||
|
|
||||||
|
Voici la documentation technique de mon scraper.
|
||||||
|
|
||||||
|
::: scraper.Scraper
|
||||||
14
mkdocs.yml
Normal file
14
mkdocs.yml
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
site_name: "Projet Millesima S6"
|
||||||
|
|
||||||
|
theme:
|
||||||
|
name: "material"
|
||||||
|
|
||||||
|
plugins:
|
||||||
|
- search
|
||||||
|
- mkdocstrings
|
||||||
|
|
||||||
|
markdown_extensions:
|
||||||
|
- admonition
|
||||||
|
- pymdownx.details
|
||||||
|
- pymdownx.superfences
|
||||||
|
- pymdownx.tabbed
|
||||||
@@ -1,15 +1,12 @@
|
|||||||
[project]
|
[project]
|
||||||
name = "projet-millesima-s6"
|
name = "projet-millesima-s6"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = ["requests==2.32.5", "beautifulsoup4==4.14.3", "pandas==2.3.3"]
|
||||||
"requests==2.32.5",
|
|
||||||
"beautifulsoup4==4.14.3",
|
|
||||||
"pandas==2.3.3",
|
|
||||||
]
|
|
||||||
|
|
||||||
[project.optional-dependencies]
|
[project.optional-dependencies]
|
||||||
test = ["pytest==8.4.2", "requests-mock==1.12.1"]
|
test = ["pytest==8.4.2", "requests-mock==1.12.1", "flake8==7.3.0"]
|
||||||
|
doc = ["mkdocs<2.0.0", "mkdocs-material==9.6.23", "mkdocstrings[python]"]
|
||||||
|
|
||||||
[build-system]
|
[build-system]
|
||||||
requires = ["setuptools"]
|
requires = ["setuptools", "wheel"]
|
||||||
build-backend = "setuptools.build_meta"
|
build-backend = "setuptools.build_meta"
|
||||||
|
|||||||
@@ -331,7 +331,7 @@ class Scraper:
|
|||||||
except (JSONDecodeError, HTTPError):
|
except (JSONDecodeError, HTTPError):
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def getvins(self, subdir: str, filename: str) -> None:
|
def getvins(self, subdir: str, filename: str, reset: bool) -> None:
|
||||||
"""_summary_
|
"""_summary_
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
@@ -375,7 +375,7 @@ def main() -> None:
|
|||||||
if len(argv) != 2:
|
if len(argv) != 2:
|
||||||
raise ValueError(f"{argv[0]} <sous-url>")
|
raise ValueError(f"{argv[0]} <sous-url>")
|
||||||
scraper: Scraper = Scraper()
|
scraper: Scraper = Scraper()
|
||||||
scraper.getvins(argv[1], "donnee.csv")
|
scraper.getvins(argv[1], "donnee.csv", False)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|||||||
@@ -319,7 +319,7 @@ def test_informations(scraper: Scraper):
|
|||||||
def test_search(scraper: Scraper):
|
def test_search(scraper: Scraper):
|
||||||
m = mock_open()
|
m = mock_open()
|
||||||
with patch("builtins.open", m):
|
with patch("builtins.open", m):
|
||||||
scraper.getvins("wine.html", "fake_file.csv")
|
scraper.getvins("wine.html", "fake_file.csv", False)
|
||||||
|
|
||||||
assert m().write.called
|
assert m().write.called
|
||||||
all_writes = "".join(call.args[0] for call in m().write.call_args_list)
|
all_writes = "".join(call.args[0] for call in m().write.call_args_list)
|
||||||
|
|||||||
Reference in New Issue
Block a user