Skip to content

Commit

Permalink
Merge #2127 to implement Poetry, pytest, and tox
Browse files Browse the repository at this point in the history
Closes #2111 as its feature branch was the base of this PR's branch
Closes #2133 as no longer necessary
Closes #2147 as no longer necessary
  • Loading branch information
ppfeister committed Jun 9, 2024
2 parents ef124ac + 850528f commit 3211b90
Show file tree
Hide file tree
Showing 34 changed files with 478 additions and 758 deletions.
12 changes: 8 additions & 4 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
### REPOSITORY
/.github/CODEOWNERS @sdushantha
./github/FUNDING.yml @sdushantha
/LICENSE @sdushantha

### PACKAGING
# Changes made to these items without code owner approval may negatively
# impact packaging pipelines. Code owners may need time to verify or adapt.
# impact packaging pipelines.
/pyproject.toml @ppfeister @sdushantha
/setup.cfg @ppfeister @sdushantha
/setup.py @ppfeister
/*.spec @ppfeister

### REGRESSION
/.github/workflows/regression.yml @ppfeister
/tox.ini @ppfeister
/pytest.ini @ppfeister
/tests/ @ppfeister
1 change: 1 addition & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
github: [ sdushantha, ppfeister, matheusfelipeog ]
38 changes: 0 additions & 38 deletions .github/workflows/main.yml

This file was deleted.

27 changes: 0 additions & 27 deletions .github/workflows/nightly.yml

This file was deleted.

47 changes: 0 additions & 47 deletions .github/workflows/pull_request.yml

This file was deleted.

40 changes: 40 additions & 0 deletions .github/workflows/regression.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Regression Testing

on:
pull_request:
branches: [ master ]
push:
branches: [ master ]

jobs:
tox-matrix:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false # We want to know what version it fails on
matrix:
os: [
ubuntu-latest,
windows-latest,
macos-latest,
]
python-version: [
'3.8',
'3.9',
'3.10',
'3.11',
'3.12',
]

steps:
- uses: actions/checkout@v4
- name: Set up environment ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install tox and related dependencies
run: |
python -m pip install --upgrade pip
pip install tox
pip install tox-gh-actions
- name: Run tox
run: tox
6 changes: 4 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
# Virtual Environment
# Virtual Environments
venv/
bin/
lib/
pyvenv.cfg
poetry.lock

# Editor Configurations
.vscode/
Expand All @@ -14,8 +15,9 @@ __pycache__/
# Pip
src/

# Pip / PyProject Devel & Installation
# Devel, Build, and Installation
*.egg-info/
dist/**

# Jupyter Notebook
.ipynb_checkpoints
Expand Down
2 changes: 1 addition & 1 deletion docs/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ Sherlock. This invocation hides the progress text that Sherlock normally
outputs, and instead shows the verbose output of the tests.

```console
$ cd sherlock/sherlock
# Assumes current working directory is respository root
$ python3 -m unittest tests.all --verbose
```

Expand Down
21 changes: 16 additions & 5 deletions docs/INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,24 @@ Python
pipx install sherlock-project
```

### Build python package from source (useful for contributors)
### Build live package from source (useful for contributors)

Building an editable (or live) package links the entry point to your current directory, rather than to the standard install location. This is often useful when working with the code base, as changes are reflected immediately without reinstallation.

Note that the version number will be 0.0.0 for pipx local builds unless manually changed in the pyproject file (it will prompt the user for an update).

```bash
# pipx is recommended, but pip may suffice if pipx is unavailable
git clone https://github.com/sherlock-project/sherlock.git
cd sherlock
pipx install .
# Assumes repository cloned, and current working directory is repository root
pipx install -e .
```

### Run package from source (without installing)

If you'd rather not install directly to your system, you can import the module at runtime with `-m`.

```bash
# Assumes repository cloned, and current working directory is repository root
python3 -m sherlock user123 user789
```

<h2>
Expand Down
13 changes: 4 additions & 9 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@
[![PyPI - Version](https://img.shields.io/pypi/v/sherlock-project?logo=PyPi&label=PyPI&color=darkgreen)][ext_pypi] [![Docker Image Version](https://img.shields.io/docker/v/sherlock/sherlock?sort=semver&logo=docker&label=Docker&color=darkgreen)][docs_docker] [![homebrew version](https://img.shields.io/homebrew/v/sherlock?logo=Homebrew&color=darkgreen)][ext_brew]


| Method | Command | Notes |
| | Command | Notes |
| - | - | - |
| pypi | `pipx install sherlock-project` | `pip` may be used in place of `pipx` |
| brew | `brew install sherlock` | Community supported |
| docker | `docker pull sherlock/sherlock` | |
| PyPI | `pipx install sherlock-project` | `pip` may be used in place of `pipx` |
| Homebrew | `brew install sherlock` | Community supported |
| Docker | `docker pull sherlock/sherlock` | |

### Alternative guides and methods

Expand Down Expand Up @@ -133,15 +133,10 @@ Original Creator - [Siddharth Dushantha](https://github.com/sdushantha)

[docs_install]: /docs/INSTALL.md
[docs_docker]: /docs/INSTALL.md#docker
[docs_docker_dockerhub]: /docs/INSTALL.md#docker
[docs_docker_compose]: /docs/INSTALL.md#using-compose
[docs_docker_source]: /docs/INSTALL.md#build-image-from-source-useful-for-contributors
[docs_py]: /docs/INSTALL.md#python
[docs_py_build]: /docs/INSTALL.md#build-python-package-from-source-useful-for-contributors
[docs_contrib]: /docs/CONTRIBUTING.md
[docs_contrib_adding_targets]: /docs/CONTRIBUTING.md#adding-targets
[docs_contrib_removing_targets]: /docs/CONTRIBUTING.md#removing-targets
[docs_contrib_restoring_targets]: /docs/CONTRIBUTING.md#restoring-targets
[ext_pypi]: https://pypi.org/project/sherlock-project/
[ext_brew]: https://formulae.brew.sh/formula/sherlock

26 changes: 11 additions & 15 deletions docs/pyproj/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,12 @@

<p align=center>
<br>
<a href="https://sherlock-project.github.io/" target="_blank"><img src="https://user-images.githubusercontent.com/27065646/53551960-ae4dff80-3b3a-11e9-9075-cef786c69364.png"/></a>
<a href="https://sherlock-project.github.io/" target="_blank"><img src="https://www.kali.org/tools/sherlock/images/sherlock-logo.svg" width="25%"/></a>
<br>
<span>Hunt down social media accounts by username across <a href="https://github.com/sherlock-project/sherlock/blob/master/sites.md">social networks</a></span>
<strong><span>Hunt down social media accounts by username across <a href="https://github.com/sherlock-project/sherlock/blob/master/sites.md">400+ social networks</a></span></strong>
<br><br>
<span>Additional documentation can be found at our <a href="https://github.com/sherlock-project/sherlock/">GitHub repository</a></span>
<br>
<span>Additional documentation can be found on our <a href="https://github.com/sherlock-project/sherlock/">GitHub repository</a></span>
<br>
</p>

<p align="center">
<img width="70%" height="70%" src="https://user-images.githubusercontent.com/27065646/219638267-a5e11090-aa6e-4e77-87f7-0e95f6ad5978.png"/>
</a>
</p>

## Usage
Expand All @@ -36,11 +31,12 @@ To search for more than one user:
```bash
$ sherlock user1 user2 user3
```
<br>

## Star History
___

<picture>
<source media="(prefers-color-scheme: dark)" srcset="https://api.star-history.com/svg?repos=sherlock-project/sherlock&type=Date&theme=dark" />
<source media="(prefers-color-scheme: light)" srcset="https://api.star-history.com/svg?repos=sherlock-project/sherlock&type=Date" />
<img alt="Sherlock Project Star History Chart" src="https://api.star-history.com/svg?repos=sherlock-project/sherlock&type=Date" />
</picture>
<br>
<p align="center">
<img width="70%" height="70%" src="https://user-images.githubusercontent.com/27065646/219638267-a5e11090-aa6e-4e77-87f7-0e95f6ad5978.png"/>
</a>
</p>
63 changes: 37 additions & 26 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,48 +1,59 @@
[build-system]
requires = ["setuptools >= 61.0"]
build-backend = "setuptools.build_meta"
requires = [ "poetry-core>=1.2.0" ]
build-backend = "poetry.core.masonry.api"
# poetry-core 1.8 not available in .fc39. Can upgrade to 1.8.0 at .fc39 EOL

[project.scripts]
sherlock = "sherlock:main"
[tool.poetry-version-plugin]
source = "init"

[project.urls]
Homepage = "http://sherlock-project.github.io/"
Repository = "https://github.com/sherlock-project/sherlock.git"
Issues = "https://github.com/sherlock-project/sherlock/issues"

[project]
[tool.poetry]
name = "sherlock-project"
# single source of truth for version is __init__.py
version = "0"
description = "Hunt down social media accounts by username across social networks"
license = "MIT"
authors = [
{ name = "Siddharth Dushantha" }
"Siddharth Dushantha <[email protected]>"
]
maintainers = [
{ name = "Matheus Felipe" },
{ name = "Sondre Karlsen Dyrnes" },
{ name = "Paul Pfeister" }
"Paul Pfeister <[email protected]>",
"Matheus Felipe <[email protected]>",
"Sondre Karlsen Dyrnes <[email protected]>"
]
description = "Hunt down social media accounts by username across social networks"
readme = "docs/pyproj/README.md"
# Do not set license to file. Causes issues with rpm packaging for some reason.
license = {text = "MIT"}
dynamic = ["dependencies", "version"]
packages = [ { include = "sherlock"} ]
keywords = [ "osint", "reconnaissance", "information gathering" ]
classifiers = [
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"Intended Audience :: Information Technology",
"License :: OSI Approved :: MIT License",
"Natural Language :: English",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3",
"Topic :: Security"
]
homepage = "https://sherlock-project.github.io/"
repository = "https://github.com/sherlock-project/sherlock"


[tool.poetry.urls]
"Bug Tracker" = "https://github.com/sherlock-project/sherlock/issues"

[tool.setuptools.dynamic]
dependencies = { file = [ "requirements.txt" ] }
version = { attr = "sherlock.__version__" }
[tool.poetry.dependencies]
python = "^3.8"
certifi = ">=2019.6.16"
colorama = "^0.4.1"
PySocks = "^1.7.0"
requests = "^2.22.0"
requests-futures = "^1.0.0"
stem = "^1.8.0"
torrequest = "^0.1.0"
# pandas can likely be bumped up to ^2.0.0 after fc39 EOL
pandas = ">=1.0.0,<3.0.0"
openpyxl = "^3.0.10"

[tool.setuptools]
package-dir = {"" = "sherlock"}
[tool.poetry.group.dev.dependencies]
jsonschema = "^4.0.0"

[tool.setuptools.package-data]
"*" = ["*.json"]
[tool.poetry.scripts]
sherlock = 'sherlock.sherlock:main'
Loading

0 comments on commit 3211b90

Please sign in to comment.