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

Reimplementation of ccdmodel according to the linkml model template #75

Merged
merged 113 commits into from
Sep 9, 2021
Merged
Show file tree
Hide file tree
Changes from 85 commits
Commits
Show all changes
113 commits
Select commit Hold shift + click to select a range
2584ce0
experimentation files
turbomam Jul 28, 2021
8783a62
token notes
turbomam Jul 28, 2021
78ce4dd
Update mam-experimentation.md
turbomam Jul 28, 2021
3d46f4e
copied from turbomam/ccdhmodel-from-template
turbomam Aug 5, 2021
d6e2696
refreshed ccdhmodel_from_template artifacts
turbomam Aug 5, 2021
189e4d4
forced creation of local working dir
turbomam Aug 5, 2021
2034d8e
isolate docs from template setup
turbomam Aug 5, 2021
97f57c3
for from template isolation
turbomam Aug 5, 2021
dd7e2f9
unoverwrite README.md
turbomam Aug 5, 2021
daeee9c
Delete CONFIG.yaml.mask
turbomam Aug 5, 2021
fdbbaa3
Delete Diagnosis_full.json.mask
turbomam Aug 5, 2021
631a41c
target dir = ccdhmodel not ccdhmodel_from_template
turbomam Aug 6, 2021
4e77110
Merge branch 'issue-69-pypi' of https://github.com/cancerDHC/ccdhmode…
turbomam Aug 6, 2021
be1662d
csv generation in Makefile
turbomam Aug 6, 2021
8a1eaf3
save legacy scripts to attic
turbomam Aug 6, 2021
7dbcaea
Update setup.py
turbomam Aug 6, 2021
598d88c
Update setup.cfg
turbomam Aug 6, 2021
c4c0a2d
Update mkdocs.yml
turbomam Aug 6, 2021
2ef9657
Update MAINTAINERS.md
turbomam Aug 6, 2021
4bde832
Update MAINTAINERS.md
turbomam Aug 6, 2021
4670739
Update MAINTAINERS.md
turbomam Aug 6, 2021
d0026c6
Update AUTHORS
turbomam Aug 6, 2021
dc883f7
commited everything pre pypi publish
turbomam Aug 6, 2021
64e272d
Update CONFIG.yaml
turbomam Aug 6, 2021
208a1ea
Update test_input_against_model.py
turbomam Aug 6, 2021
e9d81cf
Merge branch 'issue-69-pypi' of https://github.com/cancerDHC/ccdhmode…
turbomam Aug 6, 2021
3f061ef
more recipes from legacy Makefile
turbomam Aug 6, 2021
aee4688
Update Makefile
turbomam Aug 6, 2021
2ad8686
edited makefile via web
turbomam Aug 6, 2021
069a620
Merge branch 'issue-69-pypi' of https://github.com/cancerDHC/ccdhmode…
turbomam Aug 6, 2021
e0c35e3
pre pypi publish?
turbomam Aug 6, 2021
f044dbb
post twine push
turbomam Aug 6, 2021
a23cfff
removed old static docs from template
turbomam Aug 6, 2021
5ec6c20
Updated AUTHORS.
gaurav Aug 10, 2021
7b1ccb0
Deleted deprecated model generation script.
gaurav Aug 10, 2021
91c13d6
clarify that documentation branch is useful with mike
turbomam Aug 11, 2021
5e9f9ec
add a comment about what content is generated into local/
turbomam Aug 11, 2021
17eb1de
crdch rather than ccdhmodel in setup.py
turbomam Aug 11, 2021
b0019be
steal some classifiers from biolink-model
turbomam Aug 11, 2021
293637f
MIT license for license and classifiers
turbomam Aug 11, 2021
8629fd3
https://github.com/cancerDHC/linkml.git
turbomam Aug 11, 2021
eaa45b7
CRDC-H Model in LinkML documentation
turbomam Aug 11, 2021
c9388bc
ran make after some crdch_model renaming
turbomam Aug 11, 2021
599255f
Topic prefix for ...
turbomam Aug 11, 2021
41e31b2
add *. AUTHORS etc. do not look liek they changed?
turbomam Aug 11, 2021
bfabfd2
ccdhmodel -> crdch_model in setup.cfg
turbomam Aug 11, 2021
d1faaf6
url and home_page in setup.cfg
turbomam Aug 11, 2021
bd0e6ff
edited imports in tests/test_input_against_model.py
turbomam Aug 11, 2021
e6be38b
now testing a minimal Diagnosis
turbomam Aug 11, 2021
acbdf0f
now testing a minimal Diagnosis
turbomam Aug 11, 2021
08f0a3d
Merge branch 'issue-69-pypi' of https://github.com/cancerDHC/ccdhmode…
turbomam Aug 11, 2021
e63b406
added twine to main section of main Pipfile
turbomam Aug 11, 2021
f4a34b8
trying to get twine on path/in env
turbomam Aug 11, 2021
4526e69
post twine push
turbomam Aug 11, 2021
6ae651f
fixed file links in README.md
turbomam Aug 11, 2021
429357f
deleted requirements*.txt
turbomam Aug 11, 2021
2e752db
new and modified artifacts?
turbomam Aug 11, 2021
0376967
Create README.md
turbomam Aug 11, 2021
7b42ce4
developing new squeaky clean in Makefile
turbomam Aug 11, 2021
00a4562
Merge branch 'issue-69-pypi' of https://github.com/cancerDHC/ccdhmode…
turbomam Aug 11, 2021
0b61fc6
better squeaky clean learning experience
turbomam Aug 11, 2021
1f74632
routine regen
turbomam Aug 11, 2021
ea512fe
post twine push
turbomam Aug 11, 2021
b17dc10
moved MakeConfig into from_template
turbomam Aug 12, 2021
019c2ba
routine regen
turbomam Aug 12, 2021
590c9af
post twine push
turbomam Aug 12, 2021
c472226
updating MAINTAINERS.md and CHANGELOG.md
turbomam Aug 12, 2021
94985f9
removed from_template/ABOUT.md
turbomam Aug 12, 2021
3a4ad77
Ready for testing...
turbomam Aug 12, 2021
469312c
prep for another pypi publish
turbomam Aug 12, 2021
768a6f4
Created initial distro
turbomam Aug 12, 2021
04f55f0
edits to MAINTAINERS.md, prep for PyPI push
turbomam Aug 12, 2021
25a60ca
experiemnting with pypi authentication
turbomam Aug 12, 2021
86c6baf
new ChangeLog contaminated git project
turbomam Aug 12, 2021
ff4b269
twine notes in MAINTAINERS.md
turbomam Aug 12, 2021
be78e38
removed PYPI_SETUP.md and images/ from from_template/
turbomam Aug 12, 2021
ab82a9b
walking thorugh mke pypi
turbomam Aug 12, 2021
ae23610
ccdh -> crdc-h in genergenerators/google-sheets
turbomam Aug 12, 2021
9920f83
post google-sheetsccdh -> crdc-h make
turbomam Aug 12, 2021
c664157
ccdh -> crdc-h manual publish
turbomam Aug 12, 2021
59eef41
harmonizing regen-google-sheets
turbomam Aug 12, 2021
97d507b
regen google sheet in cleanroom checkout
turbomam Aug 13, 2021
d1c557a
post twine push
turbomam Aug 19, 2021
8ec71a5
preparting to make pypi with no ChangeLog
turbomam Aug 19, 2021
3094ed5
Merge branch 'issue-69-pypi' of https://github.com/cancerDHC/ccdhmode…
turbomam Aug 19, 2021
3c1c1b3
added crdch_model; stuck building 0.0.0
turbomam Aug 23, 2021
e5660be
re-enabling pbr due to stuck 0.0.0 build
turbomam Aug 23, 2021
224bab9
make squeaky clean; make; make test; commit
turbomam Aug 23, 2021
1e8b9bb
untracked Changelog != clean repo
turbomam Aug 23, 2021
a379fcc
removing duplicate MAM from AUTHORS
turbomam Aug 26, 2021
c88fbce
remove pbr from setup.py
turbomam Aug 26, 2021
4f28735
removed pbr's ChangeLog
turbomam Aug 26, 2021
982e8db
Removed duplicated authors.
gaurav Sep 6, 2021
cfa40f1
Replaced AUTHORS with AUTHORS.md. Closes #92.
gaurav Sep 6, 2021
9304da0
Rearranged CHANGELOG as per previous format.
gaurav Sep 6, 2021
0360d8d
Cleaned up CHANGELOG.
gaurav Sep 6, 2021
f37736e
Cleaned up MAINTAINERS.
gaurav Sep 7, 2021
66d8a69
Restored Makefile `clean` to previous instructions.
gaurav Sep 7, 2021
ad6873c
Fixed `regen-google-sheets` target in Makefile.
gaurav Sep 7, 2021
5d5a43b
Added linkml-runtime to google-sheets Pipfile.
gaurav Sep 7, 2021
8b574ea
Changes to sheet2linkml needed by LinkML changes.
gaurav Sep 7, 2021
f33b374
Removed virtual-env/venv from Makefile.
gaurav Sep 7, 2021
45beb69
Added a note about Pipenv to the repository.
gaurav Sep 7, 2021
6f04cf5
Deleted autogen ChangeLogs from
gaurav Sep 7, 2021
00c8d7c
Removed references to make-venv from MAINTAINERS.md.
gaurav Sep 7, 2021
afa4fdd
Removed make-venv directory, no longer used.
gaurav Sep 7, 2021
98247de
Clarified README for LinkML schemas dir.
gaurav Sep 7, 2021
470a33d
Add a note to update version before publishing to PyPI.
gaurav Sep 7, 2021
5897625
Fixed typo.
gaurav Sep 7, 2021
640ec14
Added a note to keep model/CONFIG.yaml and setup.cfg in sync manually.
gaurav Sep 7, 2021
9d88cf3
Fixed link.
gaurav Sep 7, 2021
b730536
Fixed incorrect link.
gaurav Sep 7, 2021
eb5aea2
Updated Makefile to add a `test-tox` target.
gaurav Sep 7, 2021
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
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# MAM 20210805
# this directory is for organizing local scratch files along with this project
# could also be called something like temp
local
turbomam marked this conversation as resolved.
Show resolved Hide resolved

