Skip to content

Commit

Permalink
Remove members.json (#619)
Browse files Browse the repository at this point in the history
### Summary

With the removal of qiskit.org, we no longer need to support
`members.json`.

This PR removes that file, and all the code related to generating it.
  • Loading branch information
frankharkins authored Dec 1, 2023
1 parent 3508232 commit 2a8fb44
Show file tree
Hide file tree
Showing 11 changed files with 12 additions and 10,110 deletions.
49 changes: 0 additions & 49 deletions .github/workflows/ecosystem-recompile.yml

This file was deleted.

15 changes: 4 additions & 11 deletions docs/project_overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,24 +109,17 @@ https://github.com/mickahell/qiskit-ecosystem_template.
We store each member of the ecosystem as a TOML file under
[`ecosystem/resources/members`](https://github.com/qiskit-community/ecosystem/blob/main/ecosystem/resources/members);
these are the files you should edit when adding / updating members to the
ecosystem. Access to this file is handled through the
ecosystem. Access to these files is handled programmatically through the
[`DAO`](https://github.com/qiskit-community/ecosystem/blob/main/ecosystem/daos/dao.py)
class.

The qiskit.org page pulls information from the compiled
[`members.json`](https://github.com/qiskit-community/ecosystem/blob/main/ecosystem/resources/members.json))
file. This file should be compiled automatically by an action on pushing to
`main`, but you can also compile it locally (e.g. for testing) using
To generate the webpage from the TOML files, run:

```sh
python -m manager members recompile
tox -e website
```

You shouldn't edit `members.json` manually.

If you somehow get a merge conflict in `members.json`, don't try to manually
resolve the conflict. Instead, merge the branch, then run `python -m manager members
recompile` and add the file to resolve the conflict.
Then open `website/index.html` in your browser.

### Tests

Expand Down
6 changes: 1 addition & 5 deletions ecosystem/cli/members.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class CliMembers:
Each public method of this class is CLI command
and arguments for method are options/flags for this command.
Ex: `python manager.py members recompile --body="<SOME_MARKDOWN>"`
Ex: `python manager.py members update_badges`
"""

def __init__(self, root_path: Optional[str] = None):
Expand All @@ -28,10 +28,6 @@ def __init__(self, root_path: Optional[str] = None):
self.dao = DAO(path=self.resources_dir)
self.logger = logger

def recompile(self):
"""Recompile `members.json` from human-readable files."""
self.dao.compile_json()

def add_repo_2db(
self,
repo_name: str,
Expand Down
2 changes: 1 addition & 1 deletion ecosystem/cli/website.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def __init__(self, root_path: Optional[str] = None):
self.dao = DAO(path=self.resources_dir)

def build_website(self):
"""Generates the ecosystem web page reading `members.json`."""
"""Generates the ecosystem web page reading the TOML files."""
environment = Environment(loader=FileSystemLoader("ecosystem/html_templates/"))
projects = self.dao.storage.read()
projects_sorted = sorted(
Expand Down
24 changes: 0 additions & 24 deletions ecosystem/daos/dao.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
File structure:
root_path
├── members.json # compiled file; don't edit manually
└── members
   └── repo-name.toml
"""
Expand Down Expand Up @@ -88,7 +87,6 @@ def __init__(self, path: str):
"""
self.storage = TomlStorage(path)
self.labels_json_path = Path(path, "labels.json")
self.compiled_json_path = Path(path, "members.json")

def write(self, repo: Repository):
"""
Expand Down Expand Up @@ -160,28 +158,6 @@ def update_labels(self, labels: list[str]):
sorted(new_label_list, key=lambda x: x["name"]), labels_file, indent=4
)

def compile_json(self):
"""
Dump database to JSON file for consumption by qiskit.org
Needs this structure:
{ tier: { # e.g. Main, Community
index: repo # `repo` is data from repo-name.toml
}}
"""
data = self.storage.read()

out = {}
for repo in data.values():
if repo.tier not in out:
out[repo.tier] = {}
index = str(len(out[repo.tier]))
out[repo.tier][index] = repo.to_dict()

with open(self.compiled_json_path, "w") as file:
json.dump(out, file, indent=4)

def add_repo_test_result(self, repo_url: str, test_result: TestResult) -> None:
"""
Adds test result to repository.
Expand Down
10 changes: 4 additions & 6 deletions ecosystem/resources/README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
Ecosystem database
==================
Ecosystem data files
====================

This folder contains the actual ecosystem data, including the data that appears
on [qiskit.org/ecosystem](https://qiskit.org/ecosystem).
This folder contains the actual ecosystem data.

If you want to edit or remove something, go to the [`members`](./members)
folder and edit or delete the TOML file for that repo. On pushing to `main`, a
GitHub action should recompile the JSON files that
[qiskit.org/ecosystem](https://qiskit.org/ecosystem) reads from.
GitHub action should recompile and publish the website.
Loading

0 comments on commit 2a8fb44

Please sign in to comment.