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

Feature/packaging #15

Merged
merged 30 commits into from
Aug 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
8bd7bfa
Initial move-around
JeltevanBoheemen Jun 7, 2023
e1aa0a1
from sastadev type imports
JeltevanBoheemen Jun 7, 2023
2e56375
autopep8 on source
JeltevanBoheemen Jun 7, 2023
587c106
Rename sastadev to __main__
JeltevanBoheemen Jun 7, 2023
3b6afd5
Remove xlrd depedency
JeltevanBoheemen Jun 7, 2023
46eb4e0
Resolve circular dependency of CHAT_Annotation
JeltevanBoheemen Jun 7, 2023
eca999d
test files
JeltevanBoheemen Jun 7, 2023
2d9b36c
Move data files
JeltevanBoheemen Jun 8, 2023
806bc90
Move source files to src
JeltevanBoheemen Jun 8, 2023
f0776c8
Updated flake8 config
JeltevanBoheemen Jun 8, 2023
4027fec
Update requirements
JeltevanBoheemen Jun 8, 2023
7b60c15
Update README
JeltevanBoheemen Jun 8, 2023
4947bec
Move txt files
JeltevanBoheemen Jun 8, 2023
1cf33bd
First version of setup.py
JeltevanBoheemen Jun 8, 2023
df7b58c
Fix tests
JeltevanBoheemen Jun 8, 2023
a60a4fb
Lint tests
JeltevanBoheemen Jun 8, 2023
c1275a5
Lint src (nonstrict)
JeltevanBoheemen Jun 8, 2023
6e0f038
Add Auchann to dependencies
JeltevanBoheemen Jun 20, 2023
0c0f25d
Use settings object
JeltevanBoheemen Jun 21, 2023
636b22a
Move dataroot
JeltevanBoheemen Jun 22, 2023
2c41fb9
iSort
JeltevanBoheemen Jun 22, 2023
dd3566e
Fix linting errors
JeltevanBoheemen Jun 22, 2023
e6aff70
Update README for configuration
JeltevanBoheemen Jun 22, 2023
fbaf007
Remove old pypi package
JeltevanBoheemen Jun 22, 2023
95e18a7
Update pypi uplaod instructions
JeltevanBoheemen Jun 22, 2023
a5851d2
Remove hardcoded paths where possible
JeltevanBoheemen Jun 22, 2023
5a54bd8
Set rootlogger in configuration
JeltevanBoheemen Jun 27, 2023
9bdc4c5
Fix the method paths
JeltevanBoheemen Jul 6, 2023
43a7cea
Use alpinoparsing.parse by default
JeltevanBoheemen Jul 6, 2023
eb10147
Non-strict mksilver
JeltevanBoheemen Aug 7, 2023
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
16 changes: 15 additions & 1 deletion .flake8
Original file line number Diff line number Diff line change
@@ -1,2 +1,16 @@
[flake8]
ignore = E501, W503, E704, F841, E265
ignore =
# Line too long
E501
# Multiple statements on one line
E704
# Block comment should start with hash
E265
# Local variable name is assigned to but never used
F841
# Line break occurs before binary operator (deprecated)
W503
exclude =
__pycache__
env
.env
18 changes: 16 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ pip-delete-this-directory.txt
coverage.xml
*.cover
.pytest_cache/
.mypy_cache/

# Environments
.env
Expand All @@ -25,7 +26,7 @@ env.bak/
venv.bak/

# configuration
./config.py
config.py

# additional files
.idea/
Expand All @@ -36,5 +37,18 @@ sastalog.txt
# documentation
Documentation/_build/


# Distribution / packaging
bin/
build/
develop-eggs/
dist/
eggs/
lib/
lib64/
parts/
sdist/
var/
*.egg-info/
.installed.cfg
*.egg

102 changes: 97 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,106 @@

Method definitions for use in SASTA

Copy `default_config.py` to your own `config.py` in the `sastadev` directory, and change what you need.
## Installation
You can install SASTADEV using pip:
```
pip install sastadev
```

## Usage

### Command line interface
The installation provides an entrypoint `sastadev` which invokes `sastadev.__main__.main()`

To lists arguments and options:

```
sastadev -h
```
or
```
python -m sastadev -h
```

### Using as a library
```python
from sastadev.deregularise import correctinflection
result = correctinflection('slaapten')
print(result)
# [('sliepen', 'Overgeneralisation')]
```

## Configuration
The package contains a configuration module `sastadev.conf` that produces a `SastadevConfig` object at runtime, called `settings`.

### Using settings values
Example 1 (**correct**):
```python
from sastadev.conf import settings
def get_dataroot():
print(settings.DATAROOT)
```

Example 2 (**wrong!**):
```python
from sastadev.conf import settings

dataroot = settings.DATAROOT

def get_dataroot():
print(dataroot)
```

The key difference is that the code in example 2 evaluates `settings.DATAROOT` at the moment the code is executed. If `settings.DATAROOT` changes between the first time the module is loaded and the time it is ran, the first value will be used. This disables configurable settings.


### Changing settings
`sastadev.conf.settings` can be changed at runtime.
> :warning: **Changing `settings` properties changes _all_ code that is executed after the change**. Therefore, make sure you set the settings **once**, and at the beginning of the runtime cycle.

## Development
To install the requirements:
```
pip install -r requirements.txt
```

### Installing locally
To install the package in editable state:
```
pip install -e .
```

## Upload to PyPi
### Testing
Tests should be written and run using [pytest](https://docs.pytest.org/).
To test, make sure the package is installed in editable mode.
Then, each time you wish to run the tests:
```
pytest
```

### Linting
Linting configuration is provided for [flake8](https://flake8.pycqa.org/en/latest/).
To lint, run:
```
flake8 ./src/sastadev/
```

### Upload to PyPi

Specify the files which should be included in the package in `pypi/include.txt`.

```bash
cd pypi
./prepare.sh
twine upload dist/*
pip install twine
python setup.py sdist
twine upload dist/*.tar.gz
```

## Contributing
Enhancements, bugfixes, and new features are welcome. For major changes, please follow these steps:

- open an issue to discuss what you would like to change
- create a branch `feature/<your-branchname`>, based on `develop` that contains your changes
- ensure the code is well tested
- create a pull request for merging the changes into `develop`
- the maintainers will take care of reviewing the code, offering suggested changes, and merging the code
- at the discretion of the maintainers, the `develop` branch will be merged into `master`, and a new release will be made
5 changes: 0 additions & 5 deletions __init__.py

This file was deleted.

5 changes: 0 additions & 5 deletions apps.py

This file was deleted.

Empty file removed celexlexicondata/__init__.py
Empty file.
Empty file removed celexlexicondata/dutch/__init__.py
Empty file.
23 changes: 0 additions & 23 deletions dataconfig.py

This file was deleted.

18 changes: 0 additions & 18 deletions default_config.py

This file was deleted.

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
136 changes: 0 additions & 136 deletions generatemacros.py

This file was deleted.

2 changes: 0 additions & 2 deletions mymypy.bat

This file was deleted.

16 changes: 0 additions & 16 deletions mypy.ini

This file was deleted.

3 changes: 0 additions & 3 deletions pypi/.gitignore

This file was deleted.

4 changes: 0 additions & 4 deletions pypi/MANIFEST.in

This file was deleted.

Loading