Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Development #23

Draft
wants to merge 9 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 56 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,3 +92,59 @@ Plotting the dataset gives insides into the Open Source Ecosystems from differen
![organizations](./docs/organizations.png)

![organizations_forms](./docs/organizations_forms.png)

## An extended Poetry's command-line interface by developing plugins as an alternative to Jupyter Notebooks

##### Usage:

From an integrated terminal, the plugin needs to depend on Poetry to interface with it, so we can run the following commands:

```
poetry install
```

If it's needed, we can use poetry or pip to install the command-line interface:

```
poetry add open-sustain-tech
```

or,

```
pip install open-sustain-tech
```

To run the plugin, we can use the following command:

```
oss-opt
```
or, commonly to poetry and python:

```
poetry run python -m open_sustain_tech
```

or,

```
poetry run oss-opt
```

As described in the `protontypes/AwesomeCure` under the `README.md` file, and under the `Architecture` section in reference to the `Data Acquisition`, the `oss-opt` command-line interface lets read the Awesome list from any repository as well.

**Note:** Depending on the size of the list, the processing can take multiple hours.

This is an update to the open_sustain_tech command-line interface, and here are the main changes to consider regarding this update:

- The OpenSustainTech class is a subclass of the Command class from the cleo library. It has a handle method that is used to handle the command when the user executes it. The factory function is a simple function that creates and returns an instance of the OpenSustainTech class. This function is used as a "factory" for creating OpenSustainTech instances.

- The Options class is a data class (thanks to the @dataclass decorator) that contains options for the command-line parser. It uses the simple_parsing library to define the options and their default values.

- An ArgumentParser object is created and configured to use the options defined in the Options class. The command-line arguments are then parsed and stored in the args variable.

- The OSSOptionPlugin class is a subclass of ApplicationPlugin from the poetry library. It has an activate method that is used to register the open_sustain_tech command with the application. It also has a commands property that returns a list of available commands, in this case, an instance of OpenSustainTech.

## Many thanks to:
Tobias Augspurger
1,720 changes: 1 addition & 1,719 deletions csv/projects.csv

Large diffs are not rendered by default.

4,685 changes: 4,685 additions & 0 deletions poetry.lock

Large diffs are not rendered by default.

143 changes: 143 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
[tool.poetry]
name = "open-sustain-tech"
version = "1.3.0"
description = "Awesome List Curated with a Poetry Plugin Support to the Open Sustain Tech CLI Option"
authors = ["Abderrahim Guennoune <[email protected]>"]
license = "MIT"
homepage = "https://opensustain.tech/"
repository = "https://github.com/aguennoune/AwesomeCure/tree/main"
keywords = ["awesome-list", "poetry", "plugin", "python", "version", "sustainability", "technology", "open", "source", "software"]
readme = "README.md"
packages = [{include = "open_sustain_tech", from = "src"}]
classifiers = [
"Development Status :: 4 - Beta",
"License :: OSI Approved :: MIT License",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
]

[tool.poetry.scripts]
oss-opt = "open_sustain_tech.main:app"

[tool.poetry.dependencies]
python = ">=3.8, <3.9 || >=3.9, <3.12"
poetry = "^1.7.0"
numpy = ">=1.24"
plotly = "^5.18.0"
pandas = ">=1.3.0,<2.0.0"
dateparser = "^1.1.8"
pycountry = "^22.3.5"
pygithub = "^2.1.1"
requests = "^2.31.0"
bs4 = "^0.0.1"
termcolor = "^2.3.0"
markdown = "^3.5"
python-dotenv = "^1.0.0"
pyyaml = "^6.0.1"
handcalcs = "^1.6.5"
typer = "^0.9.0"
click = "^8.1.7"
kaleido = "0.2.1"
pycaret = "^3.0.0"
cleo = "^2.1.0"
importlib-metadata = "^6.8.0"
rich = "^13.6.0"
poetry-core = "^1.8.1"
typer-common-functions = "^0.0.7"
simple-parsing = "^0.1.4"

[tool.poetry.extras]
plugin = ["poetry"]

[tool.poetry.group.dev.dependencies]
pre-commit = ">=2.6"
pytest = ">=7.1.2"
mypy = ">=1.1.1"

[tool.ruff]
fix = true
line-length = 100
extend-select = ["W605", "N"]

[tool.ruff.flake8-tidy-imports]
ban-relative-imports = "all"

[tool.ruff.isort]
force-single-line = true
lines-between-types = 1
lines-after-imports = 2
known-first-party = ["poetry_plugin_bundle"]
required-imports = ["from __future__ import annotations"]

[tool.poetry.urls]
"Bug Tracker" = "https://github.com/protontypes/AwesomeCure/issues"

[tool.poetry.plugins."poetry.application.plugin"]
open-sustain-tech = "open_sustain_tech.plugin:OSSOptionPlugin"

[tool.poetry-plugin-export]
enabled = true

[tool.open-sustain-tech]
enable = true

[tool.poetry-plugin-bundle]
enabled = true

[tool.poetry-dynamic-versioning]
enabled = true


[[tool.poetry.source]]
name = "url"
url = "https://github.com/protontypes/open-sustainable-technology"
priority = "primary"


[[tool.poetry.source]]
name = "PyPI"
priority = "primary"

[tool.black]
target-version = ["py38", "py39", "py310"]
preview = true
line-length = 100

[tool.mypy]
enable_error_code = [
"ignore-without-code",
"redundant-expr",
"truthy-bool"
]
explicit_package_bases = true
files = [
"src/open_sustain_tech",
"tests",
]
pypy_path = "src/open_sustain_tech"
namespace_packages = true
show_error_codes = true
strict = true

[[tool.mypy.overrides]]
module = [
'poetry.*',
'cleo.*',
'lark.*',
'virtualenv.*',
'poetry_plugin_export',
'poetry_dynamic_versioning',
'poetry_plugin_bundle',
'open_sustain_tech'
]
ignore_missing_imports = true

[tool.pytest.ini_options]
testpaths = [
"tests"
]

[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"
158 changes: 158 additions & 0 deletions src/open_sustain_tech/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,158 @@
.*
!.gitignore

### JupyterNotebooks ###
# gitignore template for Jupyter Notebooks
# website: http://jupyter.org/

.ipynb_checkpoints
*/.ipynb_checkpoints/*

# IPython
profile_default/
ipython_config.py

# Remove previous ipynb_checkpoints
# git rm -r .ipynb_checkpoints/

# End of https://www.toptal.com/developers/gitignore/api/jupyternotebooks
### Python ###
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
.pybuilder/
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
.python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# PEP 582; used by e.g. github.com/David-OConnor/pyflow
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

# pytype static type analyzer
.pytype/

# Cython debug symbols
cython_debug/

Loading