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

Reorganize source directory #279

Merged
merged 12 commits into from
Nov 1, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
5 changes: 2 additions & 3 deletions .flatpak/io.github.thinkle.Gourmet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,10 @@ modules:
build-args:
- --share=network
build-commands:
- python3 -m pip install --upgrade pip
- python3 -m pip install --upgrade pip setuptools wheel
- pip3 install pyenchant pygobject Sphinx
- pip3 install -r requirements.txt
- python3 setup.py build_i18n
- python3 setup.py install --prefix=/app
- pip3 install --prefix=/app .[epub-export,mycookbook,pdf-export,spellcheck,web-import]
- install -Dm644 .flatpak/io.github.thinkle.Gourmet.desktop -t /app/share/applications/
- install -Dm644 .flatpak/io.github.thinkle.Gourmet.svg -t /app/share/icons/hicolor/scalable/apps/
sources:
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ on:
branches: [ master ]
pull_request:
branches: [ master ]
workflow_dispatch:

jobs:
build:
Expand All @@ -22,13 +23,12 @@ jobs:
sudo apt-get update -q && sudo apt-get install
--no-install-recommends -y xvfb python3-dev python3-gi
python3-gi-cairo gir1.2-gtk-3.0 libgirepository1.0-dev libcairo2-dev
intltool enchant python3-enchant python3-gst-1.0
intltool enchant python3-enchant gir1.2-poppler-0.18 python3-gst-1.0

- name: Install dependencies
run: |
python3 -m pip install --upgrade pip
python3 -m pip install --upgrade pip setuptools
pip3 install --upgrade keyrings.alt
if [ -f requirements.txt ]; then pip3 install -r requirements.txt; fi

- name: Create Internationalization
run: |
Expand All @@ -37,7 +37,7 @@ jobs:

- name: Install
run: |
pip3 install .
pip3 install .[epub-export,mycookbook,pdf-export,spellcheck,web-import]

- name: Create wheel and source distributions
run: |
Expand Down
21 changes: 10 additions & 11 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ on:
branches: [master]
pull_request:
branches: [master]
workflow_dispatch:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

okay


jobs:
test:
Expand All @@ -23,24 +24,22 @@ jobs:
run: >
sudo apt-get update -q && sudo apt-get install
--no-install-recommends -y xvfb python3-dev python3-gi
python3-gi-cairo gir1.2-gtk-3.0 libgirepository1.0-dev
gir1.2-poppler-0.18 libcairo2-dev enchant python3-enchant intltool
python3-gst-1.0
python3-gi-cairo gir1.2-gtk-3.0 libgirepository1.0-dev libcairo2-dev
gnarlyquack marked this conversation as resolved.
Show resolved Hide resolved
intltool enchant python3-enchant gir1.2-poppler-0.18 python3-gst-1.0

- name: Install dependencies
run: |
sudo python3 -m pip install --upgrade pip
if [ -f development.txt ]; then sudo pip3 install -r development.txt; fi
sudo python3 -m pip install --upgrade pip setuptools wheel
sudo pip3 install --upgrade keyrings.alt
if [ -f requirements.txt ]; then sudo pip3 install -r requirements.txt; fi

- name: Prepare plugins
run: |
python3 setup.py build_i18n
pip install .
- name: Create Internationalization
gnarlyquack marked this conversation as resolved.
Show resolved Hide resolved
run: python3 setup.py build_i18n

- name: Install
run: sudo pip3 install -r development.in

- name: Test with pytest
run: xvfb-run -a pytest -vv gourmet/tests/test_*
run: xvfb-run -a pytest -vv tests/test_*

# - name: Test with mypy
# run: mypy gourmet/
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,13 @@ gourmet.pot
gourmet.appdata.xml
gourmet.desktop
po/.intltool-merge-cache
/development.txt
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's with this file? I understand that it was removed for development.in

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As noted in the commit message, if I use something like pip-tools to pin dependencies, development.txt will end up with a non-portable list of dependencies. Something like (note the absolute path on the first line):

