-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* chore: project environment * ci: initial setup * test: placeholder test to allow CI * ci: temporarily suspend until first code push
- Loading branch information
1 parent
f539642
commit c7b4e16
Showing
7 changed files
with
168 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
name: Continuous integration | ||
|
||
on: | ||
pull_request: | ||
push: | ||
branches: | ||
- main | ||
- "dev*" | ||
|
||
jobs: | ||
test: | ||
permissions: | ||
contents: read | ||
id-token: write | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
os: [ubuntu-latest, windows-latest] | ||
python-version: ["3.10", 3.11, 3.12] | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
cache: "pip" | ||
|
||
- name: Update pip and install the package | ||
run: | | ||
python -m pip install --upgrade pip | ||
python -m pip install ".[test]" | ||
- name: Run tests | ||
run: | | ||
python -m pytest tests | ||
- name: Install and run linters | ||
if: | | ||
matrix.python-version == 3.11 | ||
run: | | ||
python -m pip install ".[dev]" | ||
python -m ruff check . | ||
python -m ruff format --check . | ||
# - name: Generate Report | ||
# run: | | ||
# coverage run -m pytest | ||
# coverage xml | ||
|
||
# - name: Upload Coverage to Codecov | ||
# uses: codecov/codecov-action@v3 | ||
# with: | ||
# file: ./coverage.xml | ||
# flags: unittests | ||
# verbose: true | ||
# token: ${{secrets.CODECOV_TOKEN}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,7 +12,25 @@ | |
This is the open-source code repository for the internal ParliAI project, allowing other developers to replicate non-sensitive features of the project and to encourage future collaboration and development in this space. Please do contact us at [[email protected]]([email protected]) to discuss this or any of our other projects. | ||
|
||
## Installation | ||
Details to follow... | ||
|
||
You are strongly recommended to install resources into a virtual environment. Project setup can be achieved as follows: | ||
|
||
``` bash | ||
$ git clone https://github.com/datasciencecampus/parliai-public.git | ||
$ cd parliai-public | ||
$ python -m venv venv | ||
$ source venv/bin/activate | ||
$ python -m pip install --upgrade pip | ||
$ python -m pip install . | ||
``` | ||
|
||
> \[!NOTE\] If you intend on doing any development work, please install the package as editable (`-e`) and with the `dev` optional dependencies: | ||
> | ||
> ``` bash | ||
> $ python -m pip install -e ".[dev]" | ||
> ``` | ||
> | ||
> Moreover, once you have installed the package, please install the pre-commit hooks. These hooks help us to ensure repository security and a consistent code style. | ||
### Pre-commit actions | ||
This repository contains a configuration of pre-commit hooks. These are language agnostic and focussed on repository security (such as detection of passwords and API keys). If approaching this project as a developer, you are encouraged to install and enable `pre-commits` by running the following in your shell: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
[project] | ||
name = "parliai_public" | ||
description = "Using LLMs to capture coverage of organisations, people or themes in UK political debate." | ||
authors = [ | ||
{ name = "Data Science Campus", email = "[email protected]" } | ||
] | ||
readme = "README.md" | ||
license = { file = "LICENSE" } | ||
requires-python = ">=3.10" | ||
dynamic = ["version"] | ||
dependencies = [ | ||
"bs4>=0.0.1", | ||
"email-validator>=2.1.0.post1", | ||
"feedparser>=6.0.11", | ||
"google-cloud-secret-manager>=2.19.0", | ||
"langchain-community>=0.0.13", | ||
"langchain-google-vertexai>=0.0.1", | ||
"langchain>=0.1.0", | ||
"notifications-python-client>=9.0.0", | ||
"python-dotenv>=1.0.1", | ||
"toml>=0.10.2", | ||
"tqdm>=4.66.1", | ||
] | ||
|
||
[build-system] | ||
requires = ["setuptools>=69"] | ||
build-backend = "setuptools.build_meta" | ||
|
||
[tool.setuptools.packages.find] | ||
where = ["src"] | ||
|
||
[tool.setuptools.dynamic] | ||
version = { attr = "parliai_public.__version__" } | ||
|
||
[tool.setuptools.package-data] | ||
parliai_public = ["_config/*.toml"] | ||
|
||
[project.optional-dependencies] | ||
test = [ | ||
"hypothesis>=6.98.6", | ||
"pytest>=8.0.0", | ||
"pytest-cov>=4.1.0", | ||
"pytest-randomly>=3.15.0", | ||
"python-dateutil>=2.9.0", | ||
] | ||
dev = [ | ||
"pre-commit==3.3.3", | ||
"ruff==0.3.0", | ||
"parliai_public[test]" | ||
] | ||
|
||
# `coverage` configurations | ||
[tool.coverage.run] | ||
source = [ | ||
"./src" | ||
] | ||
omit = ["**/__init__.py"] | ||
|
||
[tool.coverage.report] | ||
exclude_lines = [ | ||
"if __name__ == .__main__.:" | ||
] | ||
|
||
[tool.ruff] | ||
line-length = 79 | ||
|
||
[tool.ruff.lint] | ||
extend-select = ["D", "I", "W"] | ||
ignore = ["D105", "D107", "D202"] | ||
|
||
[tool.ruff.lint.isort] | ||
known-first-party = ["parliai_public"] | ||
|
||
[tool.ruff.lint.pydocstyle] | ||
convention = "numpy" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
"""Using LLMs to capture coverage of organisations, people or themes in UK political debate.""" | ||
|
||
__version__ = "0.0.1" | ||
|
||
__all__ = [ | ||
"__version__", | ||
] |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
"""Unit tests for the entire package.""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
"""Example test to facilitate CI operation.""" | ||
|
||
|
||
def test_temp(): | ||
"""Test message.""" | ||
msg = "I am a test" | ||
assert msg == "I am a test" |