Skip to content

Commit

Permalink
Merge pull request #29 from mickdekkers/feat/docker-image
Browse files Browse the repository at this point in the history
Add Dockerfile for usage with Docker
  • Loading branch information
andriyor authored Aug 2, 2024
2 parents 8e5e27f + 517a596 commit 992fa4d
Show file tree
Hide file tree
Showing 3 changed files with 71 additions and 20 deletions.
31 changes: 31 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
FROM python:3.10-alpine

WORKDIR /app

# Install build dependencies (gcc, etc.)
RUN apk update \
&& apk --no-cache --update add build-base libffi-dev openssl-dev

# Set poetry version to use
ARG POETRY_VERSION=1.4.0
# Prevent Python from generating .pyc files
ENV PYTHONDONTWRITEBYTECODE 1
# Turn off stdout/stderr buffering to make output appear in real time
ENV PYTHONUNBUFFERED 1
# Set pip env vars for faster/leaner docker builds
ENV PIP_DEFAULT_TIMEOUT=100 \
PIP_DISABLE_PIP_VERSION_CHECK=1 \
PIP_NO_CACHE_DIR=1

RUN pip install "poetry==$POETRY_VERSION"

# Install dependencies first to leverage Docker layer caching
ADD poetry.lock pyproject.toml ./

RUN poetry config virtualenvs.create false \
&& poetry install --no-interaction --no-ansi

# After dependencies are installed, copy the rest of the code
ADD . .

ENTRYPOINT ["python", "main.py"]
56 changes: 36 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,43 +13,59 @@ CLI tool for sorting dependents repo by stars

## Installation

from PyPI
### From PyPI

```
```sh
$ pip install ghtopdep
```

from git repository
### From git repository

```
```sh
$ pip install git+https://github.com/github-tooling/ghtopdep.git#egg=ghtopdep
```

from source
### From source

```
```sh
$ git clone https://github.com/github-tooling/ghtopdep
$ cd ghtopdep
$ python setup.py install
```

## Python development Installation
### Using docker (from source)

Ubuntu/Debian
First `docker build` the image once:

```sh
$ git clone https://github.com/github-tooling/ghtopdep
$ cd ghtopdep
$ docker build . -t ghtopdep
```
sudo apt install python3-dev

Then you can `docker run` it:

```sh
$ docker run --rm -it ghtopdep --help
```

CentOS/RHEL
## Python development Installation

### Ubuntu/Debian

```sh
sudo apt install python3-dev
```

### CentOS/RHEL

```sh
sudo yum install python3-devel
```

## Version upgrade

```
```sh
➜ pip install --upgrade ghtopdep
```

Expand All @@ -66,7 +82,7 @@ export GHTOPDEP_TOKEN="**\*\*\*\***\*\***\*\*\*\***\*\*\*\***\*\*\*\***\*\***\*\

or pass token as option --token

```
```sh
➜ ghtopdep --help
Usage: ghtopdep [OPTIONS] URL

Expand All @@ -84,9 +100,9 @@ Options:
--help Show this message and exit.
```

Table view (by default)
### Table view (by default)

```
```sh
➜ ghtopdep https://github.com/dropbox/dropbox-sdk-js
| url | stars |
|---------------------------------------------------|---------|
Expand All @@ -105,16 +121,16 @@ found 443 repositories with more than zero star
~ via ⬢ v12.5.0 via 🐘 v7.2.19 via 🐍 3.8.0 took 2m 57s
```

JSON view
### JSON view

```
```sh
➜ ghtopdep https://github.com/dropbox/dropbox-sdk-js --json
[{"url": "https://github.com/transloadit/uppy", "stars": 21191}, {"url": "https://github.com/codesandbox/codesandbox-client", "stars": 8386}, {"url": "https://github.com/joemccann/dillinger", "stars": 6491}, {"url": "https://github.com/keplergl/kepler.gl", "stars": 5615}, {"url": "https://github.com/jitsi/jitsi-meet", "stars": 4303}, {"url": "https://github.com/jsbin/jsbin", "stars": 3947}, {"url": "https://github.com/NorthwoodsSoftware/GoJS", "stars": 3692}, {"url": "https://github.com/buttercup/buttercup-desktop", "stars": 3054}, {"url": "https://github.com/openstyles/stylus", "stars": 2219}, {"url": "https://github.com/mickael-kerjean/filestash", "stars": 1869}]
```

you can sort packages and fetch their description

```
```sh
➜ ghtopdep https://github.com/dropbox/dropbox-sdk-js --description --packages
| url | stars | description |
|------------------------------------------------|---------|--------------------------------------------------------------|
Expand All @@ -134,7 +150,7 @@ found 61 packages with more than zero star

also ghtopdep support code searching at dependents (repositories/packages)

```
```sh
➜ ghtopdep https://github.com/rob-balfre/svelte-select --search=isMulti --minstar=0
https://github.com/andriyor/linkorg-frontend/blob/7eed49c332f127c8541281b85def80e54c882920/src/App.svelte with 0 stars
https://github.com/andriyor/linkorg-frontend/blob/7eed49c332f127c8541281b85def80e54c882920/src/providers/Post.svelte with 0 stars
Expand All @@ -149,7 +165,7 @@ https://github.com/wolbodo/members/blob/d091f1e44b4e8cb8cc31f39ea6f6e9c36211d019

Using [Poetry](https://poetry.eustace.io/docs/)

```
```sh
$ poetry install
$ poetry run ghtopdep https://github.com/dropbox/dropbox-sdk-js
$ dephell deps convert --from=pyproject.toml --to=setup.py
Expand All @@ -161,7 +177,7 @@ $ poetry publish

or [Pipenv](https://docs.pipenv.org/)

```
```sh
$ pipenv install --dev -e .
```

Expand Down
4 changes: 4 additions & 0 deletions main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
from ghtopdep.ghtopdep import cli

if __name__ == "__main__":
cli(prog_name="ghtopdep")

0 comments on commit 992fa4d

Please sign in to comment.