#
# This file is autogenerated by pip-compile
# To update, run:
#
#    pip-compile development.in
#
-e file:///home/gnarlyquack/Code/gourmet/code/kirienko  # via -r development.in
argcomplete==1.12.1       # via gourmet
attrs==20.2.0             # via pytest
beautifulsoup4==4.9.3     # via gourmet, mf2py
certifi==2020.6.20        # via requests
cffi==1.14.3              # via cryptography
chardet==3.0.4            # via requests
cryptography==3.2.1       # via secretstorage
decorator==4.4.2          # via validators
dogtail==0.9.10           # via -r development.in
ebooklib==0.17.1          # via gourmet
extruct==0.10.0           # via scrape-schema-recipe
flake8==3.8.4             # via -r development.in
html-text==0.5.2          # via extruct
html5lib==1.1             # via mf2py
idna==2.10                # via requests
importlib-resources==3.3.0  # via scrape-schema-recipe
iniconfig==1.1.1          # via pytest
isodate==0.6.0            # via rdflib, scrape-schema-recipe
jeepney==0.4.3            # via keyring, secretstorage
jstyleson==0.0.2          # via extruct
keyring==21.4.0           # via gourmet
lxml==4.6.1               # via ebooklib, extruct, gourmet, html-text
mccabe==0.6.1             # via flake8
mf2py==1.1.2              # via extruct
mypy-extensions==0.4.3    # via mypy
mypy==0.790               # via -r development.in
packaging==20.4           # via pytest
pillow==8.0.1             # via gourmet, reportlab
pluggy==0.13.1            # via pytest
py==1.9.0                 # via pytest
pycairo==1.20.0           # via pygobject
pycodestyle==2.6.0        # via flake8
pycparser==2.20           # via cffi
pyenchant==3.1.1          # via gourmet, pygtkspellcheck
pyflakes==2.2.0           # via flake8
pygobject==3.38.0         # via gourmet
pygtkspellcheck==4.0.5    # via gourmet
pyparsing==2.4.7          # via packaging, rdflib
pytest==6.1.2             # via -r development.in
rdflib-jsonld==0.5.0      # via extruct
rdflib==4.2.2             # via extruct, rdflib-jsonld
reportlab==3.5.55         # via gourmet
requests==2.24.0          # via gourmet, mf2py, scrape-schema-recipe
scrape-schema-recipe==0.1.3  # via gourmet
secretstorage==3.1.2      # via keyring
selenium==3.141.0         # via gourmet
six==1.15.0               # via cryptography, ebooklib, extruct, html5lib, isodate, packaging, validators, w3lib
soupsieve==2.0.1          # via beautifulsoup4
sqlalchemy==1.3.20        # via gourmet
toml==0.10.2              # via gourmet, pytest
typed-ast==1.4.1          # via mypy
typing-extensions==3.7.4.3  # via mypy
urllib3==1.25.11          # via requests, selenium
validators==0.18.1        # via scrape-schema-recipe
w3lib==1.22.0             # via extruct
webencodings==0.5.1       # via html5lib

As a consequence, I want to ensure this file doesn't end up in the repository.

Although I would very much like to include pinned dependencies in the repository (at least for development), this has been an open issue for years, and there isn't a solution that doesn't make the installation process on our end more complicated (this is also relevant).

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the explanations



# Virtual environments
/env/


# Editors
*.swp
.idea/
121 changes: 82 additions & 39 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,54 +1,97 @@
# Getting Started
Install Gourmet's dependencies:

pip3 install -r requirements.txt
pip3 install -r development.txt

`requirements.txt` contains the dependencies needed for Gourmet itself,
`development.txt` contains the packages required for testing.

Before you start development, you should first build localized *.mo and
*.gourmet-plugin files within a build/ subdirectory of the source tree by
running

python3 setup.py build_i18n

You can then install Gourmet in edit mode so:
# Contributing

pip3 install --user -e .
Thank you for taking an interest in contributing to Gourmet! We appreciate that
you're thinking about offering your time to improving the project, and it's our
goal to respect your contribution accordingly.

By doing so, you will be able to test your changes when launching Gourmet.
Although this document focuses on code contributions, you can contribute in
several ways:
- File a bug report.
- Add or improve documentation.
- Promote the project to others.

