Skip to content

Commit

Permalink
v0.0.0 (#1)
Browse files Browse the repository at this point in the history
First release on PyPI.
  • Loading branch information
sztal authored Oct 1, 2023
1 parent 4cb0309 commit 081b1a9
Show file tree
Hide file tree
Showing 225 changed files with 8,453 additions and 3,610 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# Binaries data
**/*.segram
**/*.pkl

# Sandbox
_sandbox/

Expand Down
32 changes: 32 additions & 0 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# .readthedocs.yaml
# Read the Docs configuration file
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details

# Required
version: 2

# Set the OS, Python version and other tools you might need
build:
os: ubuntu-22.04
tools:
python: "3.11"
# You can also specify other tool versions:
# nodejs: "19"
# rust: "1.64"
# golang: "1.19"

# Build documentation in the "docs/" directory with Sphinx
sphinx:
configuration: docs/conf.py

# Optionally build your docs in additional formats such as PDF and ePub
# formats:
# - pdf
# - epub

# Optional but recommended, declare the Python requirements required
# to build your documentation
# See https://docs.readthedocs.io/en/stable/guides/reproducible-builds.html
python:
install:
- requirements: requirements/docs.txt
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Changelog

0.0.0 (2023-10-01)
++++++++++++++++++

## `v0.0.0` (2023-10-01)

* First release on PyPI.
146 changes: 146 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
# Contributing

Contributions are welcome, and they are greatly appreciated! Every little
bit helps, and credit will always be given. If you want to contribute to
this project, please make sure to read the contribution guidelines below.

## Types of contributions

## Report Bugs

Report bugs at https://github.com/sztal/segram/issues.

If you are reporting a bug, please include:

* Your operating system name and version.
* Any details about your local setup that might be helpful in troubleshooting.
* Detailed steps to reproduce the bug.

## Write Documentation

`Segram` could always use more documentation, whether as part of the
official `Segram` docs, in docstrings, or even on the web in blog posts,
articles, and such.

### Submit Feedback

The best way to send feedback is to file an issue at https://github.com/sztal/segram/issues.

If you are proposing a feature:

* Explain in detail how it would work.
* Keep the scope as narrow as possible, to make it easier to implement.

## Pull Request Guidelines

1. [Fork](https://github.com/sztal/segram/fork) the `segram`
repo on GitHub.

2. Clone your fork locally:

```bash
git clone [email protected]:your_name_here/segram.git
```

3. Create a branch for local development:

```bash
git checkout -b name-of-your-bugfix-or-feature
```

Now you can make your changes locally.

4. When you're done making changes, check that your changes pass style
and unit tests.

5. Commit your changes and push your branch to GitHub::

```bash
git add .
git commit -m "Your detailed description of your changes."
git push origin name-of-your-bugfix-or-feature
```

6. Submit a pull request through the GitHub website.

### Setting up testing and development environment

Contributing new features or bug fixes requires setting up a proper
development environment. Below is an instruction for how to do that.

The [Github repository](https://github.com/sztal/segram)
provides [conda](https://docs.conda.io/en/latest/) environment files
for setting up development/testing environment. This installs also
testing dependencies such as [pytest](https://docs.pytest.org/en),
which is used for running unit tests.

```bash
git clone [email protected]:sztal/segram.git
cd segram
conda env create -f environment.yml # default env name is 'segram'
conda activate segram
python -m spacy download en_core_web_trf
python -m spacy download en_core_web_lg
pip install --editable .
# OR to allow for GPU acceleration:
pip install --editable .["gpu"]
```

#### Setting up environment with coref

```bash
git clone [email protected]:sztal/segram.git
cd segram
conda env create -f environment-coref.yml # default env name is 'segram'
# In this case the versions of all language models are fixed
# so they are installed automatically with the rest of the dependencies
conda activate segram
pip install --editable .
# OR to allow for GPU acceleration:
pip install --editable .["gpu"]
```

#### Testing

Currently, `segram` is only moderately tested with a unit coverage rate
of about 70%. This will be improved in the future releases.

```
pytest # run unit tests
coverage run # run unit tests and gather coverage statistics
coverage report # show coverage report
```

#### Makefile

`Makefile` defines several commands useful during development
(see the content of the file). However, Windows users may need
to modify it a bit to make it work.

Below is the list of commands most useful for development:

* `make clean`
* Remove all build artifacts and cache files. Good to run this after
changing `pyproject.toml` or other packaging configuration.
* `make gzip-jsons` and `make gunzip-jsons`
* compress and decompress `.json` resource files contained distributed
with the package source code (they store patterns used to customize
lemmatizers etc. and data for building cases used in unit tests).
* `make list-deps`
* Runs a regular expression over all `segram` source files and lists
explicit dependencies (`import` statements) used in the code.


#### Building documentation

First, install extra dependencies:

```bash
pip install requirements/docs.txt
```

And then run a dedicated make command:

```bash
make docs
```
109 changes: 0 additions & 109 deletions CONTRIBUTING.rst

This file was deleted.

9 changes: 0 additions & 9 deletions HISTORY.rst

This file was deleted.

4 changes: 1 addition & 3 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
The MIT License (MIT)

Copyright (c) 2021 Szymon Talaga
Copyright (c) 2023 Szymon Talaga

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
Expand Down
2 changes: 1 addition & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ include AUTHORS.rst
include CONTRIBUTING.rst
include HISTORY.rst
include LICENSE
include README.rst
include README.md
include segram/nlp/**/*.json
include segram/nlp/**/*.json.gz
27 changes: 18 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -46,26 +46,35 @@ lint:
py.test --pylint -m pylint

test:
python setup.py test
python -m pytest

test-all:
tox

coverage:
coverage run --source segram setup.py test
coverage report -m
cov-run:
coverage run
cov-report:
coverage report
coverage html
xdg-open htmlcov/index.html
# open htmlcov/index.html

coverage: cov-run cov-report

docs:
rm -f docs/segram.rst
rm -f docs/modules.rst
sphinx-apidoc -o docs/ segram
rm -rf docs/_build/
rm -rf docs/api/
mkdir -p docs/_static
sphinx-apidoc --module-first --separate -o docs/api/ segram
sed -i 's/:undoc-members:/:no-undoc-members:/g' docs/api/*.rst
$(MAKE) -C docs clean
$(MAKE) -C docs html
xdg-open docs/_build/html/index.html
# open docs/_build/html/index.html
xdg-open docs/_build/html/index.html || open docs/_build/html/index.html

build: gzip-jsons clean
git diff-index --quiet HEAD -- || echo "\n\033[1;31mThere are untracked/uncommited files!!!\033[0m\n" && exit 1
python -m build
twine check dist/*

release: clean
python setup.py sdist upload
Expand Down
Loading

0 comments on commit 081b1a9

Please sign in to comment.