Skip to content

Commit

Permalink
build: switch to poetry
Browse files Browse the repository at this point in the history
  • Loading branch information
andylolz committed May 15, 2024
1 parent ed1f743 commit 357a526
Show file tree
Hide file tree
Showing 8 changed files with 832 additions and 30 deletions.
17 changes: 10 additions & 7 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,26 +19,29 @@ jobs:
- name: Checkout
uses: actions/checkout@v4

- name: Install Poetry
uses: snok/install-poetry@v1

- name: Set up python
uses: actions/setup-python@v5
with:
python-version: '3.10'
cache: pip
python-version-file: pyproject.toml
cache: poetry

- name: Install dependencies
run: pip install -r requirements_dev.txt
run: poetry install

- name: Run flake8
run: flake8 x_notes
run: poetry run flake8 x_notes

- name: Run black
run: black x_notes --check
run: poetry run black x_notes --check

- name: Run isort
run: isort x_notes -c --profile black
run: poetry run isort x_notes -c --profile black

- name: Run tests
run: pytest tests
run: poetry run pytest tests

deploy:
name: Deploy
Expand Down
11 changes: 7 additions & 4 deletions .github/workflows/fetch_notes.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,17 @@ jobs:
- name: Checkout
uses: actions/checkout@v4

- name: Install Poetry
uses: snok/install-poetry@v1

- name: Set up python
uses: actions/setup-python@v5
with:
python-version: '3.10'
cache: pip
python-version-file: pyproject.toml
cache: poetry

- name: Install dependencies
run: pip install -r requirements.txt
run: poetry install --only main

- name: Checkout previous version
uses: actions/checkout@v4
Expand All @@ -38,7 +41,7 @@ jobs:
run: cp -r previous/* output

- name: Fetch notes
run: python -m x_notes
run: poetry run python -m x_notes

- name: Deploy 🚀
uses: JamesIves/github-pages-deploy-action@v4
Expand Down
11 changes: 7 additions & 4 deletions .github/workflows/fetch_tweets.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,17 @@ jobs:
- name: Checkout
uses: actions/checkout@v4

- name: Install Poetry
uses: snok/install-poetry@v1

- name: Set up python
uses: actions/setup-python@v5
with:
python-version: '3.10'
cache: pip
python-version-file: pyproject.toml
cache: poetry

- name: Install dependencies
run: pip install -r requirements.txt
run: poetry install --only main

- name: Checkout previous version
uses: actions/checkout@v4
Expand All @@ -38,7 +41,7 @@ jobs:
run: cp -r previous/* output

- name: Fetch tweets
run: python -m x_notes.fetch_tweets
run: poetry run python -m x_notes.fetch_tweets
env:
TW_USER: ${{ secrets.USER }}
TW_PASS: ${{ secrets.PASS }}
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Initial setup:

```shell
# Install python dependencies
pip install -r requirements_dev.txt
poetry install

# Install ruby dependencies (Jekyll)
bundle install
Expand All @@ -37,10 +37,10 @@ Then to run:

```shell
# Fetch notes
python -m x_notes
poetry run python -m x_notes

# Optional: fetch tweets
python -m x_notes.fetch_tweets
poetry run python -m x_notes.fetch_tweets

# Start the development server
cd output
Expand Down
779 changes: 779 additions & 0 deletions poetry.lock

Large diffs are not rendered by default.

26 changes: 26 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
[tool.poetry]
name = "x-community-notes"
version = "0.0.0"
description = ""
authors = ["Your Name <[email protected]>"]
readme = "README.md"

[tool.poetry.dependencies]
python = "^3.10"
loguru = "^0.7.2"
pynacl = "^1.5.0"
requests = "^2.31.0"
twscrape = "^0.12"


[tool.poetry.group.dev.dependencies]
black = "^24.4.2"
flake8 = "^7.0.0"
isort = "^5.13.2"
mypy = "^1.10.0"
pytest = "^8.2.0"
python-dotenv = "^1.0.1"

[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"
4 changes: 0 additions & 4 deletions requirements.txt

This file was deleted.

8 changes: 0 additions & 8 deletions requirements_dev.txt

This file was deleted.

0 comments on commit 357a526

Please sign in to comment.