# Style
New code follows the [PEP 8](http://www.python.org/dev/peps/pep-0008/) standard.

The following conventions are not strictly followed in Gourmet, old code
should be reformatted only when modifying it.
## Contributing Code

# Getting the Source
Gourmet's source code is hosted on [GitHub](https://github.com/thinkle/gourmet).
You can clone it by opening a command prompt and typing:
In general, the process for contributing code is:

git clone https://github.com/thinkle/gourmet.git
1. Pick or open an [issue](https://github.com/thinkle/gourmet/issues) to work
on
2. Post a comment expressing your intent to make sure nobody else is already
working on it
3. Set up a development environment, as described below
4. Hack the code, and when ready
5. Push your changes to your forked repo and create a pull request.

If you don't have any previous experience with Git, you might want to take a
look at the [official Git tutorial](http://www.kernel.org/pub/software/scm/git/docs/gittutorial.html),
or the [GitHub Help pages](http://help.github.com/).
Make sure to also check out our upcoming [milestones](https://github.com/thinkle/gourmet/milestones).

# Contributing
## Development
If you'd like to contribute,

1. [fork](https://github.com/thinkle/gourmet/fork) and clone the repository
2. pick an [issue](https://github.com/thinkle/gourmet/issues) to work on
3. post a little comment expressing your intent to make sure nobody else is
already working on it
4. hack the code, and when ready
5. push to your forked repo, and create a pull request.
## Setting Up a Development Environment

You'll want to clone Gourmet to your computer and probably
[fork](https://github.com/thinkle/gourmet/fork) it as well.

Ensure your system has the necessary prerequisites installed:
- [Python](https://www.python.org/), which is what Gourmet is written in. Only
Python 3 is supported.
- [PyGObject](https://pygobject.readthedocs.io/en/latest/) for GTK+ 3 and other
GNOME libraries. You may either install your system's `pygobject` package(s),
or (perhaps recommended) only install the necessary system requirements so
you can install `pygobject` using `pip` (described below).
- [intltool](https://freedesktop.org/wiki/Software/intltool/) for
internationalization.
- (optional) [poppler](https://poppler.freedesktop.org/) for exporting PDFs.
Python bindings are provided through PyGObject, so install the GLIB bindings
and associated GObject introspection data.
- (optional) [Enchant](https://abiword.github.io/enchant/) for spell-checking.
At least one of the backends must be installed as well.

You may want to setup a [Python virtual
environment](https://docs.python.org/3/library/venv.html). This is optional but
highly recommended:
```bash
$ python -m venv --prompt gourmet env
$ source env/bin/activate
(gourmet) $ pip install -U pip setuptools wheel
```

Next, you should build localized files. Although this step isn't strictly
necessary, plugins will not work without it:
```bash
(gourmet) $ python setup.py build_i18n
```

Finally, you are ready to install Gourmet itself:
```bash
(gourmet) $ pip install -r development.in
```
**Note:** If you encounter an error during the installation of
`pygtkspellcheck`, first install `pyenchant` and `pygobject` on their own:
```bash
(gourmet) $ pip install pyenchant pygobject
(gourmet) $ pip install -r development.in
```
This installs the remaining Python dependencies and Gourmet itself in editable
mode, which allows you to run Gourmet and see your changes without having to
reinstall it.


At this point, you should be able to launch and run Gourmet:
```bash
(gourmet) $ gourmet
```


## Style

Gourmet is an old code base, consequently its style is not always consistent or
conformant to contemporary tastes. We are not interested in bikeshedding, but
please follow [PEP 8](http://www.python.org/dev/peps/pep-0008/) when writing new
code, and when working on old code, please tidy up as you go.

Make sure to also check out our upcoming [milestones](https://github.com/thinkle/gourmet/milestones).

## Issues and Suggestions

We welcome feedback and issue reporting. You can do so by browsing existing
issues and commenting on them, or creating a new one.

Expand Down
9 changes: 9 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
graft src
graft tests
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since the tests are now apart from the source, there's no need to package them, no?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They'll still be included in source distributions but not built distributions (e.g., wheels), which is what I think we want.


include FAQ
include INSTALL.md
include LICENSE
include README.md

global-exclude *.py[cod] __pycache__/* *.so *.dylib
5 changes: 5 additions & 0 deletions development.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
--editable .[epub-export,mycookbook,pdf-export,spellcheck,web-import]
dogtail
flake8
mypy
pytest
6 changes: 0 additions & 6 deletions development.txt

This file was deleted.

Loading