# Outputs from various generators.
/generators/google-sheets/output/*.yaml
/docs
Expand Down
11 changes: 11 additions & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
Dazhi Jiao <djiao@jhu.edu>
Gaurav Vaidya <gaurav@ggvaidya.com>
Gaurav Vaidya <gaurav@renci.org>
Harold Solbrig <solbrig@jhu.edu>
Jim Balhoff <balhoff@gmail.com>
Mark A. Miller <MAM@lbl.gov>
Mark Andrew Miller <MAM@lbl.gov>
Matthew Brush <mhb120@gmail.com>
Monica Munoz-Torres <monicacecilia@users.noreply.github.com>
hsolbrig <solbrig@jhu.edu>
jiaola <djiao@jhu.edu>
20 changes: 20 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,26 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

_In August 2021, This repo was updated based on the [linkml model template](https://github.com/linkml/linkml-model-template)_

Some linkml model template files, like `MakeConfig` hav been moved into `from_template`. Note that `MakeConfig` makes extensive changes to numerous files including the model, tests, docs and PyPI metadata. These updates are based on `model/CONFIG.yaml`. Updating with `MakeConfig` could be very convenient but a strategy combining `MakeConfig` with manual updates to these files could lose important work. It's probably best to commit before running `MakeConfig`.

Most recently, several steps were taken to keep the `squeaky-clean` Makefile recipe for erroring out.
- `PKG_T_JSON_SCHEMA` was set to `json_schema` instead of `jsonschema`.
- `docs` is being cleaned with `rm -rf docs/*`. That will delete any `README.*` or `.keep` file placed in there.

There is some conflict in terms of the Python version require specifications.

- `setup.cfg` says `python_requires = >=3.7`
- `setup.py` says `if sys.version_info < (3, 7, 0):`
- The reporting of warning string was modified due to a error when trying to run `setup.py` under 2.7
- `tox.ini` says `envlist = py37, py38, py39`
- `./Pipfile says` inherited `python_version = "3.8"` from pre-template code

TODO:
- Aggregate Markdown/documentation files like `from_template/ABOUT.md` and `from_template/ABOUT.md` into `MAINTAINERS.md`
- A verbose `./ChangeLog` is being created in `make pypi`, Disable that or move the output somewhere less conspicuous.

## [v1.0.1] - 2021-06-08

* Model changes
Expand Down
182 changes: 167 additions & 15 deletions MAINTAINERS.md
Original file line number Diff line number Diff line change
@@ -1,29 +1,181 @@
# How to make a release
# Regenerating the CRDC-H model

See the instructions at the top of [Makefile](Makefile)
_In August 2021, This repo was updated based on the [linkml model template](https://github.com/linkml/linkml-model-template)_

First install the linkml python package and mkdocs:
## Requirements
* __Python >= 3.7.1__
* __GNU make__ - Windows users can use [cygwin](https://www.cygwin.com/). `make` comes built into MacOS and most Linuxes.
* __pip__ - bundled with most python distros
* __virtualenv__ - can be added via `pip install virtualenv`
* __pipenv__ - can be added via `pip install pipenv`

See also the linkml model template's [original ABOUT.md](https://github.com/cancerDHC/ccdhmodel/blob/5ec6c203edd871a72c87aea03a894bbb3c798c79/from_template/ABOUT.md) file.

## The following is a reasonable start from a fresh repo

- `make regen-google-sheets`
- Requires some environment setup. Partially documented in `generators/google-sheets/README.md`
- Recreates `model/schema/crdch_model.yaml` from the ["CDM_Dictionary_v1 (Active)" Google Sheet](https://docs.google.com/spreadsheets/d/1oWS7cao-fgz2MKWtyr8h2dEL9unX__0bJrWKv6mQmM4/edit#gid=1262189248) using `generators/google-sheets/sheet2linkml.py`
- `make`
- Installs `make-venv` environment if necessary
- Builds artifacts in `crdch_model` based on `model/schema/crdch_model.yaml`
- Also builds documentation in `docs` based on `model/schema/crdch_model.yaml` and `model/docs`
- Run this every time the model is modified, whether manually or via `make regen-google-sheets`
- `make test`
- Minimal test input data in `tests/input/test_diagnosis.json`
- Test script in `tests/test_input_against_model.py`
- Like many other parts of this repo, would be regenerated by making the `from_template/MakeConfig`, which takes its configuration from `from_template/MakeConfig`
- git add, commit, push if desired

## Initial PyPI setup

### Prerequisites
- A PyPi username and password (or PyPI OAUTH2 token)
- `make` and `make test` run to completion
- `mkdir dist` if necessary
- `pipenv install --dev` if necessary
- `pip install wheel` if necessary
- `pip install twine` if necessary

Pushes to PyPI can be authenticated with a password or a token. The `twine` application will ask for a username and password when it is first run.

Optionally create an OAUTH2 token from the PyPi site
- log in to pypi
- select the Manage button for your project
- select _Settings_
- select _Create a token for crdch_model_
- give the token a label and set the scope to `crdch_model`
- copy the token to the clipboard and save it somewhere safe
-Note that this is the only time you will see this token. Once you leave this web page, the token cannot be retrieved.

In order to run `make pypi` in the future, a `~/.pypirc` file with one of the following formats should be created. See https://packaging.python.org/specifications/pypirc/

```
[pypi]
username = <SECRET>
password = <SECRET>
```
or
```
[pypi]
username = __token__
password = <OAUTH2 token>
```

In some cases, the PyPI username and password may be stored in a keyring. That can be disabled with `keyring --disable`. See https://twine.readthedocs.io/en/latest/

### Process

1) Commit all changes
```bash
. environment.sh
pip install -r requirements.txt
> git commit -am "Ready for testing..."
> git status
On branch main
Your branch is up to date with 'origin/main'.

nothing to commit, working tree clean
>
```

Then every time you change the source schema, run:
2) Make an interactive push to PyPI

- Check the previous tag at https://pypi.org/project/crdch-model/#history
- `git tag` and _https://github.com/cancerDHC/ccdhmodel/releases show tagged releases from the `main` branch (or explicity pushed tags?). `git describe` shows the latest local/dev version._
- Set the next tag to something incremental with a command like `git tag v0.0.1`

```bash
make all
> rm -f dist/*
> pipenv shell
> python setup.py sdist bdist_wheel
...
adding 'crdch_model-0.2.2.data/data/model/docs/home.md'
adding 'crdch_model-0.2.2.data/data/model/schema/README.md'
adding 'crdch_model-0.2.2.data/data/model/schema/crdch_model.yaml'
adding 'crdch_model-0.2.2.dist-info/AUTHORS'
adding 'crdch_model-0.2.2.dist-info/METADATA'
adding 'crdch_model-0.2.2.dist-info/WHEEL'
adding 'crdch_model-0.2.2.dist-info/pbr.json'
adding 'crdch_model-0.2.2.dist-info/top_level.txt'
adding 'crdch_model-0.2.2.dist-info/RECORD'
removing build/bdist.macosx-10.14.6-x86_64/wheel
> ls dist
crdch_model-0.2.2-py3-none-any.whl crdch_model-0.2.2.tar.gz
>
```

This will generate files in:
_If the tags above show up with a `dev` suffix on them, something has changed since the tag. If this occurs, you can go ahead and find what got missed in the commit, fix and commit it and grab the next tag (v0.2.3 in this example) and redo the setup._

3) Upload the commit to pypi

```bash
> twine upload dist/*
Uploading distributions to https://upload.pypi.org/legacy/
Enter your username: <pypi user name>
Uploading crdch_model-0.2.2-py3-none-any.whl
100%|██████████████████████████████████████| 659k/659k [00:02<00:00, 275kB/s]
Uploading crdch_model-0.2.2.tar.gz
100%|██████████████████████████████████████| 1.54M/1.54M [00:04<00:00, 372kB/s]

View at:
https://pypi.org/project/crdch-model/0.2.2/
```
4) Push the tag info to github
```bash
> git commit -am "Created initial distro"
> git push --tags
```

**After this initial setup**, `make pypi` should be sufficient, as long as the project is clean and a new tag has been asserted.
- _This is currently going into @turbomam's PyPI account_

### Cleanup options

- `make clean`
- Just cleans up `target`, which doesn't get synced anyway
- `rm -rf target/*`

- `make squeaky-clean` (includes `make clean`)
- uninstalls the `make-venv` environment
- `pipenv --rm` does the same thing. It can be run in the root of the project **and** in `make-venv`
- Removes artifacts in the synced output directory `crdch_model`

## Optionally using `tox`

- Install globally with `pip3 install tox`
- will be dependent on the globally available python versions
- **Or** `pipenv install --dev` if necessary and `pipenv run tox4`
- _Would tox purists object to running it inside a virtual environment?!_
- Runs tests the same way that they are run by `make test` **but under multiple versions of Python**
- `pipenv run python -m unittest`
- Can also be configured to build and publish? Those aren't really unmet needs here.

## Regarding virtual environments

The environments for using and building this package are primarily managed with pipenv now. There are multiple virtual environments. The Makefile recipes install and enter into the environments as necessary. Manually installing the environment shouldn’t be necessary for the steps above, but couldn’t hurt.

### All of the following come from the linkml-model-template:
- `./make-venv/Pipfile` is used by most of the `Makefile` recipes
- There is also a smaller `./Pipfile`, including a `dev` section, which can be used for running Python code in `crdch_model`
- `from_template/MakeConfig` uses `virtualenv` to install `template-configurator`
- `make test` seems to install a virtual environment... from `./Pipfile`, with teh `--dev` flag?
- `tox` (which is currently optionally) creates its own virtual environments with pipenv. (Using which `Pipfile`?)

`regen-google-sheets` (which precedes linkml-model-template) has its own environment

virtualenv style requirements files can be generated as follows:

```
pipenv lock --dev --requirements
pipenv lock --dev --requirements > requirements-dev.txt
```

## Regarding documentation

The previous doc genration/publishing approach and the approach supported by the linkml-model-template have not been completely aligned yet.

* [docs]
* [jsonschema]
* [shex]
* [owl]
* [rdf]
The template does require git adding and pushing the `./docs` folder (or making commits within GH actions), but that was previously discouraged.

Do **not** git add the files in docs
MAM: I'm not 100% sure about using mike to make the docs, although mike is specified as a plugin in the mkdocs setup file. I’m not sure where github tagging tagging fits into this. A gh-pages branch may not be _necessary_ for publishing the docs to https://cancerdhc.github.io/ccdhmodel, but it may be preferable since we're using mike.

## Using mike to maintain multiple versions

Expand All @@ -39,7 +191,7 @@ created and populated correctly, you can run:

```
$ make clean # This will delete the `docs/` directory.
$ make gen-docs # This will generate the docs in `target/docs`.
$ make gen-docs # This will generate the docs in `target/docs`.
$ make stage-docs # This will copy `target/docs` into `docs/`.
```

Expand Down
Loading