Skip to content

Commit

Permalink
[skip ci] Split source code into separate repo
Browse files Browse the repository at this point in the history
  • Loading branch information
mackorone committed Nov 30, 2023
1 parent a06b6cb commit 42788c6
Show file tree
Hide file tree
Showing 34 changed files with 22 additions and 3,930 deletions.
5 changes: 0 additions & 5 deletions .envrc

This file was deleted.

3 changes: 0 additions & 3 deletions .flake8

This file was deleted.

19 changes: 16 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,25 +11,38 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Checkout mackorone/spotify-playlist-archive-src
uses: actions/checkout@v4
with:
repository: mackorone/spotify-playlist-archive-src
path: spotify-playlist-archive-src
submodules: recursive

- name: Checkout mackorone/spotify-playlist-archive
uses: actions/checkout@v4
with:
repository: mackorone/spotify-playlist-archive
path: spotify-playlist-archive
# Also fetch the second-to-last commit so the script can determine,
# via git commands, which files changed in the most recent commit
fetch-depth: 2

- name: Set up Python
uses: actions/setup-python@v3
uses: actions/setup-python@v4
with:
python-version: "3.10"

- name: Install dependencies
working-directory: spotify-playlist-archive-src
run: |
python -m pip install --upgrade pip
pip install -r requirements/requirements.txt
- name: Run script
working-directory: spotify-playlist-archive
env:
SPOTIFY_CLIENT_ID: ${{ secrets.SPOTIFY_CLIENT_ID }}
SPOTIFY_CLIENT_SECRET: ${{ secrets.SPOTIFY_CLIENT_SECRET }}
run: python src/main.py --commit-and-push --auto-register
run: >
python $GITHUB_WORKSPACE/spotify-playlist-archive-src/src/main.py
--playlists-dir playlists --commit-and-push --auto-register
113 changes: 0 additions & 113 deletions .gitignore

This file was deleted.

3 changes: 0 additions & 3 deletions .gitmodules

This file was deleted.

3 changes: 0 additions & 3 deletions .isort.cfg

This file was deleted.

5 changes: 0 additions & 5 deletions .pyre_configuration

This file was deleted.

1 change: 0 additions & 1 deletion .watchmanconfig

This file was deleted.

77 changes: 3 additions & 74 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,78 +12,7 @@ Alternatively, follow these steps:

If you don't know what a playlist ID is, you can use [this tool](https://spotifyplaylistarchive.com/get-playlist-id) to extract it from the playlist's URL.

## Development
## Source Code

### Setup

This project uses [`pip-tools`](https://github.com/jazzband/pip-tools) to manage
dependencies.

To get started, first create and activate a new virtual environment:
```
$ python3.8 -m venv venv
$ source venv/bin/activate
```

Then upgrade `pip` and install `pip-tools`:
```
$ pip install --upgrade pip
$ pip install pip-tools
```

Lastly, use `pip-sync` to install the dev requirements:
```
$ pip-sync requirements/requirements-dev.txt
```

### Formatting

This project uses [`isort`](https://github.com/pycqa/isort) and
[`black`](https://github.com/psf/black) to automatically format the source code.
You should invoke both of them, in that order, before submitting pull requests:
```
$ isort src/
$ black src/
```

### Linting

This project uses [`flake8`](https://github.com/pycqa/flake8) for linting, a
basic form of static analysis. You can use `flake8` to check for errors and bad
code style:
```
$ flake8 src/
```

### Type Checking

This project uses [`pyre`](https://github.com/facebook/pyre-check) to check for
type errors. You can invoke it from anywhere in the repository as follows:
```
$ pyre
```

Note that Pyre depends on [`watchman`](https://github.com/facebook/watchman), a
file watching service, for incremental type checking. It takes a few minutes to
install, but it's worth the investment - it makes type checking almost
instantaneous.

### Unit Testing

After making changes, you should update unit tests and run them as follows:
```
$ cd src
$ python -m unittest tests/\*.py
```

### Integration Testing

Copy the `playlists` directory to `_playlists`:
```
$ cp -r playlists _playlists
```

Then run the script:
```
$ src/main.py
```
The source code for this project lives here:
[mackorone/spotify-playlist-archive-src](https://github.com/mackorone/spotify-playlist-archive-src)
8 changes: 3 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,10 @@ To recreate an old version of a playlist:

## How it works

This repository contains a script for scraping Spotify playlists and publishing
them back to the repo. The script is run daily via
This repository uses a
[script](https://github.com/mackorone/spotify-playlist-archive-src)
to scrape Spotify playlists and publish them back to the repo. The script is run daily via
[GitHub Actions](https://github.com/mackorone/spotify-playlist-archive/actions/workflows/main.yml).
It's also run after every commit, which means that playlists get regenerated
whenever the scraping or formatting logic changes, or when new playlists are
added.

The script determines which playlists to scrape by looking at the file names in
`playlists/registry`. Files get regenerated as follows: a pretty version of each
Expand Down
33 changes: 0 additions & 33 deletions TODO.md

This file was deleted.

6 changes: 0 additions & 6 deletions requirements/requirements-dev.in

This file was deleted.

Loading

0 comments on commit 42788c6

Please sign in to comment.