Skip to content

Commit be0a1e4

Browse files
authored
Migrate to poetry instead of conda (#55)
1 parent 841c7d1 commit be0a1e4

File tree

6 files changed

+649
-30
lines changed

6 files changed

+649
-30
lines changed

.github/workflows/scrapy-checks.yml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,14 @@ jobs:
2121

2222
steps:
2323
- uses: actions/checkout@v2
24-
- uses: conda-incubator/setup-miniconda@v2
24+
- name: Install Poetry
25+
uses: snok/install-poetry@v1
2526
with:
26-
environment-file: environment.yml
27-
activate-environment: transfermarkt-scraper
27+
virtualenvs-create: true
28+
virtualenvs-in-project: true
29+
installer-parallel: true
30+
- name: Install library
31+
run: poetry install --no-interaction
2832
- name: Check scrapy contracts
2933
run: |
30-
scrapy check -s USER_AGENT='transfermarkt scrapy contracts'
34+
poetry run scrapy check -s USER_AGENT='transfermarkt scrapy contracts'

Dockerfile

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
1-
FROM continuumio/miniconda3
1+
FROM python:3.8
22

33
WORKDIR /app
44

5-
# The code to run when container is started:
6-
COPY tfmkt tfmkt
7-
COPY scrapy.cfg .
5+
RUN apt-get update && \
6+
apt-get -y install gcc python3-dev
87

9-
# Create the environment:
10-
COPY environment.yml .
11-
RUN conda env create -f environment.yml
8+
COPY pyproject.toml /app
129

13-
ENV PATH /opt/conda/envs/transfermarkt-scraper/bin:$PATH
14-
RUN /bin/bash -c "source activate transfermarkt-scraper"
10+
ENV PYTHONPATH=${PYTHONPATH}:${PWD}
11+
12+
RUN pip3 install poetry
13+
RUN poetry config virtualenvs.create false
14+
RUN poetry install --no-dev
15+
16+
RUN /bin/bash -c "poetry shell"

README.md

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,22 +18,20 @@ Each one of these entities can be discovered and refreshed separately by invokin
1818
## Installation
1919

2020
This is a [scrapy](https://scrapy.org/) project, so it needs to be run with the
21-
`scrapy` command line util. A conda `environment.yml` file is provided with a definition
22-
for the necessary environment to run the scraper.
21+
`scrapy` command line util. This and all other required dependencies can be installed using [poetry](https://python-poetry.org/docs/).
2322

2423
```console
25-
# create and activate conda environment
26-
conda env create -f environment.yml
27-
conda activate transfermarkt-scraper
24+
cd transfermarkt-datasets
25+
poetry install
26+
poetry shell
2827
```
29-
> :information_source: On Apple silicon chips fallback to rosetta to avoid well-known [pyopenssl issues](https://github.com/pyca/pyopenssl/issues/873) by creating your conda environment as `CONDA_SUBDIR=osx-64 conda env create -f environment.yml`
28+
29+
## Usage
3030

3131
> :warning: This project will not run without a user agent string being set. This can be done one of two ways:
3232
> - add `ROBOTSTXT_USER_AGENT = <your user agent>` to your tfmkt/settings.py file, or
3333
> - specify the user agent token in the command line request (for example, `scrapy crawl players -s USER_AGENT=<your user agent> `)
3434
35-
## Usage
36-
3735
These are some usage examples for how the scraper may be run.
3836

3937
```console

environment.yml

Lines changed: 0 additions & 9 deletions
This file was deleted.

0 commit comments

Comments
 (0)